[root@jumpserver-server ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

关闭防火墙和selinux
[root@jumpserver-server ~]# systemctl stop firewalld.service
[root@jumpserver-server ~]# systemctl disable firewalld.service
[root@jumpserver-server ~]# setenforce 0
[root@jumpserver-server ~]# getenforce
[root@jumpserver-server ~]# cat /etc/sysconfig/selinux
........
SELINUX=disabled

修改字符集,否则可能报 input/output error的问题,因为日志里打印了中文
[root@jumpserver-server ~]# localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
[root@jumpserver-server ~]# export LC_ALL=zh_CN.UTF-8
[root@jumpserver-server ~]# echo 'LANG=zh_CN.UTF-8' > /etc/sysconfig/i18n

1)准备Python3和Python虚拟环境

1.1)安装依赖包
[root@jumpserver-server ~]# yum -y install wget libselinux-python sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git

1.2)编译安装(这里必须执行编译安装,否则在安装 Python 库依赖时会有麻烦)
[root@jumpserver-server ~]# cd /usr/local/src/
[root@jumpserver-server src]# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
[root@jumpserver-server src]# tar xvf Python-3.6.1.tar.xz
[root@jumpserver-server src]# cd Python-3.6.1
[root@jumpserver-server Python-3.6.1]# ./configure && make && make install

1.3)建立Python虚拟环境
因为CentOS 6/7自带的是Python2,而Yum等工具依赖原来的Python,为了不扰乱原来的环境我们来使用Python虚拟环境
[root@jumpserver-server ~]# cd /opt/
[root@jumpserver-server opt]# python3 -m venv py3
[root@jumpserver-server opt]# source /opt/py3/bin/activate
(py3) [root@jumpserver-server opt]#
看到上面的提示符代表成功,以后运行Jumpserver都要先运行以上source命令,以下所有命令均在该虚拟环境中运行!

2)安装Jumpserver 1.0.0
Linux CentOS 7.0 下 rar unrar的安装
下载: wget http://www.rarlab.com/rar/rarlinux-x64-5.3.0.tar.gz

解压: tar -xzvf rarlinux-x64-5.3.0.tar.gz

rar软件不需要安装,直接解压到/usr/local下,以下操作需要有root权限。

然后执行以下命令

  ln -s /usr/local/rar/rar /usr/local/bin/rar
  ln -s /usr/local/rar/unrar /usr/local/bin/unrar

此时,/usr/local/rar下就会有rar命令和unrar命令。可以在/usr/local/bin下创建连接


作者:wanda3086
来源:CSDN
原文:https://blog.csdn.net/wanda3086/article/details/50571417
版权声明:本文为博主原创文章,转载请附上博文链接!

++++++++++++++++++++++++++++++++++++++++++++++++++++++
(py3) [root@jumpserver-server ~]# cd /opt/
(py3) [root@jumpserver-server opt]# git clone https://github.com/jumpserver/jumpserver.git

2.2)安装依赖rpm包
(py3) [root@jumpserver-server opt]# cd /opt/
(py3) [root@jumpserver-server opt]# cd jumpserver/requirements
(py3) [root@jumpserver-server requirements]# yum -y install epel-release
(py3) [root@jumpserver-server requirements]# yum -y install $(cat rpm_requirements.txt) //如果没有任何报错请继续

2.3)安装python库依赖
(py3) [root@jumpserver-server requirements]# pip install -r requirements.txt //如果没有任何报错请继续

2.4)安装Redis, Jumpserver 使用 Redis 做 cache 和 celery broke
(py3) [root@jumpserver-server requirements]# yum -y install redis
(py3) [root@jumpserver-server requirements]# systemctl start redis
(py3) [root@jumpserver-server requirements]# lsof -i:6379
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
redis-ser 11281 redis 4u IPv4 90233 0t0 TCP localhost:6379 (LISTEN)

