Skip to content

Commit f4751a4

Browse files
author
Serghey Rodin
committed
Updated Amazon installer
1 parent 5fc8339 commit f4751a4

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

install/vst-install-amazon.sh

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ adduser backup 2>/dev/null
668668
ln -sf /home/backup /backup
669669
chmod a+x /backup
670670

671-
# Chaning default directory color
671+
# Set directory color
672672
echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
673673

674674
# Changing default systemd interval
@@ -684,7 +684,7 @@ fi
684684
# Configure VESTA #
685685
#----------------------------------------------------------#
686686

687-
# Downlading sudo configuration
687+
# Installing sudo configuration
688688
mkdir -p /etc/sudoers.d
689689
cp -f $vestacp/sudo/admin /etc/sudoers.d/
690690
chmod 440 /etc/sudoers.d/admin
@@ -700,7 +700,7 @@ source /root/.bash_profile
700700
# Configuring logrotate for vesta logs
701701
cp -f $vestacp/logrotate/vesta /etc/logrotate.d/
702702

703-
# Buidling directory tree and creating some blank files for vesta
703+
# Building directory tree and creating some blank files for vesta
704704
mkdir -p $VESTA/conf $VESTA/log $VESTA/ssl $VESTA/data/ips \
705705
$VESTA/data/queue $VESTA/data/users $VESTA/data/firewall \
706706
$VESTA/data/sessions
@@ -720,7 +720,7 @@ rm -f $VESTA/conf/vesta.conf 2>/dev/null
720720
touch $VESTA/conf/vesta.conf
721721
chmod 660 $VESTA/conf/vesta.conf
722722

723-
# WEB stack
723+
# Web stack
724724
if [ "$apache" = 'yes' ] && [ "$nginx" = 'no' ] ; then
725725
echo "WEB_SYSTEM='httpd'" >> $VESTA/conf/vesta.conf
726726
echo "WEB_RGROUPS='apache'" >> $VESTA/conf/vesta.conf
@@ -778,7 +778,7 @@ if [ "$exim" = 'yes' ]; then
778778
fi
779779
fi
780780

781-
# CRON daemon
781+
# Cron daemon
782782
echo "CRON_SYSTEM='crond'" >> $VESTA/conf/vesta.conf
783783

