-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision.sh
105 lines (76 loc) · 3.9 KB
/
provision.sh
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
97
98
99
100
101
102
103
104
105
timedatectl set-timezone $TIMEZONE
echo '==> Setting time zone to '$(cat /etc/timezone)
echo '==> Updating Debian repositories'
apt-get -q=2 update
echo '==> Installing Linux tools'
cp /vagrant/config/bash_aliases /home/vagrant/.bash_aliases
chown vagrant:vagrant /home/vagrant/.bash_aliases
apt-get -q=2 install software-properties-common tree zip unzip pv whois &>/dev/null
echo '==> Installing Git and Subversion'
apt-get -q=2 install git subversion &>/dev/null
echo '==> Installing Apache'
apt-get -q=2 install apache2 apache2-utils &>/dev/null
apt-get -q=2 update
cp /vagrant/config/localhost.conf /etc/apache2/conf-available/localhost.conf
cp /vagrant/config/virtualhost.conf /etc/apache2/sites-available/virtualhost.conf
sed -i 's|GUEST_SYNCED_FOLDER|'$GUEST_SYNCED_FOLDER'|' /etc/apache2/sites-available/virtualhost.conf
sed -i 's|FORWARDED_PORT_80|'$FORWARDED_PORT_80'|' /etc/apache2/sites-available/virtualhost.conf
a2enconf localhost &>/dev/null
a2enmod rewrite vhost_alias &>/dev/null
a2ensite virtualhost &>/dev/null
echo '==> Setting MariaDB 10.6 repository'
apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' &>/dev/null
cp /vagrant/config/MariaDB.list /etc/apt/sources.list.d/MariaDB.list
apt-get -q=2 update
echo '==> Installing MariaDB'
DEBIAN_FRONTEND=noninteractive apt-get -q=2 install mariadb-server &>/dev/null
echo '==> Setting PHP 8.2 repository'
apt-get -q=2 install apt-transport-https &>/dev/null
curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
cp /vagrant/config/php.list /etc/apt/sources.list.d/php.list
apt-get -q=2 update
echo '==> Installing PHP'
apt-get -q=2 install php8.2 php-pear php8.2-cli libapache2-mod-php8.2 libphp8.2-embed \
php8.2-bcmath php8.2-bz2 php8.2-curl php8.2-fpm php8.2-gd php8.2-imap php8.2-intl \
php8.2-mbstring php8.2-mysql php8.2-mysqlnd php8.2-pgsql php8.2-pspell php8.2-readline \
php8.2-soap php8.2-sqlite3 php8.2-tidy php8.2-xdebug php8.2-xml php8.2-xmlrpc php8.2-yaml php8.2-zip &>/dev/null
a2dismod mpm_event &>/dev/null
a2enmod mpm_prefork &>/dev/null
a2enmod php8.2 &>/dev/null
cp /vagrant/config/php.ini.htaccess /var/www/.htaccess
PHP_ERROR_REPORTING_INT=$(php -r 'echo '"$PHP_ERROR_REPORTING"';')
sed -i 's|PHP_ERROR_REPORTING_INT|'$PHP_ERROR_REPORTING_INT'|' /var/www/.htaccess
echo '==> Installing Adminer'
if [ ! -d /usr/share/adminer ]; then
mkdir -p /usr/share/adminer/plugins
curl -LsS https://www.adminer.org/latest-en.php -o /usr/share/adminer/latest-en.php
curl -LsS https://raw.githubusercontent.com/vrana/adminer/master/plugins/plugin.php -o /usr/share/adminer/plugins/plugin.php
curl -LsS https://raw.githubusercontent.com/vrana/adminer/master/plugins/login-password-less.php -o /usr/share/adminer/plugins/login-password-less.php
curl -LsS https://raw.githubusercontent.com/vrana/adminer/master/plugins/dump-json.php -o /usr/share/adminer/plugins/dump-json.php
curl -LsS https://raw.githubusercontent.com/vrana/adminer/master/plugins/pretty-json-column.php -o /usr/share/adminer/plugins/pretty-json-column.php
curl -LsS https://raw.githubusercontent.com/vrana/adminer/master/designs/nicu/adminer.css -o /usr/share/adminer/adminer.css
fi
cp /vagrant/config/adminer.php /usr/share/adminer/adminer.php
cp /vagrant/config/adminer.conf /etc/apache2/conf-available/adminer.conf
sed -i 's|FORWARDED_PORT_80|'$FORWARDED_PORT_80'|' /etc/apache2/conf-available/adminer.conf
a2enconf adminer &>/dev/null
echo '==> Testing Apache configuration'
apache2ctl configtest
echo '==> Starting Apache'
service apache2 restart
echo '==> Starting MariaDB'
service mysql restart
mysqladmin -u root password ""
echo '==> Cleaning apt cache'
apt-get -q=2 autoclean
apt-get -q=2 autoremove
echo '==> Versions:'
lsb_release -d | cut -f 2
openssl version
curl --version | head -n1 | cut -d '(' -f 1
svn --version | grep svn,
git --version
apache2 -v | head -n1
mysql -V
php -v | head -n1
python3 --version