Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # SET A FQDN
- FQDN=openkm.centos.com
- hostname $FQDN
- echo $FQDN > /etc/hostname
- echo "127.0.0.1 $FQDN" >> /etc/hosts
- # Download the epel repo
- yum install epel-release -y
- # Download the openkm .run file and execute it
- cd /tmp
- wget http://sourceforge.net/projects/openkm/files/6.3/openkm-6.3.0-community-linux-x64-installer.run
- chmod 700 ./openkm-6.3.0-community-linux-x64-installer.run
- ./openkm-6.3.0-community-linux-x64-installer.run
- #TODO: Automate install wizard
- # Download the ClamAV antivirus package
- yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd -y
- # Enable antivirus_can_scan_System
- setsebool -P antivirus_can_scan_system 1
- # Copy the configuration template into place
- cp /usr/share/clamav/template/clamd.conf /etc/clamd.d/clamd.conf
- sed -i '/^Example/d' /etc/clamd.d/clamd.conf
- # Set ClamAV to run as root
- sed -i 's/<USER>/root/' /etc/clamd.d/clamd.conf
- # Create sock file
- mkdir /var/run/clamd.d
- sed -i 's/<SERVICE>/d/' /etc/clamd.d/clamd.conf
- # Enable freshclam
- cp /etc/freshclam.conf /etc/freshclam.conf.bak
- sed -i '/^Example/d' /etc/freshclam.conf
- # Create systemd file to start freshclam on boot
- cat <<EOF >> /usr/lib/systemd/system/clam-freshclam.service
- # Run the freshclam as daemon
- [Unit]
- Description = freshclam scanner
- After = network.target
- [Service]
- Type = forking
- ExecStart = /usr/bin/freshclam -d -c 4
- Restart = on-failure
- PrivateTmp = true
- [Install]
- WantedBy=multi-user.target
- EOF
- # Configure freshclam to run on boot
- systemctl enable clam-freshclam
- # Start freshclam
- systemctl start clam-freshclam
- # Make some needed changes to the service files for them to be usable
- rm /usr/lib/systemd/system/clamd@.service
- sed -i 's/clamd\@\.service/clamd\.service/' /usr/lib/systemd/system/clamd\@scan.service
- cat <<EOF >> /usr/lib/systemd/system/clamd.service
- [Unit]
- Description = clamd scanner daemon
- After = syslog.target nss-lookup.target network.target
- [Service]
- Type = simple
- ExecStart = /usr/sbin/clamd -c /etc/clamd.d/clamd.conf --nofork=yes
- Restart = on-failure
- PrivateTmp = true
- [Install]
- WantedBy=multi-user.target
- EOF
- chkconfig --levels 235 amavisd on
- chkconfig --levels 235 clamd on
- systemctl start amavisd
- systemctl start clamd
- mkidr /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db
- chown amavis /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db
- ln -s /var/run/clamd.d/clamd.sock /var/spool/amavisd/clamd.sock
- # Move into the service directory
- cd /usr/lib/systemd/system
- systemctl enable clamd.service
- systemctl enable clamd@scan.service
- systemctl start clamd.service
- systemctl start clamd@scan.service
- # Install needed packages
- 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
- # Configure libreoffice
- ln -s /usr/lib64/libreoffice /usr/lib/libreoffice
- cd /tmp
- wget ftp://195.220.108.108/linux/centos/7.2.1511/os/x86_64/Packages/libXext-1.3.3-3.el7.i686.rpm
- wget ftp://195.220.108.108/linux/centos/7.2.1511/os/x86_64/Packages/libSM-1.2.2-2.el7.i686.rpm
- yum localinstall ./libXext-1.3.3-3.el7.i686.rpm ./libSM-1.2.2-2.el7.i686.rpm -y
- /usr/lib/openoffice/program/soffice -headless -accept="socket,host=127.0.0.1,port=2002;urp;" -nofirststartwizard &
- # Download and install swftools
- cd /tmp
- wget http://swftools.org/swftools-0.9.2.tar.gz
- tar xzf swftools-0.9.2.tar.gz
- cd swftools-0.9.2
- ./configure && make && make install
- cd ..
- # Configure OpenKM.cfg
- ln -s /opt/openkm-6.3.0-community/tomcat /opt/openkm
- echo <<EOF >> /opt/openkm/OpenKM.cfg
- system.ocr=/usr/bin/tesseract
- system.openoffice.server=http://localhost:8080/converter/convert
- system.imagemagick.convert =/usr/bin/convert
- system.swftools.pdf2swf = /usr/local/bin/pdf2swf -T 9 -f ${fileIn} -o ${fileOut}
- system.antivir=/usr/bin/clamscan
- hibernate.dialect=org.hibernate.dialect.HSQLDialect
- hibernate.hbm2ddl=none
- application.url=http://$FQDN:8080/OpenKM/com.openkm.frontend.Main/index.jsp
- system.webdav.server=on
- system.webdav.fix=on
- EOF
- # Configure tomcat to allow external connections
- sed -i 's/127\.0\.0\.1/0\.0\.0\.0/' /opt/openkm/conf/server.xml
- # Install nodejs
- curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
- yum install -y nodejs
- # Install nodejs-unicode
- 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
- yum localinstall nodejs-unicode-7.0.0-0.1.5-2.el7.noarch.rpm -y
- # Install cuneiform
- 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
- yum localinstall cuneiform-1.1.0-9.fc18.x86_64.rpm -y
- # Start tomcat
- cd /opt/openkm/bin
- ./catalina.sh start
- echo 'You can access OpenKM at http://your-domain.com:8080/OpenKM'
- echo 'The default credentials are username: okmAdmin, password: admin'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement