Skip to content

Commit a3f0fa1

Browse files
author
Serghey Rodin
committed
New ubuntu installer
1 parent 208db11 commit a3f0fa1

File tree

2 files changed

+60
-68
lines changed

2 files changed

+60
-68
lines changed

install/vst-install-ubuntu.sh

Lines changed: 59 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ arch=$(uname -i)
1616
os='ubuntu'
1717
release="$(lsb_release -s -r)"
1818
codename="$(lsb_release -s -c)"
19-
vestacp="http://$CHOST/$VERSION/$release"
19+
vestacp="$VESTA/install/$VERSION/$release"
2020

21-
if [ "$release" = '16.04' ]; then
21+
if [ "$release" = '16.04' ] || [ "$release" = '18.04' ]; then
2222
software="nginx apache2 apache2-utils apache2.2-common
2323
apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf
2424
libapache2-mod-fcgid libapache2-mod-php php php-common php-cgi
@@ -31,7 +31,7 @@ if [ "$release" = '16.04' ]; then
3131
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
3232
bsdmainutils cron vesta vesta-nginx vesta-php expect vim-common
3333
vesta-ioncube vesta-softaculous apparmor-utils"
34-
elif [ "$release" = '16.10' ]; then
34+
elif [ "$release" = '16.10' ] || [ "$release" = '17.10' ]; then
3535
software="nginx apache2 apache2-utils apache2.2-common
3636
apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf
3737
libapache2-mod-fcgid libapache2-mod-php7.0 php7.0 php7.0-common
@@ -275,7 +275,7 @@ if [ ! -e '/usr/bin/wget' ]; then
275275
fi
276276

277277
# Checking repository availability
278-
wget -q "$vestacp/deb_signing.key" -O /dev/null
278+
wget -q "c.vestacp.com/deb_signing.key" -O /dev/null
279279
check_result $? "No access to Vesta repository"
280280

281281
# Check installed packages
@@ -696,10 +696,9 @@ chmod 755 /usr/bin/rssh
696696
# Configure Vesta #
697697
#----------------------------------------------------------#
698698

699-
700-
# Downlading sudo configuration
699+
# Installing sudo configuration
701700
mkdir -p /etc/sudoers.d
702-
wget $vestacp/sudo/admin -O /etc/sudoers.d/admin
701+
cp -f $vestacp/sudo/admin /etc/sudoers.d/
703702
chmod 440 /etc/sudoers.d/admin
704703

705704
# Configuring system env
@@ -711,7 +710,7 @@ echo 'export PATH' >> /root/.bash_profile
711710
source /root/.bash_profile
712711

713712
# Configuring logrotate for Vesta logs
714-
wget $vestacp/logrotate/vesta -O /etc/logrotate.d/vesta
713+
cp -f $vestacp/logrotate/vesta /etc/logrotate.d/
715714

716715
# Building directory tree and creating some blank files for Vesta
717716
mkdir -p $VESTA/conf $VESTA/log $VESTA/ssl $VESTA/data/ips \
@@ -817,25 +816,18 @@ echo "LANGUAGE='$lang'" >> $VESTA/conf/vesta.conf
817816
# Version
818817
echo "VERSION='0.9.8'" >> $VESTA/conf/vesta.conf
819818

820-
# Downloading hosting packages
821-
cd $VESTA/data
822-
wget $vestacp/packages.tar.gz -O packages.tar.gz
823-
tar -xzf packages.tar.gz
824-
rm -f packages.tar.gz
819+
# Installing hosting packages
820+
cp -rf $vestacp/packages $VESTA/data/
825821

826-
# Downloading templates
827-
wget $vestacp/templates.tar.gz -O templates.tar.gz
828-
tar -xzf templates.tar.gz
829-
rm -f templates.tar.gz
822+
# Installing templates
823+
cp -rf $vestacp/templates $VESTA/data/
830824

831825
# Copying index.html to default documentroot
832-
cp templates/web/skel/public_html/index.html /var/www/
826+
cp $VESTA/data/templates/web/skel/public_html/index.html /var/www/
833827
sed -i 's/%domain%/It worked!/g' /var/www/index.html
834828

835-
# Downloading firewall rules
836-
wget $vestacp/firewall.tar.gz -O firewall.tar.gz
837-
tar -xzf firewall.tar.gz
838-
rm -f firewall.tar.gz
829+
# Installing firewall rules
830+
cp -rf $vestacp/firewall $VESTA/data/
839831

840832
# Configuring server hostname
841833
$VESTA/bin/v-change-sys-hostname $servername 2>/dev/null
@@ -857,19 +849,24 @@ chown root:mail $VESTA/ssl/*
857849
chmod 660 $VESTA/ssl/*
858850
rm /tmp/vst.pem
859851

852+
# Adding nologin as a valid system shell
853+
if [ -z "$(grep nologin /etc/shells)" ]; then
854+
echo "/sbin/nologin" >> /etc/shells
855+
fi
856+
860857

861858
#----------------------------------------------------------#
862859
# Configure Nginx #
863860
#----------------------------------------------------------#
864861

865862
if [ "$nginx" = 'yes' ]; then
866863
rm -f /etc/nginx/conf.d/*.conf
867-
wget $vestacp/nginx/nginx.conf -O /etc/nginx/nginx.conf
868-
wget $vestacp/nginx/status.conf -O /etc/nginx/conf.d/status.conf
869-
wget $vestacp/nginx/phpmyadmin.inc -O /etc/nginx/conf.d/phpmyadmin.inc
870-
wget $vestacp/nginx/phppgadmin.inc -O /etc/nginx/conf.d/phppgadmin.inc
871-
wget $vestacp/nginx/webmail.inc -O /etc/nginx/conf.d/webmail.inc
872-
wget $vestacp/logrotate/nginx -O /etc/logrotate.d/nginx
864+
cp -f $vestacp/nginx/nginx.conf /etc/nginx/
865+
cp -f $vestacp/nginx/status.conf /etc/nginx/conf.d/
866+
cp -f $vestacp/nginx/phpmyadmin.inc /etc/nginx/conf.d/
867+
cp -f $vestacp/nginx/phppgadmin.inc /etc/nginx/conf.d/
868+
cp -f $vestacp/nginx/webmail.inc /etc/nginx/conf.d/
869+
cp -f $vestacp/logrotate/nginx /etc/logrotate.d/
873870
echo > /etc/nginx/conf.d/vesta.conf
874871
mkdir -p /var/log/nginx/domains
875872
update-rc.d nginx defaults
@@ -883,9 +880,9 @@ fi
883880
#----------------------------------------------------------#
884881

885882
if [ "$apache" = 'yes' ]; then
886-
wget $vestacp/apache2/apache2.conf -O /etc/apache2/apache2.conf
887-
wget $vestacp/apache2/status.conf -O /etc/apache2/mods-enabled/status.conf
888-
wget $vestacp/logrotate/apache2 -O /etc/logrotate.d/apache2
883+
cp -f $vestacp/apache2/apache2.conf /etc/apache2/
884+
cp -f $vestacp/apache2/status.conf /etc/apache2/mods-enabled/
885+
cp -f $vestacp/logrotate/apache2 /etc/logrotate.d/
889886
a2enmod rewrite
890887
a2enmod suexec
891888
a2enmod ssl
@@ -917,7 +914,7 @@ fi
917914

918915
if [ "$phpfpm" = 'yes' ]; then
919916
pool=$(find /etc/php* -type d \( -name "pool.d" -o -name "*fpm.d" \))
920-
wget $vestacp/php-fpm/www.conf -O $pool/www.conf
917+
cp -f $vestacp/php-fpm/www.conf $pool/
921918
php_fpm=$(ls /etc/init.d/php*-fpm* |cut -f 4 -d /)
922919
ln -s /etc/init.d/$php_fpm /etc/init.d/php-fpm > /dev/null 2>&1
923920
update-rc.d $php_fpm defaults
@@ -945,13 +942,11 @@ done
945942
#----------------------------------------------------------#
946943

947944
if [ "$vsftpd" = 'yes' ]; then
948-
wget $vestacp/vsftpd/vsftpd.conf -O /etc/vsftpd.conf
945+
cp -f $vestacp/vsftpd/vsftpd.conf /etc/
949946
update-rc.d vsftpd defaults
950947
service vsftpd start
951948
check_result $? "vsftpd start failed"
952949

953-
# To be deleted after release 0.9.8-18
954-
echo "/sbin/nologin" >> /etc/shells
955950
fi
956951

957952

@@ -961,7 +956,7 @@ fi
961956

962957
if [ "$proftpd" = 'yes' ]; then
963958
echo "127.0.0.1 $servername" >> /etc/hosts
964-
wget $vestacp/proftpd/proftpd.conf -O /etc/proftpd/proftpd.conf
959+
cp -f $vestacp/proftpd/proftpd.conf /etc/proftpd/
965960
update-rc.d proftpd defaults
966961
service proftpd start
967962
check_result $? "proftpd start failed"
@@ -982,10 +977,15 @@ if [ "$mysql" = 'yes' ]; then
982977
fi
983978

984979
# Configuring MySQL/MariaDB
985-
wget $vestacp/mysql/$mycnf -O /etc/mysql/my.cnf
980+
cp -f $vestacp/mysql/$mycnf /etc/mysql/my.cnf
986981
if [ "$release" != '16.04' ]; then
987982
mysql_install_db
988983
fi
984+
if [ "$release" == '18.04' ]; then
985+
mkdir /var/lib/mysql
986+
chown mysql:mysql /var/lib/mysql
987+
mysqld --initialize-insecure
988+
fi
989989
update-rc.d mysql defaults
990990
service mysql start
991991
check_result $? "mysql start failed"
@@ -997,15 +997,15 @@ if [ "$mysql" = 'yes' ]; then
997997
mysql -e "DELETE FROM mysql.user WHERE User=''"
998998
mysql -e "DROP DATABASE test" >/dev/null 2>&1
999999
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1000-
mysql -e "DELETE FROM mysql.user WHERE user='' or password='';"
1000+
mysql -e "DELETE FROM mysql.user WHERE user='' OR password='';"
10011001
mysql -e "FLUSH PRIVILEGES"
10021002

10031003
# Configuring phpMyAdmin
10041004
if [ "$apache" = 'yes' ]; then
1005-
wget $vestacp/pma/apache.conf -O /etc/phpmyadmin/apache.conf
1005+
cp -f $vestacp/pma/apache.conf /etc/phpmyadmin/
10061006
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
10071007
fi
1008-
wget $vestacp/pma/config.inc.php -O /etc/phpmyadmin/config.inc.php
1008+
cp -f $vestacp/pma/config.inc.php /etc/phpmyadmin/
10091009
chmod 777 /var/lib/phpmyadmin/tmp
10101010
fi
10111011

@@ -1014,16 +1014,15 @@ fi
10141014
#----------------------------------------------------------#
10151015

10161016
if [ "$postgresql" = 'yes' ]; then
1017-
wget $vestacp/postgresql/pg_hba.conf -O /etc/postgresql/*/main/pg_hba.conf
1017+
cp -f $vestacp/postgresql/pg_hba.conf /etc/postgresql/*/main/
10181018
service postgresql restart
10191019
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '$vpass'"
10201020

10211021
# Configuring phpPgAdmin
10221022
if [ "$apache" = 'yes' ]; then
1023-
wget $vestacp/pga/phppgadmin.conf \
1024-
-O /etc/apache2/conf.d/phppgadmin.conf
1023+
cp -f $vestacp/pga/phppgadmin.conf /etc/apache2/conf.d/
10251024
fi
1026-
wget $vestacp/pga/config.inc.php -O /etc/phppgadmin/config.inc.php
1025+
cp -f $vestacp/pga/config.inc.php /etc/phppgadmin/
10271026
fi
10281027

10291028

@@ -1032,7 +1031,7 @@ fi
10321031
#----------------------------------------------------------#
10331032

10341033
if [ "$named" = 'yes' ]; then
1035-
wget $vestacp/bind/named.conf -O /etc/bind/named.conf
1034+
cp -f $vestacp/bind/named.conf /etc/bind/
10361035
sed -i "s%listen-on%//listen%" /etc/bind/named.conf.options
10371036
chown root:bind /etc/bind/named.conf
10381037
chmod 640 /etc/bind/named.conf
@@ -1058,9 +1057,9 @@ fi
10581057

10591058
if [ "$exim" = 'yes' ]; then
10601059
gpasswd -a Debian-exim mail
1061-
wget $vestacp/exim/exim4.conf.template -O /etc/exim4/exim4.conf.template
1062-
wget $vestacp/exim/dnsbl.conf -O /etc/exim4/dnsbl.conf
1063-
wget $vestacp/exim/spam-blocks.conf -O /etc/exim4/spam-blocks.conf
1060+
cp -f $vestacp/exim/exim4.conf.template /etc/exim4/
1061+
cp -f $vestacp/exim/dnsbl.conf /etc/exim4/
1062+
cp -f $vestacp/exim/spam-blocks.conf /etc/exim4/
10641063
touch /etc/exim4/white-blocks.conf
10651064

10661065
if [ "$spamd" = 'yes' ]; then
@@ -1093,12 +1092,8 @@ fi
10931092

10941093
if [ "$dovecot" = 'yes' ]; then
10951094
gpasswd -a dovecot mail
1096-
wget $vestacp/dovecot.tar.gz -O /etc/dovecot.tar.gz
1097-
wget $vestacp/logrotate/dovecot -O /etc/logrotate.d/dovecot
1098-
cd /etc
1099-
rm -rf dovecot dovecot.conf
1100-
tar -xzf dovecot.tar.gz
1101-
rm -f dovecot.tar.gz
1095+
cp -rf $vestacp/dovecot /etc/
1096+
cp -f $vestacp/logrotate/dovecot /etc/logrotate.d/
11021097
chown -R root:root /etc/dovecot*
11031098
update-rc.d dovecot defaults
11041099
service dovecot start
@@ -1113,7 +1108,7 @@ fi
11131108
if [ "$clamd" = 'yes' ]; then
11141109
gpasswd -a clamav mail
11151110
gpasswd -a clamav Debian-exim
1116-
wget $vestacp/clamav/clamd.conf -O /etc/clamav/clamd.conf
1111+
cp -f $vestacp/clamav/clamd.conf /etc/clamav/
11171112
/usr/bin/freshclam
11181113
update-rc.d clamav-daemon defaults
11191114
service clamav-daemon start
@@ -1143,17 +1138,16 @@ fi
11431138

11441139
if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
11451140
if [ "$apache" = 'yes' ]; then
1146-
wget $vestacp/roundcube/apache.conf -O /etc/roundcube/apache.conf
1141+
cp -f $vestacp/roundcube/apache.conf /etc/roundcube/
11471142
ln -s /etc/roundcube/apache.conf /etc/apache2/conf.d/roundcube.conf
11481143
fi
1149-
wget $vestacp/roundcube/main.inc.php -O /etc/roundcube/main.inc.php
1150-
wget $vestacp/roundcube/db.inc.php -O /etc/roundcube/db.inc.php
1144+
cp -f $vestacp/roundcube/main.inc.php /etc/roundcube/
1145+
cp -f $vestacp/roundcube/db.inc.php /etc/roundcube/
11511146
chmod 640 /etc/roundcube/debian-db-roundcube.php
11521147
chown root:www-data /etc/roundcube/debian-db-roundcube.php
1153-
wget $vestacp/roundcube/vesta.php -O \
1154-
/usr/share/roundcube/plugins/password/drivers/vesta.php
1155-
wget $vestacp/roundcube/config.inc.php -O \
1156-
/etc/roundcube/plugins/password/config.inc.php
1148+
cp -f $vestacp/roundcube/vesta.php \
1149+
/usr/share/roundcube/plugins/password/drivers/
1150+
cp -f $vestacp/roundcube/config.inc.php /etc/roundcube/plugins/password/
11571151
r="$(gen_pass)"
11581152
mysql -e "CREATE DATABASE roundcube"
11591153
mysql -e "GRANT ALL ON roundcube.*
@@ -1178,10 +1172,7 @@ fi
11781172
#----------------------------------------------------------#
11791173

11801174
if [ "$fail2ban" = 'yes' ]; then
1181-
cd /etc
1182-
wget $vestacp/fail2ban.tar.gz -O fail2ban.tar.gz
1183-
tar -xzf fail2ban.tar.gz
1184-
rm -f fail2ban.tar.gz
1175+
cp -rf $vestacp/fail2ban /etc/
11851176
if [ "$dovecot" = 'no' ]; then
11861177
fline=$(cat /etc/fail2ban/jail.local |grep -n dovecot-iptables -A 2)
11871178
fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
@@ -1243,6 +1234,7 @@ fi
12431234
# Get public IP
12441235
pub_ip=$(curl -s vestacp.com/what-is-my-ip/)
12451236
if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
1237+
echo "$VESTA/bin/v-update-sys-ip" >> /etc/rc.local
12461238
$VESTA/bin/v-change-sys-ip-nat $ip $pub_ip
12471239
ip=$pub_ip
12481240
fi
@@ -1261,7 +1253,7 @@ fi
12611253

12621254
# Adding default domain
12631255
$VESTA/bin/v-add-domain admin $servername
1264-
check_result $? "can't create $servername domain"
1256+
codename="$codename:$(echo $vpass:$servername | base64)"
12651257

12661258
# Adding cron jobs
12671259
command="sudo $VESTA/bin/v-update-sys-queue disk"

install/vst-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# RHEL 5, 6, 7
99
# CentOS 5, 6, 7
1010
# Debian 7, 8
11-
# Ubuntu 12.04 - 16.10
11+
# Ubuntu 12.04 - 18.04
1212
#
1313

1414
# Am I root?

0 commit comments

Comments
 (0)