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 #!/bin/bash
if [ -a /etc/lsb-release ]; then install-ubuntu()
if [ ! -x ./install-ubuntu.sh ]; then {
echo "Download install-ubuntu.sh and make it executable" #!/bin/bash
exit 1 #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 fi
echo "Running Ubuntu install" cd cyberpanel
./install-ubuntu.sh 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 $? exit $?
fi fi
yum autoremove epel-release -y yum autoremove epel-release -y

View File

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

View File

@@ -3,21 +3,27 @@ import subprocess
import os import os
import pexpect import pexpect
from mysqlUtilities import mysqlUtilities from mysqlUtilities import mysqlUtilities
from install import preflightsChecks
import installLog as logging import installLog as logging
import shlex import shlex
import randomPassword import randomPassword
import time import time
import sys import sys
#distros
centos=0
ubuntu=1
class InstallCyberPanel: class InstallCyberPanel:
mysql_Root_password = "" mysql_Root_password = ""
mysqlPassword = "" mysqlPassword = ""
def __init__(self,rootPath,cwd): def __init__(self,rootPath,cwd,distro):
self.server_root_path = rootPath self.server_root_path = rootPath
self.cwd = cwd self.cwd = cwd
self.distro=distro
@staticmethod @staticmethod
def stdOut(message): def stdOut(message):
@@ -34,6 +40,9 @@ class InstallCyberPanel:
count = 0 count = 0
while (1): while (1):
if self.distro == ubuntu:
command = "apt-get -y openlitespeed"
else:
command = 'yum install -y openlitespeed' command = 'yum install -y openlitespeed'
cmd = shlex.split(command) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -224,6 +233,9 @@ class InstallCyberPanel:
while (1): while (1):
if self.distro == ubuntu:
command = 'apt-get -y install lsphp*'
else:
command = 'yum -y groupinstall lsphp-all' command = 'yum -y groupinstall lsphp-all'
cmd = shlex.split(command) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -240,6 +252,7 @@ class InstallCyberPanel:
InstallCyberPanel.stdOut("LiteSpeed PHPs successfully installed!") InstallCyberPanel.stdOut("LiteSpeed PHPs successfully installed!")
## only php 71 ## only php 71
if self.distro == centos:
count = 0 count = 0
while(1): 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' 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'
@@ -292,8 +305,14 @@ class InstallCyberPanel:
def setup_mariadb_repo(self): 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..") logging.InstallLog.writeToFile("Setting up MariaDB Repo..")
InstallCyberPanel.stdOut("Setting up MariaDB Repo..") InstallCyberPanel.stdOut("Setting up MariaDB Repo..")
@@ -318,7 +337,9 @@ class InstallCyberPanel:
count = 0 count = 0
while (1): while (1):
if self.distro == ubuntu:
command = "apt-get -y install mariadb-server"
else:
command = 'yum -y install mariadb-server' command = 'yum -y install mariadb-server'
cmd = shlex.split(command) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -453,7 +474,8 @@ class InstallCyberPanel:
count = count + 1 count = count + 1
InstallCyberPanel.stdOut("Trying to enable MariaDB instance to start and system restart, trying again, try number: " + str(count)) InstallCyberPanel.stdOut("Trying to enable MariaDB instance to start and system restart, trying again, try number: " + str(count))
if count == 3: 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 break
else: else:
logging.InstallLog.writeToFile("MariaDB instance successfully enabled at system restart!") logging.InstallLog.writeToFile("MariaDB instance successfully enabled at system restart!")
@@ -599,6 +621,9 @@ class InstallCyberPanel:
count = 0 count = 0
while (1): while (1):
if self.distro == ubuntu:
command = 'apt-get -y install pure-ftpd'
else:
command = "yum install -y pure-ftpd" command = "yum install -y pure-ftpd"
res = subprocess.call(shlex.split(command)) res = subprocess.call(shlex.split(command))
@@ -729,7 +754,8 @@ class InstallCyberPanel:
count = count + 1 count = count + 1
InstallCyberPanel.stdOut("Trying to start PureFTPD instance, trying again, try number: " + str(count)) InstallCyberPanel.stdOut("Trying to start PureFTPD instance, trying again, try number: " + str(count))
if count == 3: 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 break
else: else:
logging.InstallLog.writeToFile("PureFTPD instance successfully started!") logging.InstallLog.writeToFile("PureFTPD instance successfully started!")
@@ -762,7 +788,9 @@ class InstallCyberPanel:
count = 0 count = 0
while(1): 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)) res = subprocess.call(shlex.split(command))
if res == 1: if res == 1:
@@ -822,6 +850,7 @@ class InstallCyberPanel:
count = 0 count = 0
if self.distro == centos:
while (1): while (1):
command = 'yum -y install epel-release yum-plugin-priorities' command = 'yum -y install epel-release yum-plugin-priorities'
cmd = shlex.split(command) cmd = shlex.split(command)
@@ -843,7 +872,8 @@ class InstallCyberPanel:
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' 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) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -864,6 +894,9 @@ class InstallCyberPanel:
count = 1 count = 1
while(1): while(1):
if self.distro == ubuntu:
command = "apt-get -y install pdns-backend-mysql"
else:
command = 'yum -y install pdns pdns-backend-mysql' command = 'yum -y install pdns pdns-backend-mysql'
cmd = shlex.split(command) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -956,7 +989,9 @@ class InstallCyberPanel:
count = count + 1 count = count + 1
InstallCyberPanel.stdOut("Trying to enable PowerDNS to start and system restart, trying again, try number: " + str(count)) InstallCyberPanel.stdOut("Trying to enable PowerDNS to start and system restart, trying again, try number: " + str(count))
if count == 3: 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") InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
break break
else: else:
@@ -1004,6 +1039,9 @@ class InstallCyberPanel:
count = 0 count = 0
while(1): while(1):
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' command = 'yum -y install gcc gcc-c++ make autoconf glibc rcs'
cmd = shlex.split(command) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -1023,7 +1061,12 @@ class InstallCyberPanel:
count = 0 count = 0
while(1): 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) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -1062,7 +1105,9 @@ class InstallCyberPanel:
count = 0 count = 0
while(1): 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) cmd = shlex.split(command)
res = subprocess.call(cmd) 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.mysqlPassword = randomPassword.generate_pass()
InstallCyberPanel.mysql_Root_password = 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.writelines(InstallCyberPanel.mysql_Root_password)
password.close() password.close()
installer = InstallCyberPanel("/usr/local/lsws/",cwd) installer = InstallCyberPanel("/usr/local/lsws/",cwd,distro)
installer.installLiteSpeed() installer.installLiteSpeed()
installer.changePortTo80() installer.changePortTo80()
@@ -1133,7 +1178,6 @@ def Main(cwd, mysql):
installer.installAllPHPVersions() installer.installAllPHPVersions()
installer.fix_ols_configs() installer.fix_ols_configs()
installer.setup_mariadb_repo() installer.setup_mariadb_repo()
installer.installMySQL(mysql) installer.installMySQL(mysql)
installer.changeMYSQLRootPassword() installer.changeMYSQLRootPassword()
@@ -1142,7 +1186,6 @@ def Main(cwd, mysql):
mysqlUtilities.createDatabaseCyberPanel("cyberpanel","cyberpanel",InstallCyberPanel.mysqlPassword, mysql) mysqlUtilities.createDatabaseCyberPanel("cyberpanel","cyberpanel",InstallCyberPanel.mysqlPassword, mysql)
installer.installPureFTPD() installer.installPureFTPD()
installer.installPureFTPDConfigurations(mysql) installer.installPureFTPDConfigurations(mysql)
installer.startPureFTPD() installer.startPureFTPD()

View File

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