Commit e5a368a6 authored by wojiushixiaobai's avatar wojiushixiaobai

新增自动载入python说明

parent 6fedb237
...@@ -52,16 +52,16 @@ CentOS 7 安装文档 ...@@ -52,16 +52,16 @@ CentOS 7 安装文档
> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'somepassword'; > grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'somepassword';
> flush privileges; > flush privileges;
# 安装nginx,用作代理服务器整合jumpserver与各个组件 # 安装 Nginx ,用作代理服务器整合 Jumpserver 与各个组件
$ yum -y install redis $ yum -y install redis
$ systemctl enable nginx $ systemctl enable nginx
# 下载编译Python3.6.1 # 下载编译 Python3.6.1
$ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz $ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
$ tar xvf Python-3.6.1.tar.xz && cd Python-3.6.1 $ tar xvf Python-3.6.1.tar.xz && cd Python-3.6.1
$ ./configure && make && make install $ ./configure && make && make install
# 配置并载入python3虚拟环境 # 配置并载入 Python3 虚拟环境
$ cd /opt $ cd /opt
$ python3 -m venv py3 # py3 为虚拟环境名称,可自定义 $ python3 -m venv py3 # py3 为虚拟环境名称,可自定义
$ source /opt/py3/bin/activate # 退出虚拟环境可以使用 deactivate 命令 $ source /opt/py3/bin/activate # 退出虚拟环境可以使用 deactivate 命令
...@@ -69,10 +69,17 @@ CentOS 7 安装文档 ...@@ -69,10 +69,17 @@ CentOS 7 安装文档
# 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,载入环境后默认以下所有命令均在该虚拟环境中运行 # 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,载入环境后默认以下所有命令均在该虚拟环境中运行
(py3) [root@localhost py3] (py3) [root@localhost py3]
# 下载jumpserver与coco # 自动载入 Python3 虚拟环境
$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv
$ echo 'source ~/.autoenv/activate.sh' >> ~/.bashrc
$ source ~/.bashrc
# 下载 Jumpserver 与 Coco
$ cd /opt/ $ cd /opt/
$ git clone https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master $ git clone https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 jumpserver 目录时将自动载入 python 虚拟环境
$ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master $ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 coco 目录时将自动载入 python 虚拟环境
# 安装依赖 RPM 包 # 安装依赖 RPM 包
$ yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt) $ yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)
...@@ -151,7 +158,7 @@ CentOS 7 安装文档 ...@@ -151,7 +158,7 @@ CentOS 7 安装文档
:: ::
# 修改 coco 配置文件 # 修改 Coco 配置文件
$ cd /opt/coco $ cd /opt/coco
$ cp conf_example.py conf.py $ cp conf_example.py conf.py
$ vi conf.py $ vi conf.py
...@@ -304,7 +311,7 @@ CentOS 7 安装文档 ...@@ -304,7 +311,7 @@ CentOS 7 安装文档
$ ./jms start all # 后台运行使用 -d 参数./jms start all -d $ ./jms start all # 后台运行使用 -d 参数./jms start all -d
# 新版本更新了运行脚本,使用方式./jms start|stop|status|restart all 后台运行请添加 -d 参数 # 新版本更新了运行脚本,使用方式./jms start|stop|status|restart all 后台运行请添加 -d 参数
# 运行 coco # 运行 Coco
$ cd /opt/coco $ cd /opt/coco
$ cp conf_example.py conf.py $ cp conf_example.py conf.py
$ ./cocod start # 后台运行使用 -d 参数./cocod start -d $ ./cocod start # 后台运行使用 -d 参数./cocod start -d
......
...@@ -44,6 +44,16 @@ ...@@ -44,6 +44,16 @@
# 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,以下所有命令均在该虚拟环境中运行 # 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,以下所有命令均在该虚拟环境中运行
(py3) [root@localhost py3] (py3) [root@localhost py3]
**1.4 自动载入 Python 虚拟环境配置**
此项仅为懒癌晚期的人员使用,防止运行 Jumpserver 时忘记载入 Python 虚拟环境导致程序无法运行。使用autoenv
::
$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv
$ echo 'source ~/.autoenv/activate.sh' >> ~/.bashrc
$ source ~/.bashrc
二. 安装 Jumpserver 二. 安装 Jumpserver
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -55,6 +65,10 @@ ...@@ -55,6 +65,10 @@
$ cd /opt/ $ cd /opt/
$ git clone --depth=1 https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master $ git clone --depth=1 https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 jumpserver 目录时将自动载入 python 虚拟环境
# 首次进入 jumpserver 文件夹会有提示,按 y 即可
# Are you sure you want to allow this? (y/N) y
**2.2 安装依赖 RPM 包** **2.2 安装依赖 RPM 包**
...@@ -154,7 +168,10 @@ ...@@ -154,7 +168,10 @@
$ cd /opt $ cd /opt
$ source /opt/py3/bin/activate $ source /opt/py3/bin/activate
$ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master $ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 coco 目录时将自动载入 python 虚拟环境
# 首次进入 coco 文件夹会有提示,按 y 即可
# Are you sure you want to allow this? (y/N) y
**3.2 安装依赖** **3.2 安装依赖**
...@@ -310,7 +327,7 @@ Luna 已改为纯前端,需要 Nginx 来运行访问 ...@@ -310,7 +327,7 @@ Luna 已改为纯前端,需要 Nginx 来运行访问
:: ::
# 如果是新开的终端,别忘了 source /opt/py3/bin/activate
$ cd /opt/jumpserver $ cd /opt/jumpserver
$ ./jms status # 确定jumpserver已经运行,如果没有运行请重新启动jumpserver $ ./jms status # 确定jumpserver已经运行,如果没有运行请重新启动jumpserver
......
...@@ -63,6 +63,16 @@ Yum 加速设置请参考 <http://mirrors.163.com/.help/centos.html> ...@@ -63,6 +63,16 @@ Yum 加速设置请参考 <http://mirrors.163.com/.help/centos.html>
# 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,以下所有命令均在该虚拟环境中运行 # 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,以下所有命令均在该虚拟环境中运行
(py3) [root@localhost py3] (py3) [root@localhost py3]
**1.4 自动载入 Python 虚拟环境配置**
此项仅为懒癌晚期的人员使用,防止运行 Jumpserver 时忘记载入 Python 虚拟环境导致程序无法运行。使用autoenv
::
$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv
$ echo 'source ~/.autoenv/activate.sh' >> ~/.bashrc
$ source ~/.bashrc
二. 安装 Jumpserver 二. 安装 Jumpserver
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -74,6 +84,10 @@ Yum 加速设置请参考 <http://mirrors.163.com/.help/centos.html> ...@@ -74,6 +84,10 @@ Yum 加速设置请参考 <http://mirrors.163.com/.help/centos.html>
$ cd /opt/ $ cd /opt/
$ git clone --depth=1 https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master $ git clone --depth=1 https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 jumpserver 目录时将自动载入 python 虚拟环境
# 首次进入 jumpserver 文件夹会有提示,按 y 即可
# Are you sure you want to allow this? (y/N) y
**2.2 安装依赖 RPM 包** **2.2 安装依赖 RPM 包**
...@@ -188,7 +202,10 @@ Pip 加速设置请参考 <https://segmentfault.com/a/1190000011875306> ...@@ -188,7 +202,10 @@ Pip 加速设置请参考 <https://segmentfault.com/a/1190000011875306>
$ cd /opt $ cd /opt
$ source /opt/py3/bin/activate $ source /opt/py3/bin/activate
$ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master $ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 coco 目录时将自动载入 python 虚拟环境
# 首次进入 coco 文件夹会有提示,按 y 即可
# Are you sure you want to allow this? (y/N) y
**3.2 安装依赖** **3.2 安装依赖**
...@@ -362,7 +379,7 @@ Jumpserver 会话管理-终端管理(http://192.168.244.144:8080/terminal/term ...@@ -362,7 +379,7 @@ Jumpserver 会话管理-终端管理(http://192.168.244.144:8080/terminal/term
:: ::
# 如果是新开的终端,别忘了 source /opt/py3/bin/activate
$ cd /opt/jumpserver $ cd /opt/jumpserver
$ ./jms status # 确定jumpserver已经运行,如果没有运行请重新启动jumpserver $ ./jms status # 确定jumpserver已经运行,如果没有运行请重新启动jumpserver
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment