vst-install.sh 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. #!/bin/bash
  2. # Vesta installer
  3. # Define Variables
  4. RHOST='r.vestacp.com'
  5. CHOST='c.vestacp.com'
  6. REPO='cmmnt'
  7. VERSION='0.9.7'
  8. YUM_REPO='/etc/yum.repos.d/vesta.repo'
  9. arch=$(uname -i)
  10. tools="screen mc libpng libjpeg curl curl libmcrypt libmcrypt mhash mhash
  11. freetype openssl flex libxml2 ImageMagick sqlite sqlite pcre pcre sudo bc
  12. mailx lsof ntp tar whois telnet rsync"
  13. rpms="nginx httpd httpd-devel.$arch mod_ssl mod_ruid2 mod_extract_forwarded
  14. webalizer awstats mysql mysql-server php php-bcmath php-cli php-common
  15. php-gd php-imap php-mbstring php-mcrypt php-mysql php-pdo php-soap php-tidy
  16. php-xml php-xmlrpc phpMyAdmin exim dovecot clamd spamassassin roundcubemail
  17. bind bind-utils bind-libs vsftpd rrdtool GeoIP vesta vesta-nginx vesta-php"
  18. # Am I root?
  19. if [ "x$(id -u)" != 'x0' ]; then
  20. echo 'Error: this script can only be executed by root'
  21. exit 1
  22. fi
  23. # Check supported version
  24. if [ ! -e '/etc/redhat-release' ]; then
  25. echo 'Error: sorry, we currently support RHEL and CentOS only'
  26. exit 1
  27. fi
  28. os=$(cut -f 1 -d ' ' /etc/redhat-release)
  29. if [ $os != 'CentOS' ] && [ $os != 'Red' ]; then
  30. echo 'Error: sorry, we currently support RHEL and CentOS only'
  31. fi
  32. release=$(grep -o "[0-9]" /etc/redhat-release |head -n1)
  33. help() {
  34. echo "usage: $0 [OPTIONS]
  35. -e, --email Define email address
  36. -h, --help Print this help and exit
  37. -f, --force Force installation"
  38. exit 1
  39. }
  40. # Translating argument to --gnu-long-options
  41. for arg; do
  42. delim=""
  43. case "$arg" in
  44. --help) args="${args}-h " ;;
  45. --force) args="${args}-f " ;;
  46. --email) args="${args}-e " ;;
  47. *) [[ "${arg:0:1}" == "-" ]] || delim="\""
  48. args="${args}${delim}${arg}${delim} ";;
  49. esac
  50. done
  51. eval set -- "$args"
  52. # Getopt
  53. while getopts "hfe:" Option; do
  54. case $Option in
  55. h) help ;; # Help
  56. e) email=$OPTARG ;; # Contact email
  57. f) force=yes ;; # Force install
  58. *) help ;; # Default
  59. esac
  60. done
  61. # Are you sure ?
  62. if [ -z $email ]; then
  63. echo
  64. echo
  65. echo
  66. echo
  67. echo
  68. echo ' ***********************************************************'
  69. echo
  70. echo ' _| _| _|_|_|_| _|_|_| _|_|_|_|_| _|_| '
  71. echo ' _| _| _| _| _| _| _| '
  72. echo ' _| _| _|_|_| _|_| _| _|_|_|_| '
  73. echo ' _| _| _| _| _| _| _| '
  74. echo ' _| _|_|_|_| _|_|_| _| _| _| '
  75. echo
  76. echo
  77. echo
  78. echo
  79. echo
  80. echo
  81. echo
  82. echo
  83. echo ' ***********************************************************'
  84. echo
  85. echo
  86. read -n 1 -p 'Do you want to install Vesta Control Panel? [y/n]): ' answer
  87. if [ "$answer" != 'y' ] && [ "$answer" != 'Y' ]; then
  88. echo 'Goodbye'
  89. exit 1
  90. fi
  91. echo
  92. # Check email
  93. read -p 'Please enter valid email address: ' email
  94. fi
  95. # Validate email
  96. local_part=$(echo $email | cut -s -f1 -d\@)
  97. remote_host=$(echo $email | cut -s -f2 -d\@)
  98. mx_failed=1
  99. if [ ! -z "$remote_host" ] && [ ! -z "$local_part" ]; then
  100. /usr/bin/host -t mx "$remote_host" &> /dev/null
  101. mx_failed="$?"
  102. fi
  103. if [ "$mx_failed" -eq 1 ]; then
  104. echo "Error: email $email is not valid"
  105. exit 1
  106. fi
  107. echo
  108. echo
  109. echo
  110. echo
  111. echo 'Installation will take about 15 minutes ...'
  112. echo
  113. sleep 2
  114. # Check wget
  115. if [ ! -e '/usr/bin/wget' ]; then
  116. yum -y install wget
  117. if [ $? -ne 0 ]; then
  118. echo "Error: can't install wget"
  119. exit 1
  120. fi
  121. fi
  122. # Check repo availability
  123. wget "$RHOST/$REPO/vesta.conf" -O /dev/null
  124. if [ $? -ne 0 ]; then
  125. echo "Error: no access to $REPO repository"
  126. exit 1
  127. fi
  128. # Check installed packages
  129. tmpfile=$(mktemp -p /tmp)
  130. rpm -qa > $tmpfile
  131. for rpm in $rpms; do
  132. if [ ! -z "$(grep ^$rpm. $tmpfile)" ]; then
  133. conflicts="$rpm $conflicts"
  134. fi
  135. done
  136. rm -f $tmpfile
  137. if [ ! -z "$conflicts" ] && [ -z "$force" ]; then
  138. echo
  139. echo '!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!'
  140. echo
  141. echo 'Following rpm packages aleady installed:'
  142. echo "$conflicts"
  143. echo
  144. echo 'It is highly recommended to remove them before proceeding.'
  145. echo
  146. echo 'If you want to force installation run this script with -f option:'
  147. echo "Example: bash $0 --force"
  148. echo
  149. echo '!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!'
  150. echo
  151. exit 1
  152. fi
  153. # Password generator
  154. gen_pass() {
  155. MATRIX='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
  156. LENGTH=10
  157. while [ ${n:=1} -le $LENGTH ]; do
  158. PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"
  159. let n+=1
  160. done
  161. echo "$PASS"
  162. }
  163. # Update system
  164. yum -y update
  165. if [ $? -ne 0 ]; then
  166. echo 'Error: yum update failed'
  167. exit 1
  168. fi
  169. # Install additional packages
  170. yum -y install $tools
  171. if [ $? -ne 0 ]; then
  172. echo 'Error: yum install failed'
  173. exit 1
  174. fi
  175. # Install EPEL repo
  176. if [ ! -e '/etc/yum.repos.d/epel.repo' ]; then
  177. if [ "$release" -eq '5' ]; then
  178. epel="5/i386/epel-release-5-4.noarch.rpm"
  179. fi
  180. if [ "$release" -eq '6' ]; then
  181. epel="6/i386/epel-release-6-7.noarch.rpm"
  182. fi
  183. rpm -ivh http://dl.fedoraproject.org/pub/epel/$epel
  184. if [ $? -ne 0 ]; then
  185. echo "Error: can't install EPEL repository"
  186. exit 1
  187. fi
  188. fi
  189. # Install remi repo
  190. if [ ! -e '/etc/yum.repos.d/remi.repo' ]; then
  191. if [ "$release" -eq '5' ]; then
  192. remi="remi-release-5.rpm"
  193. fi
  194. if [ "$release" -eq '6' ]; then
  195. remi="remi-release-6.rpm"
  196. fi
  197. rpm -ivh http://rpms.famillecollet.com/enterprise/$remi
  198. if [ $? -ne 0 ]; then
  199. echo "Error: can't install remi repository"
  200. exit 1
  201. fi
  202. fi
  203. # Install vesta repo
  204. echo "[vesta]
  205. name=Vesta - $REPO
  206. baseurl=http://$RHOST/$REPO/$release/\$basearch/
  207. enabled=1
  208. gpgcheck=1
  209. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-VESTA" > $YUM_REPO
  210. wget $CHOST/GPG.txt -O /etc/pki/rpm-gpg/RPM-GPG-KEY-VESTA
  211. # Checking if old MySQL stuff exists
  212. if [ -e '/var/lib/mysql' ]; then
  213. mv -f /var/lib/mysql /var/lib/mysql_old
  214. fi
  215. if [ -e '/etc/my.cnf' ]; then
  216. mv -f /etc/my.cnf /etc/my.cnf_old
  217. fi
  218. if [ -e '/root/.my.cnf' ]; then
  219. mv -f /root/.my.cnf
  220. fi
  221. # Vesta packages
  222. yum -y --enablerepo=remi install $rpms
  223. if [ $? -ne 0 ]; then
  224. echo 'Error: yum install failed'
  225. exit 1
  226. fi
  227. # Configuring run levels
  228. chkconfig iptables off
  229. if [ -e /etc/init.d/sendmail ]; then
  230. chkconfig sendmail off
  231. fi
  232. if [ -e /etc/init.d/postfix ]; then
  233. chkconfig postfix off
  234. fi
  235. chkconfig vesta on
  236. chkconfig httpd on
  237. chkconfig nginx on
  238. chkconfig mysqld on
  239. chkconfig vsftpd on
  240. chkconfig named on
  241. chkconfig exim on
  242. chkconfig clamd on
  243. chkconfig spamassassin on
  244. chkconfig dovecot on
  245. # Make dirs more visible
  246. echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
  247. # Vesta does not support SELINUX for now
  248. if [ -e '/etc/sysconfig/selinux' ]; then
  249. sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
  250. setenforce 0
  251. fi
  252. if [ -e '/etc/selinux/config' ]; then
  253. sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
  254. setenforce 0
  255. fi
  256. # Vesta use own webalizer routine
  257. rm -f /etc/cron.daily/00webalizer
  258. # NTP Synchronization
  259. echo '#!/bin/sh' > /etc/cron.daily/ntpdate
  260. echo '/sbin/ntpdate -s pool.ntp.org' >> /etc/cron.daily/ntpdate
  261. chmod 775 /etc/cron.daily/ntpdate
  262. /sbin/ntpdate -s pool.ntp.org
  263. # Vesta Environment
  264. echo "export VESTA='/usr/local/vesta'" > /etc/profile.d/vesta.sh
  265. chmod 755 /etc/profile.d/vesta.sh
  266. source /etc/profile.d/vesta.sh
  267. echo 'PATH=$PATH:/usr/local/vesta/bin' >> /root/.bash_profile
  268. echo 'export PATH' >> /root/.bash_profile
  269. source /root/.bash_profile
  270. mkdir -p $VESTA/conf
  271. mkdir -p $VESTA/log
  272. mkdir -p $VESTA/data
  273. mkdir -p $VESTA/ssl
  274. chmod 770 $VESTA/conf
  275. # Make backup directory
  276. vst_backups="/root/vst_install_backups/$(date +%s)"
  277. mkdir -p $vst_backups
  278. mkdir -p $vst_backups/nginx
  279. mkdir -p $vst_backups/httpd
  280. mkdir -p $vst_backups/mysql
  281. mkdir -p $vst_backups/exim
  282. mkdir -p $vst_backups/dovecot
  283. mkdir -p $vst_backups/clamd
  284. mkdir -p $vst_backups/vsftpd
  285. mkdir -p $vst_backups/named
  286. wget $RHOST/$REPO/vesta.conf -O $VESTA/conf/vesta.conf
  287. if [ -e '/etc/sudoers' ]; then
  288. mv /etc/sudoers $vst_backups/
  289. fi
  290. wget $CHOST/$VERSION/sudoers.conf -O /etc/sudoers
  291. chmod 0440 /etc/sudoers
  292. wget $CHOST/$VERSION/vesta.log -O /etc/logrotate.d/vesta
  293. sed -i "s/umask 022/umask 002/g" /etc/profile
  294. # Create backup directory
  295. adduser backup
  296. ln -s /home/backup /backup
  297. chmod a+x /backup
  298. # Configuring data templates
  299. cd /usr/local/vesta/data
  300. mkdir ips
  301. mkdir queue
  302. mkdir users
  303. touch queue/backup.pipe
  304. touch queue/disk.pipe
  305. touch queue/webstats.pipe
  306. touch queue/restart.pipe
  307. touch queue/traffic.pipe
  308. chmod 750 users
  309. chmod 750 ips
  310. chmod -R 750 queue
  311. wget $CHOST/$VERSION/packages.tar.gz -O packages.tar.gz
  312. tar -xzf packages.tar.gz
  313. rm -f packages.tar.gz
  314. cd /usr/local/vesta/data
  315. wget $CHOST/$VERSION/templates.tar.gz -O templates.tar.gz
  316. tar -xzf templates.tar.gz
  317. rm -f templates.tar.gz
  318. chmod -R 755 /usr/local/vesta/data/templates
  319. cp templates/web/skel/public_html/index.html /var/www/html/
  320. sed -i 's/%domain%/It worked!/g' /var/www/html/index.html
  321. # Configuring ssl keys
  322. cd /usr/local/vesta/ssl
  323. wget $CHOST/$VERSION/certificate.crt -O certificate.crt
  324. wget $CHOST/$VERSION/certificate.key -O certificate.key
  325. # Adding admin user
  326. vpass=$(gen_pass)
  327. $VESTA/bin/v-add-user admin $vpass $email default System Administrator
  328. if [ $? -ne 0 ]; then
  329. echo "Error: can't create admin user"
  330. exit 1
  331. fi
  332. # Set shell
  333. $VESTA/bin/v-change-user-shell admin bash
  334. # Apache
  335. if [ -e '/etc/httpd/conf/httpd.conf' ]; then
  336. mv /etc/httpd/conf/httpd.conf $vst_backups/httpd/
  337. fi
  338. if [ -e '/etc/httpd/conf.d/ssl.conf' ]; then
  339. mv /etc/httpd/conf.d/ssl.conf $vst_backups/httpd/
  340. fi
  341. if [ -e '/etc/httpd/conf.d/proxy_ajp.conf' ]; then
  342. mv /etc/httpd/conf.d/proxy_ajp.conf $vst_backups/httpd/
  343. fi
  344. wget $CHOST/$VERSION/httpd.conf -O /etc/httpd/conf/httpd.conf
  345. wget $CHOST/$VERSION/httpd-status.conf -O /etc/httpd/conf.d/status.conf
  346. wget $CHOST/$VERSION/httpd-ssl.conf -O /etc/httpd/conf.d/ssl.conf
  347. wget $CHOST/$VERSION/httpd.log -O /etc/logrotate.d/httpd
  348. echo "MEFaccept 127.0.0.1" >> /etc/httpd/conf.d/mod_extract_forwarded.conf
  349. echo > /etc/httpd/conf.d/proxy_ajp.conf
  350. echo > /etc/httpd/conf.d/vesta.conf
  351. touch /var/log/httpd/access_log
  352. touch /var/log/httpd/error_log
  353. touch /var/log/httpd/suexec.log
  354. mkdir -p /var/log/httpd/domains
  355. chmod a+x /var/log/httpd
  356. chmod 640 /var/log/httpd/access_log
  357. chmod 640 /var/log/httpd/error_log
  358. chmod 640 /var/log/httpd/suexec.log
  359. chmod 751 /var/log/httpd/domains
  360. # Nginx
  361. if [ -e '/etc/nginx/nginx.conf' ]; then
  362. mv /etc/nginx/nginx.conf $vst_backups/nginx/
  363. fi
  364. if [ -f '/etc/nginx/conf.d/default.conf' ]; then
  365. mv /etc/nginx/conf.d/default.conf $vst_backups/nginx/
  366. fi
  367. if [ -e '/etc/nginx/conf.d/example_ssl.conf' ]; then
  368. mv /etc/nginx/conf.d/example_ssl.conf $vst_backups/nginx/
  369. fi
  370. wget $CHOST/$VERSION/nginx.conf -O /etc/nginx/nginx.conf
  371. wget $CHOST/$VERSION/nginx-status.conf -O /etc/nginx/conf.d/status.conf
  372. touch /etc/nginx/conf.d/vesta_ip.conf
  373. touch /etc/nginx/conf.d/vesta_users.conf
  374. # VsFTP
  375. if [ -e '/etc/vsftpd/vsftpd.conf' ]; then
  376. mv /etc/vsftpd/vsftpd.conf $vst_backups/vsftpd/
  377. fi
  378. wget $CHOST/$VERSION/vsftpd.conf -O /etc/vsftpd/vsftpd.conf
  379. # MySQL
  380. if [ -e '/etc/my.cnf' ]; then
  381. mv /etc/my.cnf $vst_backups/mysql/
  382. fi
  383. if [ -e '/root/.my.cnf' ]; then
  384. mv /root/.my.cnf $vst_backups/mysql/
  385. fi
  386. mpass=$(gen_pass)
  387. wget $CHOST/$VERSION/mysql.cnf -O /etc/my.cnf
  388. service mysqld start
  389. mysqladmin -u root password $mpass
  390. echo -e "[client]\npassword='$mpass'\n" >/root/.my.cnf
  391. $VESTA/bin/v-add-database-server mysql localhost 3306 root $mpass
  392. $VESTA/bin/v-add-database admin default default $(gen_pass) mysql
  393. # Bind
  394. if [ -e '/etc/named.conf' ]; then
  395. mv /etc/named.conf $vst_backups/named/
  396. fi
  397. wget $CHOST/$VERSION/named.conf -O /etc/named.conf
  398. chown root:named /etc/named.conf
  399. chmod 640 /etc/named.conf
  400. # Exim
  401. if [ -e '/etc/exim/exim.conf' ]; then
  402. mv /etc/exim/exim.conf $vst_backups/exim/
  403. fi
  404. if [ -e '/etc/clamd.conf' ]; then
  405. mv /etc/clamd.conf $vst_backups/clamd/
  406. fi
  407. wget $CHOST/$VERSION/exim.conf -O /etc/exim/exim.conf
  408. wget $CHOST/$VERSION/dnsbl.conf -O /etc/exim/dnsbl.conf
  409. wget $CHOST/$VERSION/spam-blocks.conf -O /etc/exim/spam-blocks.conf
  410. wget $CHOST/$VERSION/clamd.conf -O /etc/clamd.conf
  411. mkdir /etc/exim/domains
  412. chmod 640 /etc/exim/exim.conf
  413. gpasswd -a clam exim
  414. gpasswd -a exim mail
  415. gpasswd -a clam mail
  416. gpasswd -a dovecot mail
  417. /usr/bin/freshclam
  418. # Dovecot config
  419. if [ "$release" -eq '5' ]; then
  420. if -e [ '/etc/dovecot.conf' ]; then
  421. mv /etc/dovecot.conf $vst_backups/dovecot/
  422. fi
  423. wget $CHOST/$VERSION/dovecot.conf -O /etc/dovecot.conf
  424. else
  425. if [ -e '/etc/dovecot' ]; then
  426. mv /etc/dovecot/* $vst_backups/dovecot/
  427. fi
  428. wget $CHOST/$VERSION/dovecot.tar.gz -O /etc/dovecot.tar.gz
  429. cd /etc/
  430. tar -xzf dovecot.tar.gz
  431. rm -f dovecot.tar.gz
  432. fi
  433. # PMA
  434. wget $CHOST/$VERSION/httpd-pma.conf -O /etc/httpd/conf.d/phpMyAdmin.conf
  435. wget $CHOST/$VERSION/pma.conf -O /etc/phpMyAdmin/config.inc.php
  436. sed -i "s/%blowfish_secret%/$(gen_pass)/g" /etc/phpMyAdmin/config.inc.php
  437. # Roundcube setup
  438. wget $CHOST/$VERSION/httpd-webmail.conf -O /etc/httpd/conf.d/roundcubemail.conf
  439. wget $CHOST/$VERSION/roundcube-main.conf -O /etc/roundcubemail/main.inc.php
  440. wget $CHOST/$VERSION/roundcube-db.conf -O /etc/roundcubemail/db.inc.php
  441. r="$(gen_pass)"
  442. mysql -e "CREATE DATABASE roundcube"
  443. mysql -e "GRANT ALL ON roundcube.* TO roundcube@localhost IDENTIFIED BY '$r'"
  444. sed -i "s/%password%/$r/g" /etc/roundcubemail/db.inc.php
  445. mysql roundcube < /usr/share/doc/roundcubemail-*/SQL/mysql.initial.sql
  446. # Configuring ip
  447. $VESTA/bin/v-update-sys-ip
  448. # Get main ip
  449. main_ip=$(ifconfig |grep 'inet addr:' |grep -v 127.0.0.1 |head -n1 |\
  450. cut -f2 -d: | cut -f1 -d ' ')
  451. # Add default web domain on main ip
  452. $VESTA/bin/v-add-web-domain admin default.domain $main_ip
  453. # Add default dns domain on main ip
  454. $VESTA/bin/v-add-dns-domain admin default.domain $main_ip
  455. # Add default mail domain
  456. $VESTA/bin/v-add-mail-domain admin default.domain
  457. # Configuring crond
  458. command='sudo /usr/local/vesta/bin/v-update-sys-queue disk'
  459. $VESTA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
  460. command='sudo /usr/local/vesta/bin/v-update-sys-queue traffic'
  461. $VESTA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command"
  462. command='sudo /usr/local/vesta/bin/v-update-sys-queue webstats'
  463. $VESTA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command"
  464. command='sudo /usr/local/vesta/bin/v-update-sys-queue backup'
  465. $VESTA/bin/v-add-cron-job 'admin' '*/30' '*' '*' '*' '*' "$command"
  466. command='sudo /usr/local/vesta/bin/v-backup-users'
  467. $VESTA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command"
  468. command='sudo /usr/local/vesta/bin/v-update-user-stats'
  469. $VESTA/bin/v-add-cron-job 'admin' '20' '00' '01' '*' '*' "$command"
  470. command='sudo /usr/local/vesta/bin/v-update-sys-rrd'
  471. $VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
  472. # Creating symlink
  473. ln -s /usr/local/vesta/log /var/log/vesta
  474. # Stop unused services
  475. services='iptables sendmail postfix'
  476. for srv in $services; do
  477. service $srv status > /dev/null
  478. if [ $? -eq 0 ]; then
  479. service $srv stop
  480. fi
  481. done
  482. # Start system service
  483. services='vesta httpd nginx vsftpd exim dovecot clamd spamassassin named crond'
  484. for srv in $services; do
  485. service $srv status > /dev/null
  486. if [ $? -gt 0 ]; then
  487. service $srv start
  488. else
  489. service $srv restart
  490. fi
  491. done
  492. # Change sendmail client
  493. rm -f /etc/alternatives/mta
  494. ln -s /usr/sbin/sendmail.exim /etc/alternatives/mta
  495. # Build inititall rrd images
  496. $VESTA/bin/v-update-sys-rrd
  497. # Send notification to vestacp.com
  498. wget vestacp.com/notify/?$REPO -O /dev/null
  499. # Get server ip
  500. vst_ip=$(wget vestacp.com/what-is-my-ip/ -O - 2>/dev/null)
  501. if [ -z "$vst_ip" ]; then
  502. vst_ip=$main_ip
  503. fi
  504. # Send email
  505. echo -e "Congratulations, you have just successfully installed \
  506. the Vesta Control Panel
  507. You can login in Vesta with following credentials:
  508. username: admin
  509. password: $vpass
  510. https://$vst_ip:8083
  511. We hope that you enjoy your installation of Vesta. Please \
  512. feel free to contact us anytime if you have any questions.
  513. Thank you.
  514. --
  515. Sincerely yours
  516. vestacp.com team
  517. " > $tmpfile
  518. cat $tmpfile | mail -s "Vesta Control Panel" $email
  519. rm -f $tmpfile
  520. # Congrats
  521. echo
  522. echo
  523. echo ' ***********************************************************'
  524. echo
  525. echo ' _| _| _|_|_|_| _|_|_| _|_|_|_|_| _|_| '
  526. echo ' _| _| _| _| _| _| _| '
  527. echo ' _| _| _|_|_| _|_| _| _|_|_|_| '
  528. echo ' _| _| _| _| _| _| _| '
  529. echo ' _| _|_|_|_| _|_|_| _| _| _| '
  530. echo
  531. echo ' Congratulations, you have just successfully installed'
  532. echo ' the Vesta Control Panel!'
  533. echo
  534. echo ' Now you can login in Vesta with following credentials:'
  535. echo ' username: admin'
  536. echo " password: $vpass"
  537. echo " https://$vst_ip:8083/"
  538. echo
  539. echo
  540. echo ' Thank you for using our product.'
  541. echo
  542. echo ' ***********************************************************'
  543. echo
  544. echo
  545. # Tricky way to get new PATH variable
  546. cd
  547. bash
  548. # EOF