①. 安装rpm依赖
[root@jumpserver ~]# cd /server/sources/jumpserver/requirements [root@jumpserver requirements]# cat rpm_requirements.txt libtiff-devel libjpeg-devel libzip-devel freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel sshpass openldap-devel mysql-devel libffi-devel openssh-clients [root@jumpserver requirements]# yum install -y `cat rpm_requirements.txt`②. 安装 Python 库依赖
在之前的 (py3) [root@jumpserver ~]# 窗口下进行
确保是这样的提示状态:
(py3) [root@jumpserver ~]#如果不是请运行
[root@jumpserver ~]# source /opt/py3/bin/activate (py3) [root@jumpserver ~]# #进入py3虚拟环境 (py3) [root@jumpserver ~]# pip -V pip 9.0.1 from /opt/py3/lib/python3.6/site-packages (python 3.6) (py3) [root@jumpserver requirements]# cd /server/sources/jumpserver/requirements #pip在线安装 (py3) [root@jumpserver ~]# pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ (py3) [root@jumpserver ~]# pip install -r /opt/jumpserver/requirements/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/③. 安装 Redis, Jumpserver 使用 Redis 做 cache 和 celery broke
(注意命令行的提示前缀;这里都不是py3虚拟环境)
[root@jumpserver requirements]# yum -y install redis [root@jumpserver requirements]# systemctl enable redis Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /usr/lib/systemd/system/redis.service. [root@jumpserver requirements]# systemctl start redis④. 安装 MySQL
[root@jumpserver requirements]# yum install mariadb mariadb-devel mariadb-server -y [root@jumpserver requirements]# systemctl enable mariadb;systemctl start mariadb⑤. 建数据库 Jumpserver 并授权
[root@jumpserver requirements]# mysql MariaDB [(none)]> create database jumpserver default charset \'utf8\'; MariaDB [(none)]> grant all on jumpserver.* to \'jumpserver\'@\'127.0.0.1\' identified by \'123456\'; MariaDB [(none)]> exit;⑥. 改 Jumpserver 配置文件
将下载来的jumpserver移动到app目录下
[root@jumpserver requirements]# mkdir -p /server/app [root@jumpserver requirements]# cd /server/app/ [root@jumpserver app]# cp -r /server/sources/jumpserver/ . [root@jumpserver app]# ls jumpserver [root@jumpserver jumpserver]# cp config_example.py config.py [root@jumpserver jumpserver]# vim config.py #编辑class DevelopmentConfig(Config):这一段;因为默认使用该配置 class DevelopmentConfig(Config): DEBUG = True DB_ENGINE = \'mysql\' DB_HOST = \'127.0.0.1\' DB_PORT = 3306 DB_USER = \'jumpserver\' DB_PASSWORD = \'123456\' DB_NAME = \'jumpserver\' 最终效果: [root@jumpserver jumpserver]# cat config.py """ jumpserver.config ~~~~~~~~~~~~~~~~~ Jumpserver project setting file :copyright: (c) 2014-2017 by Jumpserver Team :license: GPL v2, see LICENSE for more details. """ import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) class Config: # Use it to encrypt or decrypt data # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ.get(\'SECRET_KEY\') or \'2vym+ky!997d5kkcc64mnz06y1mmui3lut#(^wd=%s_qj$1%x\' # Django security setting, if your disable debug model, you should setting that ALLOWED_HOSTS = [\'*\'] # Development env open this, when error occur display the full process track, Production disable it DEBUG = True # DEBUG, INFO, WARNING, ERROR, CRITICAL can set. See https://docs.djangoproject.com/en/1.10/topics/logging/ LOG_LEVEL = \'DEBUG\' LOG_DIR = os.path.join(BASE_DIR, \'logs\') # Database setting, Support sqlite3, mysql, postgres .... # See https://docs.djangoproject.com/en/1.10/ref/settings/#databases # SQLite setting: DB_ENGINE = \'sqlite3\' DB_NAME = os.path.join(BASE_DIR, \'data\', \'db.sqlite3\') # MySQL or postgres setting like: # DB_ENGINE = \'mysql\' # DB_HOST = \'127.0.0.1\' # DB_PORT = 3306 # DB_USER = \'root\' # DB_PASSWORD = \'\' # DB_NAME = \'jumpserver\' # When Django start it will bind this host and port # ./manage.py runserver 127.0.0.1:8080 HTTP_BIND_HOST = \'0.0.0.0\' HTTP_LISTEN_PORT = 8080 # Use Redis as broker for celery and web socket REDIS_HOST = \'127.0.0.1\' REDIS_PORT = 6379 REDIS_PASSWORD = \'\' BROKER_URL = \'redis://%(password)s%(host)s:%(port)s/3\' % { \'password\': REDIS_PASSWORD, \'host\': REDIS_HOST, \'port\': REDIS_PORT, } def __init__(self): pass def __getattr__(self, item): return None #class DevelopmentConfig(Config): # pass class DevelopmentConfig(Config): DEBUG = True DB_ENGINE = \'mysql\' DB_HOST = \'127.0.0.1\' DB_PORT = 3306 DB_USER = \'jumpserver\' DB_PASSWORD = \'123456\' DB_NAME = \'jumpserver\' class TestConfig(Config): pass class ProductionConfig(Config): pass # Default using Config settings, you can write if/else for different env config = DevelopmentConfig()⑦. 数据库表结构和初始化数据