install.sh 2.24 KB
Newer Older
1
2
3
#!/bin/bash

#install minerva
4
apt-get install dirmngr
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb http://repo-r3lab.uni.lu/debian/ stable main" | tee /etc/apt/sources.list.d/repo-r3lab.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xcb185f4e31872412
apt-get update
apt-get install -y  mc apache2 php libapache2-mod-php7.0 minerva

#change tomcat memory limit to 4GB
sed -i 's/-Xmx128m/-Xmx4192m/g' /etc/default/tomcat7

#setup proxy in apache to go to tomcat7
sed -i '2i\    ProxyPass /minerva http://localhost:8080/minerva\n    ProxyPass /map_images http://localhost:8080/map_images\n    ProxyPassReverse /minerva http://localhost:8080/minerva\n    ProxyPassReverse /map_images http://localhost:8080/map_images\n' /etc/apache2/sites-enabled/000-default.conf

a2enmod proxy
a2enmod proxy_http
service apache2 restart

#create SSL certificat
sudo mkdir /etc/apache2/ssl
sudo openssl genrsa -des3 -passout pass:x -out /etc/apache2/ssl/server.pass.key 2048
sudo openssl rsa -passin pass:x -in /etc/apache2/ssl/server.pass.key -out /etc/apache2/ssl/server.key
sudo rm /etc/apache2/ssl/server.pass.key
sudo openssl req -new -key /etc/apache2/ssl/server.key -out /etc/apache2/ssl/server.csr   -subj "/C=LU/ST=Luxembourg/L=Esch-sur-Alzette/O=UL/OU=LCSB/CN=example.com"
sudo openssl x509 -req -days 365 -in /etc/apache2/ssl/server.csr -signkey /etc/apache2/ssl/server.key -out /etc/apache2/ssl/server.crt

#set the SSL certificate in apache2
sudo sed -i.bak -- 's/\/etc\/ssl\/certs\/ssl-cert-snakeoil\.pem/\/etc\/apache2\/ssl\/server.crt/g' /etc/apache2/sites-available/default-ssl.conf
sudo sed -i.bak -- 's/\/etc\/ssl\/private\/ssl-cert-snakeoil\.key/\/etc\/apache2\/ssl\/server.key/g' /etc/apache2/sites-available/default-ssl.conf
sudo a2ensite default-ssl
sudo a2enmod ssl

sudo sed -i.bak '/ProxyPass/d' /etc/apache2/sites-enabled/default-ssl.conf
sudo sed -i '3i\    ProxyPass / http://localhost/\n    ProxyPassReverse / http://localhost/\n' /etc/apache2/sites-enabled/default-ssl.conf

sudo service apache2 restart

#turn on backups
42
ln minerva-scripts/server/cron_backup.sh /etc/cron.daily/minerva