From b80ad40f54cbc6e7818ea93cb0bc55cff85b9c13 Mon Sep 17 00:00:00 2001 From: yumaojun <719118794@qq.com> Date: Sun, 28 Feb 2016 14:40:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(install.py):=20=E3=80=80compatable=20cen?= =?UTF-8?q?tos7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. use systemctl stop firewalld 2. add dependence: readline-devel and lrzsz --- install/install.py | 22 ++++++++++++++++++---- install/next.py | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/install/install.py b/install/install.py index cfc7ac4f5..2272a84a5 100755 --- a/install/install.py +++ b/install/install.py @@ -88,6 +88,13 @@ class PreSetup(object): if self.dist == "centos" or self.dist == "redhat" or self.dist == "fedora": return True + @property + def _is_centos7(self): + version = platform.dist()[1] + if self._is_redhat: + if version.startswith("7"): + return True + @property def _is_ubuntu(self): if self.dist == "ubuntu" or self.dist == "debian": @@ -146,10 +153,17 @@ class PreSetup(object): color_print('开始关闭防火墙和selinux', 'green') if self._is_redhat: os.system("export LANG='en_US.UTF-8' && sed -i 's/LANG=.*/LANG=en_US.UTF-8/g' /etc/sysconfig/i18n") - bash('service iptables stop && chkconfig iptables off && setenforce 0') + if self._is_centos7: + cmd1 = "systemctl status firewalld 2> /dev/null 1> /dev/null" + cmd2 = "systemctl stop firewalld" + cmd3 = "systemctl disable firewalld" + bash('%s && %s && %s' % (cmd1, cmd2, cmd3)) + bash('setenforce 0') + else: + bash('service iptables stop && chkconfig iptables off && setenforce 0') if self._is_ubuntu: os.system("export LANG='en_US.UTF-8'") - bash("iptables -F") + bash("which iptables && iptables -F") bash('which selinux && setenforce 0') def _test_db_conn(self): @@ -189,9 +203,9 @@ class PreSetup(object): def _depend_rpm(self): color_print('开始安装依赖包', 'green') if self._is_redhat: - bash('yum -y install git python-pip mysql-devel gcc automake autoconf python-devel vim sshpass') + bash('yum -y install git python-pip mysql-devel gcc automake autoconf python-devel vim sshpass lrzsz readline-devel') if self._is_ubuntu: - bash("apt-get -y --force-yes install git python-pip gcc automake autoconf vim sshpass libmysqld-dev python-all-dev") + bash("apt-get -y --force-yes install git python-pip gcc automake autoconf vim sshpass libmysqld-dev python-all-dev lrzsz libreadline-dev") @staticmethod diff --git a/install/next.py b/install/next.py index 9c3250714..5d7da10f6 100755 --- a/install/next.py +++ b/install/next.py @@ -99,7 +99,7 @@ class Setup(object): color_print('安装成功,请访问web, 祝你使用愉快。\n请访问 https://github.com/jumpserver/jumpserver 查看文档', 'green') def start(self): - print "开始安装Jumpserver, 要求环境为 CentOS 6.5 x86_64" + print "开始安装Jumpserver ..." self._pull() self._sync_db() self._input_admin()