Advertisement
Guest User

Untitled

a guest
Apr 4th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.29 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # SET A FQDN
  4. FQDN=openkm.centos.com
  5. hostname $FQDN
  6. echo $FQDN > /etc/hostname
  7. echo "127.0.0.1 $FQDN" >> /etc/hosts
  8.  
  9.  
  10. # Download the epel repo
  11. yum install epel-release -y
  12.  
  13. # Download the openkm .run file and execute it
  14. cd /tmp
  15. wget http://sourceforge.net/projects/openkm/files/6.3/openkm-6.3.0-community-linux-x64-installer.run
  16. chmod 700 ./openkm-6.3.0-community-linux-x64-installer.run
  17. ./openkm-6.3.0-community-linux-x64-installer.run
  18. #TODO: Automate install wizard
  19.  
  20.  
  21.  
  22. # Download the ClamAV antivirus package
  23. yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd -y
  24.  
  25. # Enable antivirus_can_scan_System
  26. setsebool -P antivirus_can_scan_system 1
  27.  
  28. # Copy the configuration template into place
  29. cp /usr/share/clamav/template/clamd.conf /etc/clamd.d/clamd.conf
  30. sed -i '/^Example/d' /etc/clamd.d/clamd.conf
  31.  
  32. # Set ClamAV to run as root
  33. sed -i 's/<USER>/root/' /etc/clamd.d/clamd.conf
  34.  
  35. # Create sock file
  36. mkdir /var/run/clamd.d
  37. sed -i 's/<SERVICE>/d/' /etc/clamd.d/clamd.conf
  38.  
  39. # Enable freshclam
  40. cp /etc/freshclam.conf /etc/freshclam.conf.bak
  41. sed -i '/^Example/d' /etc/freshclam.conf
  42.  
  43. # Create systemd file to start freshclam on boot
  44. cat <<EOF >> /usr/lib/systemd/system/clam-freshclam.service
  45. # Run the freshclam as daemon
  46. [Unit]
  47. Description = freshclam scanner
  48. After = network.target
  49. [Service]
  50. Type = forking
  51. ExecStart = /usr/bin/freshclam -d -c 4
  52. Restart = on-failure
  53. PrivateTmp = true
  54. [Install]
  55. WantedBy=multi-user.target
  56. EOF
  57.  
  58. # Configure freshclam to run on boot
  59. systemctl enable clam-freshclam
  60.  
  61. # Start freshclam
  62. systemctl start clam-freshclam
  63.  
  64. # Make some needed changes to the service files for them to be usable
  65. rm /usr/lib/systemd/system/clamd@.service
  66. sed -i 's/clamd\@\.service/clamd\.service/' /usr/lib/systemd/system/clamd\@scan.service
  67. cat <<EOF >> /usr/lib/systemd/system/clamd.service
  68. [Unit]
  69. Description = clamd scanner daemon
  70. After = syslog.target nss-lookup.target network.target
  71. [Service]
  72. Type = simple
  73. ExecStart = /usr/sbin/clamd -c /etc/clamd.d/clamd.conf --nofork=yes
  74. Restart = on-failure
  75. PrivateTmp = true
  76. [Install]
  77. WantedBy=multi-user.target
  78. EOF
  79. chkconfig --levels 235 amavisd on
  80. chkconfig --levels 235 clamd on
  81. systemctl start amavisd
  82. systemctl start clamd
  83. mkidr /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db
  84. chown amavis /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db
  85. ln -s /var/run/clamd.d/clamd.sock /var/spool/amavisd/clamd.sock
  86.  
  87.  
  88.  
  89. # Move into the service directory
  90. cd /usr/lib/systemd/system
  91. systemctl enable clamd.service
  92. systemctl enable clamd@scan.service
  93. systemctl start clamd.service
  94. systemctl start clamd@scan.service
  95.  
  96. # Install needed packages
  97. yum install -y ImageMagick libjpeg-devel libpng-devel libtiff-devel zlib-devel gcc gcc-c++ make autoconf libtool automake gcc* libreoffice* automake zlib-devel libjpeg-devel giflib-devel freetype-devel ImageMagick amavisd-new spamassassin clamav clamd unzip bzip2 unrar perl-DBD-mysql java-1.8.0-openjdk-devel.x86_64 libjpeg-devel libpng-devel libtiff-devel zlib-devel gcc gcc-c++ make autoconf libtool automake tesseract giflib-devel freetype-devel python-xvfbwrapper
  98.  
  99. # Configure libreoffice
  100. ln -s /usr/lib64/libreoffice /usr/lib/libreoffice
  101. cd /tmp
  102. wget ftp://195.220.108.108/linux/centos/7.2.1511/os/x86_64/Packages/libXext-1.3.3-3.el7.i686.rpm
  103. wget ftp://195.220.108.108/linux/centos/7.2.1511/os/x86_64/Packages/libSM-1.2.2-2.el7.i686.rpm
  104. yum localinstall ./libXext-1.3.3-3.el7.i686.rpm ./libSM-1.2.2-2.el7.i686.rpm -y
  105. /usr/lib/openoffice/program/soffice -headless -accept="socket,host=127.0.0.1,port=2002;urp;" -nofirststartwizard &
  106.  
  107. # Download and install swftools
  108. cd /tmp
  109. wget http://swftools.org/swftools-0.9.2.tar.gz
  110. tar xzf swftools-0.9.2.tar.gz
  111. cd swftools-0.9.2
  112. ./configure && make && make install
  113. cd ..
  114.  
  115. # Configure OpenKM.cfg
  116. ln -s /opt/openkm-6.3.0-community/tomcat /opt/openkm
  117. echo <<EOF >> /opt/openkm/OpenKM.cfg
  118. system.ocr=/usr/bin/tesseract
  119. system.openoffice.server=http://localhost:8080/converter/convert
  120. system.imagemagick.convert =/usr/bin/convert
  121. system.swftools.pdf2swf = /usr/local/bin/pdf2swf -T 9 -f ${fileIn} -o ${fileOut}
  122. system.antivir=/usr/bin/clamscan
  123. hibernate.dialect=org.hibernate.dialect.HSQLDialect
  124. hibernate.hbm2ddl=none
  125. application.url=http://$FQDN:8080/OpenKM/com.openkm.frontend.Main/index.jsp
  126. system.webdav.server=on
  127. system.webdav.fix=on
  128. EOF
  129.  
  130. # Configure tomcat to allow external connections
  131. sed -i 's/127\.0\.0\.1/0\.0\.0\.0/' /opt/openkm/conf/server.xml
  132.  
  133. # Install nodejs
  134. curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
  135. yum install -y nodejs
  136.  
  137. # Install nodejs-unicode
  138. wget ftp://ftp.muug.mb.ca/mirror/fedora/epel/7/x86_64/n/nodejs-unicode-7.0.0-0.1.5-2.el7.noarch.rpm
  139. yum localinstall nodejs-unicode-7.0.0-0.1.5-2.el7.noarch.rpm -y
  140.  
  141. # Install cuneiform
  142. wget ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/18/Everything/x86_64/os/Packages/c/cuneiform-1.1.0-9.fc18.x86_64.rpm
  143.  
  144. yum localinstall cuneiform-1.1.0-9.fc18.x86_64.rpm -y
  145.  
  146. # Start tomcat
  147. cd /opt/openkm/bin
  148. ./catalina.sh start
  149.  
  150.  
  151. echo 'You can access OpenKM at http://your-domain.com:8080/OpenKM'
  152. echo 'The default credentials are username: okmAdmin, password: admin'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement