Advertisement
Guest User

UNOfficial ZPanel Installation Script for Ubuntu 14.04

a guest
Jul 12th, 2014
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 20.85 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # ONLY FOR TEST! It's not suitable for production environment.
  4.  
  5. # OS VERSION: Ubuntu Server 14.04.x LTS
  6. # ARCH: x32_64
  7.  
  8. ZPX_VERSION=10.1.1
  9.  
  10. # UNOfficial ZPanel Automated Installation Script
  11. # =============================================
  12. #
  13. #    This program is free software: you can redistribute it and/or modify
  14. #    it under the terms of the GNU General Public License as published by
  15. #    the Free Software Foundation, either version 3 of the License, or
  16. #    (at your option) any later version.
  17. #
  18. #    This program is distributed in the hope that it will be useful,
  19. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. #    GNU General Public License for more details.
  22. #
  23. #    You should have received a copy of the GNU General Public License
  24. #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  25. #
  26.  
  27. # First we check if the user is 'root' before allowing installation to commence
  28. if [ $UID -ne 0 ]; then
  29.     echo "Install failed! To install you must be logged in as 'root', please try again."
  30.     exit 1
  31. fi
  32.  
  33. # Lets check for some common control panels that we know will affect the installation/operating of ZPanel.
  34. if [ -e /usr/local/cpanel ] || [ -e /usr/local/directadmin ] || [ -e /usr/local/solusvm/www ] || [ -e /usr/local/home/admispconfig ] || [ -e /usr/local/lxlabs/kloxo ] ; then
  35.     echo "You appear to have a control panel already installed on your server; This installer"
  36.     echo "is designed to install and configure ZPanel on a clean OS installation only!"
  37.     echo ""
  38.     echo "Please re-install your OS before attempting to install using this script."
  39.     exit
  40. fi
  41.  
  42. # Lets check for some common packages that we know will affect the installation/operating of ZPanel.
  43. # We expect a clean OS so no apache/mySQL/bind/postfix/php!
  44. if dpkg -s php apache mysql bind postfix dovecot; then
  45.     echo "You appear to have a server with apache/mysql/bind/postfix already installed; "
  46.     echo "This installer is designed to install and configure ZPanel on a clean OS "
  47.     echo "installation only!"
  48.     echo ""
  49.     echo "Please re-install your OS before attempting to install using this script."
  50.     exit
  51. fi
  52.  
  53. # Ensure the installer is launched and can only be launched on Ubuntu 14.04
  54. BITS=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')
  55. if [ -f /etc/lsb-release ]; then
  56.   OS=$(cat /etc/lsb-release | grep DISTRIB_ID | sed 's/^.*=//')
  57.   VER=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | sed 's/^.*=//')
  58. else
  59.   OS=$(uname -s)
  60.   VER=$(uname -r)
  61. fi
  62. echo "Detected : $OS  $VER  $BITS"
  63. if [ "$OS" = "Ubuntu" ] && [ "$VER" = "14.04" ]; then
  64.   echo "Ok."
  65. else
  66.   echo "Sorry, this installer only supports the installation of ZPanel on Ubuntu 14.04."
  67.   exit 1;
  68. fi
  69.  
  70. # Set custom logging methods so we create a log file in the current working directory.
  71. logfile=$$.log
  72. touch $$.log
  73. exec > >(tee $logfile)
  74. exec 2>&1
  75.  
  76. # ***************************************
  77. # * Common installer functions          *
  78. # ***************************************
  79.  
  80. # Generates random passwords for the 'zadmin' account as well as Postfix and MySQL root account.
  81. passwordgen() {
  82.          l=$1
  83.            [ "$l" == "" ] && l=16
  84.           tr -dc A-Za-z0-9 < /dev/urandom | head -c ${l} | xargs
  85. }
  86.  
  87. # Display the 'welcome' splash/user warning info..
  88. echo -e ""
  89. echo -e "##############################################################"
  90. echo -e "# Welcome to the UNOfficial ZPanelX Installer for Ubuntu       #"
  91. echo -e "# Server 14.04.x LTS                                         #"
  92. echo -e "#                                                            #"
  93. echo -e "# Please make sure your VPS provider hasn't pre-installed    #"
  94. echo -e "# any packages required by ZPanelX.                          #"
  95. echo -e "#                                                            #"
  96. echo -e "# If you are installing on a physical machine where the OS   #"
  97. echo -e "# has been installed by yourself please make sure you only   #"
  98. echo -e "# installed Ubuntu Server with no extra packages.            #"
  99. echo -e "#                                                            #"
  100. echo -e "# If you selected additional options during the Ubuntu       #"
  101. echo -e "# install please consider reinstalling without them.         #"
  102. echo -e "#                                                            #"
  103. echo -e "##############################################################"
  104. echo -e ""
  105.  
  106. # Set some installation defaults/auto assignments
  107. fqdn=`/bin/hostname`
  108. publicip=`wget -qO- http://api.zpanelcp.com/ip.txt`
  109.  
  110. # Lets check that the user wants to continue first as obviously otherwise we'll be removing AppArmor for no reason.
  111. while true; do
  112. read -e -p "Would you like to continue (y/n)? " yn
  113.     case $yn in
  114.         [Yy]* ) break;;
  115.         [Nn]* ) exit;
  116.     esac
  117. done
  118.  
  119. # We need to disable and remove AppArmor...
  120. [ -f /etc/init.d/apparmor ]
  121. if [ $? = "0" ]; then
  122.     echo -e ""
  123.     echo -e "Disabling and removing AppArmor, please wait..."
  124.     /etc/init.d/apparmor stop &> /dev/null
  125.     update-rc.d -f apparmor remove &> /dev/null
  126.     apt-get -y remove apparmor &> /dev/null
  127.     mv /etc/init.d/apparmor /etc/init.d/apparmpr.removed &> /dev/null
  128.     ##after removing AppArmor reboot is not obligatory
  129.     echo -e "Please restart the server and run the installer again. AppArmor has been removed."
  130.         #exit
  131. fi
  132.  
  133. #a selection list for the time zone is not better now?
  134. apt-get -yqq update &>/dev/null
  135. apt-get -yqq install tzdata &>/dev/null
  136.  
  137. # Installer options
  138. while true; do
  139.     #echo -e "Find your timezone from : http://php.net/manual/en/timezones.php e.g Europe/London"
  140.     #read -e -p "Enter your timezone: " -i "Europe/London" tz
  141.     dpkg-reconfigure tzdata
  142.     tz=`cat /etc/timezone`
  143.     echo -e "Enter the FQDN you will use to access ZPanel on your server."
  144.     echo -e "- It MUST be a sub-domain of you main domain, it MUST NOT be your main domain only. Example: panel.yourdomain.com"
  145.     echo -e "- Remember that the sub-domain ('panel' in the example) MUST be setup in your DNS nameserver."
  146.     read -e -p "FQDN for zpanel: " -i $fqdn fqdn
  147.     read -e -p "Enter the public (external) server IP: " -i $publicip publicip
  148.     read -e -p "ZPanel is now ready to install, do you wish to continue (y/n)" yn
  149.     case $yn in
  150.         [Yy]* ) break;;
  151.         [Nn]* ) exit;
  152.     esac
  153. done
  154.  
  155. # Start log creation.
  156. echo -e ""
  157. echo -e "# Generating installation log and debug info..."
  158. uname -a
  159. echo -e ""
  160. dpkg --get-selections
  161.  
  162. # We need to update the enabled Aptitude repositories
  163. echo -ne "\nUpdating Aptitude Repos: " >/dev/tty
  164.  
  165. mkdir -p "/etc/apt/sources.list.d.save"
  166.  cp -R "/etc/apt/sources.list.d/*" "/etc/apt/sources.list.d.save" &> /dev/null
  167.  rm -rf "/etc/apt/sources.list/*"
  168.  cp "/etc/apt/sources.list" "/etc/apt/sources.list.save"
  169.  
  170. cat > /etc/apt/sources.list <<EOF
  171. # Repo main restricted
  172. deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) main restricted
  173. deb http://security.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted
  174. deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc)-updates main restricted
  175.  
  176. deb-src http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) main restricted
  177. deb-src http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc)-updates main restricted
  178. deb-src http://security.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted
  179.  
  180. # Repo Universe Multiverse
  181. deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) universe multiverse
  182. deb http://security.ubuntu.com/ubuntu $(lsb_release -sc)-security universe multiverse
  183. deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc)-updates universe multiverse
  184.  
  185. deb-src http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) universe multiverse
  186. deb-src http://security.ubuntu.com/ubuntu $(lsb_release -sc)-security universe multiverse
  187. deb-src http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc)-updates universe multiverse
  188. EOF
  189.  
  190. apt-get update
  191.  
  192.  
  193. # Install some standard utility packages required by the installer and/or ZPX.
  194. apt-get -y install sudo wget vim make zip unzip git debconf-utils at
  195.  
  196. # We now clone the ZPX software from GitHub
  197. echo "Downloading ZPanel, Please wait, this may take several minutes, the installer will continue after this is complete!"
  198. git clone https://github.com/zpanel/zpanelx.git
  199. cd zpanelx/
  200. git checkout $ZPX_VERSION
  201. mkdir ../zp_install_cache/
  202. git checkout-index -a -f --prefix=../zp_install_cache/
  203. cd ../zp_install_cache/
  204.  
  205. # We now update the server software packages.
  206. apt-get update -yqq
  207. apt-get upgrade -yqq
  208.  
  209. # Install required software and dependencies required by ZPanel.
  210. # We disable the DPKG prompts before we run the software install to enable fully automated install.
  211. export DEBIAN_FRONTEND=noninteractive
  212. apt-get install -qqy mysql-server mysql-server apache2 libapache2-mod-php5 libapache2-mod-bw php5-common php5-cli php5-mysql php5-gd php5-mcrypt php5-curl php-pear php5-imap php5-xmlrpc php5-xsl db5.1-util zip webalizer build-essential bash-completion dovecot-mysql dovecot-imapd dovecot-pop3d dovecot-core dovecot-managesieved dovecot-lmtpd postfix postfix-mysql libsasl2-modules-sql libsasl2-modules proftpd-mod-mysql bind9 bind9utils
  213.  
  214. # Generation of random passwords
  215. password=`passwordgen`;
  216. postfixpassword=`passwordgen`;
  217. zadminNewPass=`passwordgen`;
  218.  
  219. # Set-up ZPanel directories and configure directory permissions as required.
  220. mkdir /etc/zpanel
  221. mkdir /etc/zpanel/configs
  222. mkdir /etc/zpanel/panel
  223. mkdir /etc/zpanel/docs
  224. mkdir /var/zpanel
  225. mkdir /var/zpanel/hostdata
  226. mkdir /var/zpanel/hostdata/zadmin
  227. mkdir /var/zpanel/hostdata/zadmin/public_html
  228. mkdir /var/zpanel/logs
  229. mkdir /var/zpanel/logs/proftpd
  230. mkdir /var/zpanel/backups
  231. mkdir /var/zpanel/temp
  232. cp -R . /etc/zpanel/panel/
  233. chmod -R 777 /etc/zpanel/
  234. chmod -R 777 /var/zpanel/
  235. chmod -R 770 /var/zpanel/hostdata/
  236. chown -R www-data:www-data /var/zpanel/hostdata/
  237. chmod 644 /etc/zpanel/panel/etc/apps/phpmyadmin/config.inc.php
  238. ln -s /etc/zpanel/panel/bin/zppy /usr/bin/zppy
  239. ln -s /etc/zpanel/panel/bin/setso /usr/bin/setso
  240. ln -s /etc/zpanel/panel/bin/setzadmin /usr/bin/setzadmin
  241. chmod +x /etc/zpanel/panel/bin/zppy
  242. chmod +x /etc/zpanel/panel/bin/setso
  243. cp -R /etc/zpanel/panel/etc/build/config_packs/ubuntu_12_04/. /etc/zpanel/configs/
  244. # set password after test connexion
  245. cc -o /etc/zpanel/panel/bin/zsudo /etc/zpanel/configs/bin/zsudo.c
  246. sudo chown root /etc/zpanel/panel/bin/zsudo
  247. chmod +s /etc/zpanel/panel/bin/zsudo
  248.  
  249. # MySQL specific installation tasks...
  250. service mysql start
  251. mysqladmin -u root password "$password"
  252. until mysql -u root -p$password -e ";" > /dev/null 2>&1 ; do
  253. read -s -p "enter your root mysql password : " password
  254. done
  255. sed -i "s|YOUR_ROOT_MYSQL_PASSWORD|$password|" /etc/zpanel/panel/cnf/db.php
  256. mysql -u root -p$password -e "DROP DATABASE test";
  257. mysql -u root -p$password -e "DELETE FROM mysql.user WHERE User='root' AND Host != 'localhost'";
  258. mysql -u root -p$password -e "DELETE FROM mysql.user WHERE User=''";
  259. mysql -u root -p$password -e "FLUSH PRIVILEGES";
  260. mysql -u root -p$password -e "CREATE SCHEMA zpanel_roundcube";
  261. cat /etc/zpanel/configs/zpanelx-install/sql/*.sql | mysql -u root -p$password
  262. mysql -u root -p$password -e "UPDATE mysql.user SET Password=PASSWORD('$postfixpassword') WHERE User='postfix' AND Host='localhost';";
  263. mysql -u root -p$password -e "FLUSH PRIVILEGES";
  264. sed -i "/ssl-key=/a \secure-file-priv = /var/tmp" /etc/mysql/my.cnf
  265.  
  266. # Set some ZPanel custom configuration settings (using. setso and setzadmin)
  267. setzadmin --set "$zadminNewPass";
  268. /etc/zpanel/panel/bin/setso --set zpanel_domain $fqdn
  269. /etc/zpanel/panel/bin/setso --set server_ip $publicip
  270. /etc/zpanel/panel/bin/setso --set apache_changed "true"
  271.  
  272. # We'll store the passwords so that users can review them later if required.
  273. touch /root/passwords.txt;
  274. echo "zadmin Password: $zadminNewPass" >> /root/passwords.txt;
  275. echo "MySQL Root Password: $password" >> /root/passwords.txt
  276. echo "MySQL Postfix Password: $postfixpassword" >> /root/passwords.txt
  277. echo "IP Address: $publicip" >> /root/passwords.txt
  278. echo "Panel Domain: $fqdn" >> /root/passwords.txt
  279.  
  280. # Postfix specific installation tasks...
  281. mkdir /var/zpanel/vmail
  282. chmod -R 770 /var/zpanel/vmail
  283. useradd -r -u 150 -g mail -d /var/zpanel/vmail -s /sbin/nologin -c "Virtual maildir" vmail
  284. chown -R vmail:mail /var/zpanel/vmail
  285. mkdir -p /var/spool/vacation
  286. useradd -r -d /var/spool/vacation -s /sbin/nologin -c "Virtual vacation" vacation
  287. chmod -R 770 /var/spool/vacation
  288. ln -s /etc/zpanel/configs/postfix/vacation.pl /var/spool/vacation/vacation.pl
  289. postmap /etc/postfix/transport
  290. chown -R vacation:vacation /var/spool/vacation
  291. if ! grep -q "127.0.0.1 autoreply.$fqdn" /etc/hosts; then echo "127.0.0.1 autoreply.$fqdn" >> /etc/hosts; fi
  292. sed -i "s|myhostname = control.yourdomain.com|myhostname = $fqdn|" /etc/zpanel/configs/postfix/main.cf
  293. sed -i "s|mydomain = control.yourdomain.com|mydomain   = $fqdn|" /etc/zpanel/configs/postfix/main.cf
  294. rm -rf /etc/postfix/main.cf /etc/postfix/master.cf
  295. ln -s /etc/zpanel/configs/postfix/master.cf /etc/postfix/master.cf
  296. ln -s /etc/zpanel/configs/postfix/main.cf /etc/postfix/main.cf
  297. sed -i "s|password \= postfix|password \= $postfixpassword|" /etc/zpanel/configs/postfix/mysql-relay_domains_maps.cf
  298. sed -i "s|password \= postfix|password \= $postfixpassword|" /etc/zpanel/configs/postfix/mysql-virtual_alias_maps.cf
  299. sed -i "s|password \= postfix|password \= $postfixpassword|" /etc/zpanel/configs/postfix/mysql-virtual_domains_maps.cf
  300. sed -i "s|password \= postfix|password \= $postfixpassword|" /etc/zpanel/configs/postfix/mysql-virtual_mailbox_limit_maps.cf
  301. sed -i "s|password \= postfix|password \= $postfixpassword|" /etc/zpanel/configs/postfix/mysql-virtual_mailbox_maps.cf
  302. sed -i "s|\$db_password \= 'postfix';|\$db_password \= '$postfixpassword';|" /etc/zpanel/configs/postfix/vacation.conf
  303.  
  304. # Dovecot specific installation tasks (includes Sieve)
  305. mkdir -p /var/zpanel/sieve
  306. chown -R vmail:mail /var/zpanel/sieve
  307. mkdir -p /var/lib/dovecot/sieve/
  308. touch /var/lib/dovecot/sieve/default.sieve
  309. ln -s /etc/zpanel/configs/dovecot2/globalfilter.sieve /var/zpanel/sieve/globalfilter.sieve
  310. rm -rf /etc/dovecot/dovecot.conf
  311. ln -s /etc/zpanel/configs/dovecot2/dovecot.conf /etc/dovecot/dovecot.conf
  312. sed -i "s|postmaster_address = postmaster@your-domain.tld|postmaster_address = postmaster@$fqdn|" /etc/dovecot/dovecot.conf
  313. sed -i "s|password=postfix|password=$postfixpassword|" /etc/zpanel/configs/dovecot2/dovecot-dict-quota.conf
  314. sed -i "s|password=postfix|password=$postfixpassword|" /etc/zpanel/configs/dovecot2/dovecot-mysql.conf
  315. touch /var/log/dovecot.log
  316. touch /var/log/dovecot-info.log
  317. touch /var/log/dovecot-debug.log
  318. chown vmail:mail /var/log/dovecot*
  319. chmod 660 /var/log/dovecot*
  320.  
  321. # ProFTPD specific installation tasks
  322. groupadd -g 2001 ftpgroup
  323. useradd -u 2001 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
  324. sed -i "s|#SQLConnectInfo  zpanel_proftpd@localhost root password_here|SQLConnectInfo   zpanel_proftpd@localhost root $password|" /etc/zpanel/configs/proftpd/proftpd-mysql.conf
  325. rm -rf /etc/proftpd/proftpd.conf
  326. touch /etc/proftpd/proftpd.conf
  327. if ! grep -q "include /etc/zpanel/configs/proftpd/proftpd-mysql.conf" /etc/proftpd/proftpd.conf; then echo "include /etc/zpanel/configs/proftpd/proftpd-mysql.conf" >> /etc/proftpd/proftpd.conf; fi
  328. chmod -R 644 /var/zpanel/logs/proftpd
  329. serverhost=`hostname`
  330.  
  331. # Apache HTTPD specific installation tasks...
  332. if ! grep -q "Include /etc/zpanel/configs/apache/httpd.conf" /etc/apache2/apache2.conf; then echo "Include /etc/zpanel/configs/apache/httpd.conf" >> /etc/apache2/apache2.conf; fi
  333. sed -i 's|DocumentRoot "/var/www/html"|DocumentRoot "/etc/zpanel/panel"|' /etc/apache2/apache2.conf
  334. sed -i 's|Include sites-enabled/||' /etc/apache2/apache2.conf
  335. chown -R www-data:www-data /var/zpanel/temp/
  336. if ! grep -q "127.0.0.1 "$fqdn /etc/hosts; then echo "127.0.0.1 "$fqdn >> /etc/hosts; fi
  337. if ! grep -q "apache ALL=NOPASSWD: /etc/zpanel/panel/bin/zsudo" /etc/sudoers; then echo "apache ALL=NOPASSWD: /etc/zpanel/panel/bin/zsudo" >> /etc/sudoers; fi
  338. a2enmod rewrite
  339. service apache2 restart
  340.  
  341. # PHP specific installation tasks...
  342. sed -i "s|;date.timezone =|date.timezone = $tz|" /etc/php5/cli/php.ini
  343. sed -i "s|;date.timezone =|date.timezone = $tz|" /etc/php5/apache2/php.ini
  344. sed -i "s|;upload_tmp_dir =|upload_tmp_dir = /var/zpanel/temp/|" /etc/php5/cli/php.ini
  345. sed -i "s|;upload_tmp_dir =|upload_tmp_dir = /var/zpanel/temp/|" /etc/php5/apache2/php.ini
  346. sed -i "s|expose_php = On|expose_php = Off|" /etc/php5/apache2/php.ini
  347.  
  348. # Permissions fix for Apache and ProFTPD (to enable them to play nicely together!)
  349. if ! grep -q "umask 002" /etc/apache2/envvars; then echo "umask 002" >> /etc/apache2/envvars; fi
  350. if ! grep -q "127.0.0.1 $serverhost" /etc/hosts; then echo "127.0.0.1 $serverhost" >> /etc/hosts; fi
  351. usermod -a -G www-data ftpuser
  352. usermod -a -G ftpgroup www-data
  353.  
  354. # BIND specific installation tasks...
  355. chmod -R 777 /etc/zpanel/configs/bind/zones/
  356. mkdir /var/zpanel/logs/bind
  357. mkdir -p /var/named/dynamic
  358. touch /var/named/dynamic/managed-keys.bind
  359. touch /var/zpanel/logs/bind/bind.log
  360. chown root:root /etc/bind/rndc.key
  361. chown -R bind:bind /var/named/
  362. chmod 755 /etc/bind/rndc.key
  363. chmod -R 777 /var/zpanel/logs/bind/bind.log
  364. chmod -R 777 /etc/zpanel/configs/bind/etc
  365. rm -rf /etc/bind/named.conf /etc/bind/rndc.conf /etc/bind/rndc.key
  366. rndc-confgen -a
  367. ln -s /etc/zpanel/configs/bind/named.conf /etc/bind/named.conf
  368. ln -s /etc/zpanel/configs/bind/rndc.conf /etc/bind/rndc.conf
  369. if ! grep -q "include \"/etc/zpanel/configs/bind/etc/log.conf\";" /etc/bind/named.conf; then echo "include \"/etc/zpanel/configs/bind/etc/log.conf\";" >> /etc/bind/named.conf; fi
  370. ln -s /usr/sbin/named-checkconf /usr/bin/named-checkconf
  371. ln -s /usr/sbin/named-checkzone /usr/bin/named-checkzone
  372. ln -s /usr/sbin/named-compilezone /usr/bin/named-compilezone
  373. cat /etc/bind/rndc.key | cat - /etc/bind/named.conf > /etc/bind/named.conf.new && mv /etc/bind/named.conf.new /etc/bind/named.conf
  374. cat /etc/bind/rndc.key | cat - /etc/bind/rndc.conf > /etc/bind/rndc.conf.new && mv /etc/bind/rndc.conf.new /etc/bind/rndc.conf
  375. rm -rf /etc/bind/rndc.key
  376.  
  377. # CRON specific installation tasks...
  378. mkdir -p /var/spool/cron/crontabs/
  379. mkdir -p /etc/cron.d/
  380. touch /var/spool/cron/crontabs/www-data
  381. touch /etc/cron.d/www-data
  382. crontab -u www-data /var/spool/cron/crontabs/www-data
  383. cp /etc/zpanel/configs/cron/zdaemon /etc/cron.d/zdaemon
  384. chmod -R 644 /var/spool/cron/crontabs/
  385. chmod 744 /var/spool/cron/crontabs
  386. chmod -R 644 /etc/cron.d/
  387. chown -R www-data:www-data /var/spool/cron/crontabs/
  388.  
  389. # Webalizer specific installation tasks...
  390. rm -rf /etc/webalizer/webalizer.conf
  391.  
  392. # Roundcube specific installation tasks...
  393. sed -i "s|YOUR_MYSQL_ROOT_PASSWORD|$password|" /etc/zpanel/configs/roundcube/db.inc.php
  394. sed -i "s|#||" /etc/zpanel/configs/roundcube/db.inc.php
  395. rm -rf /etc/zpanel/panel/etc/apps/webmail/config/main.inc.php
  396. ln -s /etc/zpanel/configs/roundcube/main.inc.php /etc/zpanel/panel/etc/apps/webmail/config/main.inc.php
  397. ln -s /etc/zpanel/configs/roundcube/config.inc.php /etc/zpanel/panel/etc/apps/webmail/plugins/managesieve/config.inc.php
  398. ln -s /etc/zpanel/configs/roundcube/db.inc.php /etc/zpanel/panel/etc/apps/webmail/config/db.inc.php
  399.  
  400. # Enable system services and start/restart them as required.
  401. service apache2 start
  402. service postfix restart
  403. service dovecot start
  404. service cron reload
  405. service mysql start
  406. service bind9 start
  407. service proftpd start
  408. service atd start
  409. php /etc/zpanel/panel/bin/daemon.php
  410.  
  411. # We'll now remove the temporary install cache.
  412. cd ../
  413. rm -rf zp_install_cache/ zpanelx/
  414.  
  415. # Advise the user that ZPanel is now installed and accessible.
  416. echo -e "##############################################################" &>/dev/tty
  417. echo -e "# Congratulations ZpanelX has now been installed on your     #" &>/dev/tty
  418. echo -e "# server. Please review the log file left in /root/ for      #" &>/dev/tty
  419. echo -e "# any errors encountered during installation.                #" &>/dev/tty
  420. echo -e "#                                                            #" &>/dev/tty
  421. echo -e "# Save the following information somewhere safe:             #" &>/dev/tty
  422. echo -e "# MySQL Root Password    : $password" &>/dev/tty
  423. echo -e "# MySQL Postfix Password : $postfixpassword" &>/dev/tty
  424. echo -e "# ZPanelX Username       : zadmin                            #" &>/dev/tty
  425. echo -e "# ZPanelX Password       : $zadminNewPass" &>/dev/tty
  426. echo -e "#                                                            #" &>/dev/tty
  427. echo -e "# ZPanelX Web login can be accessed using your server IP     #" &>/dev/tty
  428. echo -e "# inside your web browser.                                   #" &>/dev/tty
  429. echo -e "#                                                            #" &>/dev/tty
  430. echo -e "##############################################################" &>/dev/tty
  431. echo -e "" &>/dev/tty
  432.  
  433. # We now request that the user restarts their server...
  434. read -e -p "Restart your server now to complete the install (y/n)? " rsn
  435. while true; do
  436.     case $rsn in
  437.         [Yy]* ) break;;
  438.         [Nn]* ) exit;
  439.     esac
  440. done
  441.  
  442. shutdown -r now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement