This commit is contained in:
rperper
2018-10-26 14:24:28 -04:00
parent 0b62563aef
commit c2b09182c2
5 changed files with 171 additions and 128 deletions

View File

@@ -1,31 +0,0 @@
#!/bin/bash
#yum autoremove epel-release -y
#rm -f /etc/yum.repos.d/epel.repo
#rm -f /etc/yum.repos.d/epel.repo.rpmsave
#yum install epel-release -y
#some provider's centos7 template come with incorrect or misconfigured epel.repo
#if systemctl is-active named | grep -q 'active'; then
# systemctl stop named
# systemctl disable named
# echo "Disabling named to aviod powerdns conflicts..."
# else
# echo "named is not installed or active, to next step..."
#fi
# above if will check if server has named.service running that occupies port 53 which makes powerdns failed to start
apt-get clean all
apt-get update -y
apt-get install curl -y
#setenforce 0
#sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
#wget https://cyberpanel.net/install.tar.gz
#tar xzvf install.tar.gz
apt-get install python -y
apt-get install git -y
if [ ! -d cyberpanel ]; then
git clone https://github.com/rperper/cyberpanel.git
fi
cd cyberpanel
cd install
chmod +x install.py
server_ip="$(wget -qO- http://whatismyip.akamai.com/)"
python install.py $server_ip

View File

@@ -1,11 +1,43 @@
#!/bin/bash
if [ -a /etc/lsb-release ]; then
if [ ! -x ./install-ubuntu.sh ]; then
echo "Download install-ubuntu.sh and make it executable"
exit 1
install-ubuntu()
{
#!/bin/bash
#yum autoremove epel-release -y
#rm -f /etc/yum.repos.d/epel.repo
#rm -f /etc/yum.repos.d/epel.repo.rpmsave
#yum install epel-release -y
#some provider's centos7 template come with incorrect or misconfigured epel.repo
#if systemctl is-active named | grep -q 'active'; then
# systemctl stop named
# systemctl disable named
# echo "Disabling named to aviod powerdns conflicts..."
# else
# echo "named is not installed or active, to next step..."
#fi
# above if will check if server has named.service running that occupies port 53 which makes powerdns failed to start
apt-get clean all
apt-get update -y
apt-get install curl -y
#setenforce 0
#sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
#wget https://cyberpanel.net/install.tar.gz
#tar xzvf install.tar.gz
apt-get install python -y
apt-get install git -y
if [ ! -d cyberpanel ]; then
git clone https://github.com/rperper/cyberpanel.git
fi
echo "Running Ubuntu install"
./install-ubuntu.sh
cd cyberpanel
cd install
chmod +x install.py
server_ip="$(wget -qO- http://whatismyip.akamai.com/)"
python install.py $server_ip
exit $?
}
if [ -a /etc/lsb-release ]; then
install-ubuntu
exit $?
fi
yum autoremove epel-release -y

View File

@@ -16,14 +16,13 @@ from stat import *
# There can not be peace without first a great suffering.
#self.distros
#distros
centos=0
ubuntu=1
class preFlightsChecks:
cyberPanelMirror = "mirror.cyberpanel.net/pip"
def __init__(self,rootPath,ip,path,cwd,cyberPanelPath,distro):
@@ -3102,7 +3101,6 @@ milter_default_action = accept
return 0
def get_distro():
distro = -1
distro_file = ""
@@ -3195,7 +3193,7 @@ def main():
import installCyberPanel
installCyberPanel.Main(cwd, mysql)
installCyberPanel.Main(cwd, mysql, distro)
checks.fix_selinux_issue()
checks.install_psmisc()
checks.install_postfix_davecot()

View File

@@ -3,21 +3,27 @@ import subprocess
import os
import pexpect
from mysqlUtilities import mysqlUtilities
from install import preflightsChecks
import installLog as logging
import shlex
import randomPassword
import time
import sys
#distros
centos=0
ubuntu=1
class InstallCyberPanel:
mysql_Root_password = ""
mysqlPassword = ""
def __init__(self,rootPath,cwd):
def __init__(self,rootPath,cwd,distro):
self.server_root_path = rootPath
self.cwd = cwd
self.distro=distro
@staticmethod
def stdOut(message):
@@ -34,7 +40,10 @@ class InstallCyberPanel:
count = 0
while (1):
command = 'yum install -y openlitespeed'
if self.distro == ubuntu:
command = "apt-get -y openlitespeed"
else:
command = 'yum install -y openlitespeed'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -224,7 +233,10 @@ class InstallCyberPanel:
while (1):
command = 'yum -y groupinstall lsphp-all'
if self.distro == ubuntu:
command = 'apt-get -y install lsphp*'
else:
command = 'yum -y groupinstall lsphp-all'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -240,42 +252,43 @@ class InstallCyberPanel:
InstallCyberPanel.stdOut("LiteSpeed PHPs successfully installed!")
## only php 71
count = 0
while(1):
command = 'yum install lsphp71 lsphp71-json lsphp71-xmlrpc lsphp71-xml lsphp71-tidy lsphp71-soap lsphp71-snmp lsphp71-recode lsphp71-pspell lsphp71-process lsphp71-pgsql lsphp71-pear lsphp71-pdo lsphp71-opcache lsphp71-odbc lsphp71-mysqlnd lsphp71-mcrypt lsphp71-mbstring lsphp71-ldap lsphp71-intl lsphp71-imap lsphp71-gmp lsphp71-gd lsphp71-enchant lsphp71-dba lsphp71-common lsphp71-bcmath -y'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
count = count + 1
InstallCyberPanel.stdOut("Trying to install LiteSpeed PHP 7.1, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Failed to install LiteSpeed PHP 7.1, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHP 7.1 successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHP 7.1 successfully installed!")
break
if self.distro == centos:
count = 0
while(1):
command = 'yum install lsphp71 lsphp71-json lsphp71-xmlrpc lsphp71-xml lsphp71-tidy lsphp71-soap lsphp71-snmp lsphp71-recode lsphp71-pspell lsphp71-process lsphp71-pgsql lsphp71-pear lsphp71-pdo lsphp71-opcache lsphp71-odbc lsphp71-mysqlnd lsphp71-mcrypt lsphp71-mbstring lsphp71-ldap lsphp71-intl lsphp71-imap lsphp71-gmp lsphp71-gd lsphp71-enchant lsphp71-dba lsphp71-common lsphp71-bcmath -y'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
count = count + 1
InstallCyberPanel.stdOut("Trying to install LiteSpeed PHP 7.1, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Failed to install LiteSpeed PHP 7.1, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHP 7.1 successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHP 7.1 successfully installed!")
break
## only php 72
count = 0
while (1):
command = 'yum install -y lsphp72 lsphp72-json lsphp72-xmlrpc lsphp72-xml lsphp72-tidy lsphp72-soap lsphp72-snmp lsphp72-recode lsphp72-pspell lsphp72-process lsphp72-pgsql lsphp72-pear lsphp72-pdo lsphp72-opcache lsphp72-odbc lsphp72-mysqlnd lsphp72-mcrypt lsphp72-mbstring lsphp72-ldap lsphp72-intl lsphp72-imap lsphp72-gmp lsphp72-gd lsphp72-enchant lsphp72-dba lsphp72-common lsphp72-bcmath'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
count = count + 1
InstallCyberPanel.stdOut(
"Trying to install LiteSpeed PHP 7.1, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile(
"Failed to install LiteSpeed PHP 7.1, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHP 7.1 successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHP 7.1 successfully installed!")
break
## only php 72
count = 0
while (1):
command = 'yum install -y lsphp72 lsphp72-json lsphp72-xmlrpc lsphp72-xml lsphp72-tidy lsphp72-soap lsphp72-snmp lsphp72-recode lsphp72-pspell lsphp72-process lsphp72-pgsql lsphp72-pear lsphp72-pdo lsphp72-opcache lsphp72-odbc lsphp72-mysqlnd lsphp72-mcrypt lsphp72-mbstring lsphp72-ldap lsphp72-intl lsphp72-imap lsphp72-gmp lsphp72-gd lsphp72-enchant lsphp72-dba lsphp72-common lsphp72-bcmath'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
count = count + 1
InstallCyberPanel.stdOut(
"Trying to install LiteSpeed PHP 7.1, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile(
"Failed to install LiteSpeed PHP 7.1, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHP 7.1 successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHP 7.1 successfully installed!")
break
## break for outer loop
@@ -292,8 +305,14 @@ class InstallCyberPanel:
def setup_mariadb_repo(self):
try:
if self.distro == ubuntu:
# Only needed if the repo is broken or we need the latest version.
#command = "apt-get -y install software-properties-common"
#command = "apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8"
#command = "add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu bionic main'"
return
try:
logging.InstallLog.writeToFile("Setting up MariaDB Repo..")
InstallCyberPanel.stdOut("Setting up MariaDB Repo..")
@@ -318,8 +337,10 @@ class InstallCyberPanel:
count = 0
while (1):
command = 'yum -y install mariadb-server'
if self.distro == ubuntu:
command = "apt-get -y install mariadb-server"
else:
command = 'yum -y install mariadb-server'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -453,7 +474,8 @@ class InstallCyberPanel:
count = count + 1
InstallCyberPanel.stdOut("Trying to enable MariaDB instance to start and system restart, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Failed to enable MariaDB instance to run at system restart, you can do this later using systemctl enable mysql! [installMySQL]")
logging.InstallLog.writeToFile("Failed to enable MariaDB instance to run at system restart, "
"you can do this later using systemctl enable mysql! [installMySQL]")
break
else:
logging.InstallLog.writeToFile("MariaDB instance successfully enabled at system restart!")
@@ -599,7 +621,10 @@ class InstallCyberPanel:
count = 0
while (1):
command = "yum install -y pure-ftpd"
if self.distro == ubuntu:
command = 'apt-get -y install pure-ftpd'
else:
command = "yum install -y pure-ftpd"
res = subprocess.call(shlex.split(command))
if res == 1:
@@ -729,7 +754,8 @@ class InstallCyberPanel:
count = count + 1
InstallCyberPanel.stdOut("Trying to start PureFTPD instance, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Failed to start PureFTPD instance, you can do this manually later using systemctl start pure-ftpd [startPureFTPD]")
logging.InstallLog.writeToFile("Failed to start PureFTPD instance, you can do this manually "
"later using systemctl start pure-ftpd [startPureFTPD]")
break
else:
logging.InstallLog.writeToFile("PureFTPD instance successfully started!")
@@ -762,7 +788,9 @@ class InstallCyberPanel:
count = 0
while(1):
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem'
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj ' \
'"/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" ' \
'-keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem'
res = subprocess.call(shlex.split(command))
if res == 1:
@@ -822,49 +850,54 @@ class InstallCyberPanel:
count = 0
while (1):
command = 'yum -y install epel-release yum-plugin-priorities'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if self.distro == centos:
while (1):
command = 'yum -y install epel-release yum-plugin-priorities'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
count = count + 1
InstallCyberPanel.stdOut("Trying to install PowerDNS Repositories, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Failed to install PowerDNS Repositories, exiting installer! [installPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("PowerDNS Repositories successfully installed!")
InstallCyberPanel.stdOut("PowerDNS Repositories successfully installed!")
break
if res == 1:
count = count + 1
InstallCyberPanel.stdOut("Trying to install PowerDNS Repositories, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Failed to install PowerDNS Repositories, exiting installer! [installPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("PowerDNS Repositories successfully installed!")
InstallCyberPanel.stdOut("PowerDNS Repositories successfully installed!")
break
count = 0
count = 0
while(1):
while(1):
command = 'curl -o /etc/yum.repos.d/powerdns-auth-master.repo https://repo.powerdns.com/repo-files/centos-auth-master.repo'
cmd = shlex.split(command)
res = subprocess.call(cmd)
command = 'curl -o /etc/yum.repos.d/powerdns-auth-master.repo ' \
'https://repo.powerdns.com/repo-files/centos-auth-master.repo'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
count = count + 1
InstallCyberPanel.stdOut(
"Trying to install PowerDNS Repositories, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile(
"Failed to install PowerDNS Repositories, exiting installer! [installPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("PowerDNS Repositories successfully installed!")
InstallCyberPanel.stdOut("PowerDNS Repositories successfully installed!")
break
if res == 1:
count = count + 1
InstallCyberPanel.stdOut(
"Trying to install PowerDNS Repositories, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile(
"Failed to install PowerDNS Repositories, exiting installer! [installPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("PowerDNS Repositories successfully installed!")
InstallCyberPanel.stdOut("PowerDNS Repositories successfully installed!")
break
count = 1
while(1):
command = 'yum -y install pdns pdns-backend-mysql'
if self.distro == ubuntu:
command = "apt-get -y install pdns-backend-mysql"
else:
command = 'yum -y install pdns pdns-backend-mysql'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -956,7 +989,9 @@ class InstallCyberPanel:
count = count + 1
InstallCyberPanel.stdOut("Trying to enable PowerDNS to start and system restart, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Failed to enable PowerDNS to run at system restart, you can manually do this later using systemctl enable pdns! [startPowerDNS]")
logging.InstallLog.writeToFile("Failed to enable PowerDNS to run at system restart, you can "
"manually do this later using systemctl enable pdns! "
"[startPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
break
else:
@@ -1004,7 +1039,10 @@ class InstallCyberPanel:
count = 0
while(1):
command = 'yum -y install gcc gcc-c++ make autoconf glibc rcs'
if self.distro == ubuntu:
command = "apt-get -y install gcc g++ make autoconf rcs"
else:
command = 'yum -y install gcc gcc-c++ make autoconf glibc rcs'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -1023,7 +1061,12 @@ class InstallCyberPanel:
count = 0
while(1):
command = 'yum -y install pcre-devel openssl-devel expat-devel geoip-devel zlib-devel udns-devel which curl'
if self.distro == ubuntu:
command = "apt-get -y install libpcre3 libpcre3-dev openssl libexpat1 libexpat1-dev libgeoip-dev" \
" zlib1g zlib1g-dev libudns-dev whichman curl"
else:
command = 'yum -y install pcre-devel openssl-devel expat-devel geoip-devel zlib-devel udns-devel' \
' which curl'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -1062,7 +1105,9 @@ class InstallCyberPanel:
count = 0
while(1):
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /usr/local/lscp/key.pem -out /usr/local/lscp/cert.pem'
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj ' \
'"/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /usr/local/lscp/key.pem ' \
'-out /usr/local/lscp/cert.pem'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -1115,7 +1160,7 @@ class InstallCyberPanel:
def Main(cwd, mysql):
def Main(cwd, mysql, distro):
InstallCyberPanel.mysqlPassword = randomPassword.generate_pass()
InstallCyberPanel.mysql_Root_password = randomPassword.generate_pass()
@@ -1125,7 +1170,7 @@ def Main(cwd, mysql):
password.writelines(InstallCyberPanel.mysql_Root_password)
password.close()
installer = InstallCyberPanel("/usr/local/lsws/",cwd)
installer = InstallCyberPanel("/usr/local/lsws/",cwd,distro)
installer.installLiteSpeed()
installer.changePortTo80()
@@ -1133,7 +1178,6 @@ def Main(cwd, mysql):
installer.installAllPHPVersions()
installer.fix_ols_configs()
installer.setup_mariadb_repo()
installer.installMySQL(mysql)
installer.changeMYSQLRootPassword()
@@ -1142,7 +1186,6 @@ def Main(cwd, mysql):
mysqlUtilities.createDatabaseCyberPanel("cyberpanel","cyberpanel",InstallCyberPanel.mysqlPassword, mysql)
installer.installPureFTPD()
installer.installPureFTPDConfigurations(mysql)
installer.startPureFTPD()

View File

@@ -6,6 +6,7 @@ import argparse
import os
import shlex
import socket
from install import preFlightsChecks