784784
# Firewall stack
@@ -835,7 +835,6 @@ sed -n "1,${crt_end}p" /tmp/vst.pem > certificate.crt
835835
sed -n "$key_start,${key_end}p" /tmp/vst.pem > certificate.key
836836
chown root:mail $VESTA/ssl/*
837837
chmod 660 $VESTA/ssl/*
838-
chmod u+s /usr/bin/find
839838
rm /tmp/vst.pem
840839

841840

@@ -853,8 +852,8 @@ if [ "$nginx" = 'yes' ]; then
853852
cp -f $vestacp/logrotate/nginx /etc/logrotate.d/
854853
echo > /etc/nginx/conf.d/vesta.conf
855854
mkdir -p /var/log/nginx/domains
856-
if [ "$release" -eq 7 ]; then
857-
mkdir /etc/systemd/system/nginx.service.d
855+
if [ "$release" -ge 7 ]; then
856+
mkdir -p /etc/systemd/system/nginx.service.d
858857
cd /etc/systemd/system/nginx.service.d
859858
echo "[Service]" > limits.conf
860859
echo "LimitNOFILE=500000" >> limits.conf
@@ -864,7 +863,7 @@ if [ "$nginx" = 'yes' ]; then
864863
check_result $? "nginx start failed"
865864

866865
# Workaround for OpenVZ/Virtuozzo
867-
if [ "$release" -eq '7' ] && [ -e "/proc/vz/veinfo" ]; then
866+
if [ "$release" -ge '7' ] && [ -e "/proc/vz/veinfo" ]; then
868867
echo "#Vesta: workraround for networkmanager" >> /etc/rc.local
869868
echo "sleep 3 && service nginx restart" >> /etc/rc.local
870869
fi
@@ -881,11 +880,12 @@ if [ "$apache" = 'yes' ]; then
881880
cp -f $vestacp/httpd/ssl.conf /etc/httpd/conf.d/
882881
cp -f $vestacp/httpd/ruid2.conf /etc/httpd/conf.d/
883882
cp -f $vestacp/logrotate/httpd /etc/logrotate.d/
884-
if [ $release -ne 7 ]; then
885-
echo "MEFaccept 127.0.0.1" >> /etc/httpd/conf.d/mod_extract*.conf
886-
echo > /etc/httpd/conf.d/proxy_ajp.conf
883+
if [ $release -lt 7 ]; then
884+
cd /etc/httpd/conf.d
885+
echo "MEFaccept 127.0.0.1" >> mod_extract_forwarded.conf
886+
echo > proxy_ajp.conf
887887
fi
888-
if [ -e "conf.modules.d/00-dav.conf" ]; then
888+
if [ -e "/etc/httpd/conf.modules.d/00-dav.conf" ]; then
889889
cd /etc/httpd/conf.modules.d
890890
sed -i "s/^/#/" 00-dav.conf 00-lua.conf 00-proxy.conf
891891
fi
@@ -897,8 +897,8 @@ if [ "$apache" = 'yes' ]; then
897897
chmod a+x /var/log/httpd
898898
mkdir -p /var/log/httpd/domains
899899
chmod 751 /var/log/httpd/domains
900-
if [ "$release" -eq 7 ]; then
901-
mkdir /etc/systemd/system/httpd.service.d
900+
if [ "$release" -ge 7 ]; then
901+
mkdir -p /etc/systemd/system/httpd.service.d
902902
cd /etc/systemd/system/httpd.service.d
903903
echo "[Service]" > limits.conf
904904
echo "LimitNOFILE=500000" >> limits.conf
@@ -908,7 +908,7 @@ if [ "$apache" = 'yes' ]; then
908908
check_result $? "httpd start failed"
909909

910910
# Workaround for OpenVZ/Virtuozzo
911-
if [ "$release" -eq '7' ] && [ -e "/proc/vz/veinfo" ]; then
911+
if [ "$release" -ge '7' ] && [ -e "/proc/vz/veinfo" ]; then
912912
echo "#Vesta: workraround for networkmanager" >> /etc/rc.local
913913
echo "sleep 2 && service httpd restart" >> /etc/rc.local
914914
fi
@@ -945,7 +945,7 @@ done
945945

946946

947947
#----------------------------------------------------------#
948-
# Configure VSFTPD #
948+
# Configure Vsftpd #
949949
#----------------------------------------------------------#
950950

951951
if [ "$vsftpd" = 'yes' ]; then
@@ -989,7 +989,7 @@ if [ "$mysql" = 'yes' ]; then
989989
chown mysql:mysql /var/lib/mysql
990990
mkdir -p /etc/my.cnf.d
991991

992-
if [ $release -ne 7 ]; then
992+
if [ $release -lt 7 ]; then
993993
service='mysqld'
994994
else
995995
service='mariadb'
@@ -1031,7 +1031,7 @@ fi
10311031
#----------------------------------------------------------#
10321032

10331033
if [ "$postgresql" = 'yes' ]; then
1034-
if [ $release = 5 ]; then
1034+
if [ $release -eq 5 ]; then
10351035
service postgresql start
10361036
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '$vpass'"
10371037
service postgresql stop
@@ -1125,16 +1125,15 @@ if [ "$clamd" = 'yes' ]; then
11251125
gpasswd -a clam mail
11261126
cp -f $vestacp/clamav/clamd.conf /etc/
11271127
cp -f $vestacp/clamav/freshclam.conf /etc/
1128-
mkdir -p /var/log/clamav
1129-
mkdir -p /var/run/clamav
1128+
mkdir -p /var/log/clamav /var/run/clamav
11301129
chown clam:clam /var/log/clamav /var/run/clamav
11311130
chown -R clam:clam /var/lib/clamav
1132-
if [ "$release" -eq '7' ]; then
1131+
if [ "$release" -ge '7' ]; then
11331132
cp -f $vestacp/clamav/clamd.service /usr/lib/systemd/system/
11341133
systemctl --system daemon-reload
11351134
fi
11361135
/usr/bin/freshclam
1137-
if [ "$release" -eq '7' ]; then
1136+
if [ "$release" -ge '7' ]; then
11381137
sed -i "s/nofork/foreground/" /usr/lib/systemd/system/clamd.service
11391138
systemctl daemon-reload
11401139
fi
@@ -1152,7 +1151,7 @@ if [ "$spamd" = 'yes' ]; then
11521151
chkconfig spamassassin on
11531152
service spamassassin start
11541153
check_result $? "spamassassin start failed"
1155-
if [ "$release" -eq '7' ]; then
1154+
if [ "$release" -ge '7' ]; then
11561155
groupadd -g 1001 spamd
11571156
useradd -u 1001 -g spamd -s /sbin/nologin -d \
11581157
/var/lib/spamassassin spamd
@@ -1216,9 +1215,9 @@ if [ "$fail2ban" = 'yes' ]; then
12161215
fline=$(cat /etc/fail2ban/jail.local |grep -n vsftpd-iptables -A 2)
12171216
fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
12181217
sed -i "${fline}s/false/true/" /etc/fail2ban/jail.local
1219-
fi
1218+
fi
12201219
chkconfig fail2ban on
1221-
/bin/mkdir -p /var/run/fail2ban
1220+
mkdir -p /var/run/fail2ban
12221221
if [ -e "/usr/lib/systemd/system/fail2ban.service" ]; then
12231222
exec_pre='ExecStartPre=/bin/mkdir -p /var/run/fail2ban'
12241223
sed -i "s|\[Service\]|[Service]\n$exec_pre|g" \
@@ -1246,47 +1245,47 @@ if [ ! -z "$(grep ^admin: /etc/group)" ] && [ "$force" = 'yes' ]; then
12461245
groupdel admin > /dev/null 2>&1
12471246
fi
12481247

1249-
# Adding vesta account
1248+
# Adding Vesta admin account
12501249
$VESTA/bin/v-add-user admin $vpass $email default System Administrator
12511250
check_result $? "can't create admin user"
12521251
$VESTA/bin/v-change-user-shell admin bash
12531252
$VESTA/bin/v-change-user-language admin $lang
12541253

1255-
# Configuring system ips
1254+
# Configuring system IPs
12561255
$VESTA/bin/v-update-sys-ip
12571256

1258-
# Get main ip
1257+
# Get main IP
12591258
ip=$(ip addr|grep 'inet '|grep global|head -n1|awk '{print $2}'|cut -f1 -d/)
12601259

1261-
# Firewall configuration
1260+
# Configuring firewall
12621261
if [ "$iptables" = 'yes' ]; then
12631262
$VESTA/bin/v-update-firewall
12641263
fi
12651264

1266-
# Get public ip
1265+
# Get public IP
12671266
pub_ip=$(curl -s vestacp.com/what-is-my-ip/)
12681267
if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
12691268
echo "$VESTA/bin/v-update-sys-ip" >> /etc/rc.local
12701269
$VESTA/bin/v-change-sys-ip-nat $ip $pub_ip
12711270
ip=$pub_ip
12721271
fi
12731272

1274-
# Configuring mysql host
1273+
# Configuring MySQL host
12751274
if [ "$mysql" = 'yes' ]; then
12761275
$VESTA/bin/v-add-database-host mysql localhost root $vpass
12771276
$VESTA/bin/v-add-database admin default default $(gen_pass) mysql
12781277
fi
12791278

1280-
# Configuring pgsql host
1279+
# Configuring PostgreSQL host
12811280
if [ "$postgresql" = 'yes' ]; then
12821281
$VESTA/bin/v-add-database-host pgsql localhost postgres $vpass
12831282
$VESTA/bin/v-add-database admin db db $(gen_pass) pgsql
12841283
fi
12851284

12861285
# Adding default domain
12871286
$VESTA/bin/v-add-domain admin $servername
1288-
check_result $? "can't create $servername domain"
12891287

1288+
# Adding cron jobs
12901289
command="sudo $VESTA/bin/v-update-sys-queue disk"
12911290
$VESTA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
12921291
command="sudo $VESTA/bin/v-update-sys-queue traffic"
@@ -1303,20 +1302,20 @@ command="sudo $VESTA/bin/v-update-sys-rrd"
13031302
$VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
13041303
service crond restart
13051304

1306-
# Building initial rrd images
1305+
# Building RRD images
13071306
$VESTA/bin/v-update-sys-rrd
13081307

13091308
# Enabling file system quota
13101309
if [ "$quota" = 'yes' ]; then
13111310
$VESTA/bin/v-add-sys-quota
13121311
fi
13131312

1314-
# Enabling softaculous plugin
1313+
# Enabling Softaculous plugin
13151314
if [ "$softaculous" = 'yes' ]; then
13161315
$VESTA/bin/v-add-vesta-softaculous
13171316
fi
13181317

1319-
# Starting vesta service
1318+
# Starting Vesta service
13201319
chkconfig vesta on
13211320
service vesta start
13221321
check_result $? "vesta start failed"
@@ -1336,7 +1335,7 @@ $VESTA/bin/v-add-cron-vesta-autoupdate
13361335
# Sending install notification to vestacp.com
13371336
wget vestacp.com/notify/?$codename -O /dev/null -q
13381337

1339-
# Comparing hostname and ip
1338+
# Comparing hostname and IP
13401339
host_ip=$(host $servername |head -n 1 |awk '{print $NF}')
13411340
if [ "$host_ip" = "$ip" ]; then
13421341
ip="$servername"

0 commit comments

Comments
 (0)