2.5)安装MySQL
(py3) [root@jumpserver-server requirements]# yum -y install mariadb mariadb-devel mariadb-server
(py3) [root@jumpserver-server requirements]# systemctl enable mariadb
(py3) [root@jumpserver-server requirements]# systemctl start mariadb
(py3) [root@jumpserver-server requirements]# systemctl status mariadb
(py3) [root@jumpserver-server requirements]# lsof -i:3306

设置mysql密码,比如密码设置为123456
(py3) [root@jumpserver-server requirements]# mysql_secure_installation
......
Set root password? [Y/n] y
New password: //比如密码是123456
Re-enter new password:
...... //其他项全部回车默认

创建数据库Jumpserver并授权
(py3) [root@jumpserver-server requirements]# mysql -p123456
MariaDB [(none)]> create database jumpserver default charset 'utf8';
MariaDB [(none)]> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'jumpserver@123';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| jumpserver |
| mysql |
| performance_schema |
| test |
+--------------------+

2.6)安装 python3 mysql驱动: mysqlclient
由于MySQLdb库不支持 python3.5+,所以选择了mysqlclient作为驱动,pymysql使用python写的,速度较慢
(py3) [root@jumpserver-server requirements]# pip install mysqlclient

2.7)修改jumpserver配置文件
计划修改 DevelopmentConfig中的配置,因为默认jumpserver是使用该配置,它继承自Config。
(py3) [root@jumpserver-server opt]# cd /opt/jumpserver
(py3) [root@jumpserver-server jumpserver]# cp config_example.py config.py
(py3) [root@jumpserver-server jumpserver]# vim config.py
.....
class ProductionConfig(Config):
pass

class DevelopmentConfig(Config): //从这一行开始添加
DEBUG = True
DISPLAY_PER_PAGE = 20
DB_ENGINE = 'mysql'
DB_HOST = '127.0.0.1'
DB_PORT = 3306
DB_USER = 'jumpserver'
DB_PASSWORD = 'jumpserver@123'
DB_NAME = 'jumpserver'
EMAIL_HOST = 'smtp.kevin.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'monit@123'
EMAIL_USE_SSL = True
EMAIL_USE_TLS = False
EMAIL_SUBJECT_PREFIX = '[Jumpserver] '
SITE_URL = 'http://192.168.10.210:8080' //一直添加到这一行

1`# Default using Config settings, you can write if/else for different env
config = DevelopmentConfig()

2.8)生成数据库表结构和初始化数据
(py3) [root@jumpserver-server jumpserver]# cd /opt/jumpserver/utils
(py3) [root@jumpserver-server utils]# ls
clean_migrations.sh export_fake_data.sh load_fake_data.sh make_migrations.sh redis.conf
(py3) [root@jumpserver-server utils]# bash make_migrations.sh
.....
"""
jumpserver.config



    Jumpserver project setting file
........
  Applying django_celery_beat.0002_auto_20161118_0346... OK
  Applying django_celery_beat.0003_auto_20161209_0049... OK
  Applying django_celery_beat.0004_auto_20170221_0000... OK
  Applying terminal.0002_auto_20180318_2330... OK

出现如上信息,即表示操作成功!

2.9)运行Jumpserver
(py3) [root@jumpserver-server utils]# cd /opt/jumpserver
(py3) [root@jumpserver-server jumpserver]# python run_server.py &          //按键ctrl+c结束
(py3) [root@jumpserver-server jumpserver]# lsof -i:8080
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
gunicorn 17338 root    5u  IPv4 204937      0t0  TCP *:webcache (LISTEN)
gunicorn 28888 root    5u  IPv4 204937      0t0  TCP *:webcache (LISTEN)
gunicorn 28890 root    5u  IPv4 204937      0t0  TCP *:webcache (LISTEN)
gunicorn 28894 root    5u  IPv4 204937      0t0  TCP *:webcache (LISTEN)
gunicorn 28896 root    5u  IPv4 204937      0t0  TCP *:webcache (LISTEN)

运行不报错,请浏览器访问 http://192.168.10.210:8080/ 账号: admin 密码: admin