forked from Sevyls/vagrant-otrs
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.sh
More file actions
97 lines (81 loc) · 4.37 KB
/
bootstrap.sh
File metadata and controls
97 lines (81 loc) · 4.37 KB
1
2
3
4
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
OTRS_VERSION='4.0.9'
MYSQL_PASSWORD='vagrant'
install_mysql () {
debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_PASSWORD"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_PASSWORD"
apt-get install mysql-server -y > /dev/null
# Replace config values to fulfill the requirements of OTRS
sudo sed -ie 's/max_allowed_packet\([[:space:]]*\)=\([[:space:]]*\)[[:digit:]]*M/max_allowed_packet\1=\220M/g' /etc/mysql/my.cnf
sudo sed -ie 's/\(^.*bind-address.*$\)/\1\ninnodb_log_file_size = 512M/g' /etc/mysql/my.cnf
sudo mv /var/lib/mysql/ib_logfile[01] /tmp/
sudo service mysql restart
}
install_apache () {
sudo apt-get install -y apache2 build-essential libapache-dbi-perl libapache2-mod-perl2 libapache2-mod-perl2 libarchive-zip-perl libarchive-zip-perl libcrypt-eksblowfish-perl libdbd-mysql-perl libdbd-mysql-perl libdbd-mysql-perl libdbi-perl libdigest-md5-file-perl libdigest-perl libgd-graph-perl libgd-text-perl libio-socket-ssl-perl libjson-xs-perl libjson-xs-perl libnet-dns-perl libnet-dns-perl libnet-ldap-perl libpdf-api2-perl libsoap-lite-perl libtemplate-perl libtemplate-perl libtext-csv-xs-perl libtext-csv-xs-perl libtimedate-perl libxml-parser-perl libyaml-libyaml-perl libyaml-libyaml-perl perl > /dev/null
}
install_otrs_dependencies () {
sudo apt-get install -y libencode-hanextra-perl libgd-gd2-perl
}
install_phpmyadmin () {
# taken from mauserrifle/vagrant-debian-shell
if [ ! -f /etc/phpmyadmin/config.inc.php ];
then
# Used debconf-get-selections to find out what questions will be asked
# This command needs debconf-utils
# Handy for debugging. clear answers phpmyadmin: echo PURGE | debconf-communicate phpmyadmin
echo 'phpmyadmin phpmyadmin/dbconfig-install boolean false' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2' | debconf-set-selections
echo "phpmyadmin phpmyadmin/app-password-confirm password $MYSQL_PASSWORD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/admin-pass password $MYSQL_PASSWORD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/password-confirm password $MYSQL_PASSWORD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/setup-password password $MYSQL_PASSWORD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/database-type select mysql" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/app-pass password $MYSQL_PASSWORD" | debconf-set-selections
echo "dbconfig-common dbconfig-common/mysql/app-pass password $MYSQL_PASSWORD" | debconf-set-selections
echo "dbconfig-common dbconfig-common/mysql/app-pass password" | debconf-set-selections
echo "dbconfig-common dbconfig-common/password-confirm password $MYSQL_PASSWORD" | debconf-set-selections
echo "dbconfig-common dbconfig-common/app-password-confirm password $MYSQL_PASSWORD" | debconf-set-selections
echo "dbconfig-common dbconfig-common/app-password-confirm password $MYSQL_PASSWORD" | debconf-set-selections
echo "dbconfig-common dbconfig-common/password-confirm password $MYSQL_PASSWORD" | debconf-set-selections
fi
apt-get -y install phpmyadmin
}
install_otrs () {
echo "Download otrs..."
wget -q "http://ftp.otrs.org/pub/otrs/otrs-$OTRS_VERSION.tar.bz2" > /dev/null
echo "Extract otrs..."
tar xjf otrs-$OTRS_VERSION.tar.bz2 > /dev/null
sudo mv otrs-$OTRS_VERSION /opt/otrs
echo "Add otrs user..."
sudo useradd -d /opt/otrs/ -c 'OTRS user' otrs
sudo usermod -G www-data otrs
# Use `sudo usermod -Ga www-data otrs` instead when installing on an existing system
cd /opt/otrs/
cp Kernel/Config.pm.dist Kernel/Config.pm
cp Kernel/Config/GenericAgent.pm.dist Kernel/Config/GenericAgent.pm
echo "Check perl dependencies"
sudo perl /opt/otrs/bin/otrs.CheckModules.pl
sudo perl -cw /opt/otrs/bin/cgi-bin/index.pl
sudo perl -cw /opt/otrs/bin/cgi-bin/customer.pl
sudo perl -cw /opt/otrs/bin/otrs.PostMaster.pl
bin/otrs.SetPermissions.pl --web-group=www-data
sudo cp /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/sites-available/otrs.conf
sudo a2ensite otrs
# Do we need to do that too?
# a2enmod perl
# a2dismod mpm_event
# a2enmod mpm_prefork
sudo service apache2 restart
}
install_tools () {
sudo apt-get install -y wajig
}
echo "apt-get update..."
sudo apt-get update > /dev/null
echo "apt-get install..."
install_mysql
install_otrs_dependencies
install_apache
install_otrs
install_phpmyadmin
install_tools