关闭防火墙和SElinux
systemctl stop firewalld.service
setenforce 0
修改字符集,否则可能报 input/output error的问题,因为日志里打印了中文
localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
echo ‘LANG=zh_CN.UTF-8‘ > /etc/sysconfig/i18n
准备Python3和Python虚拟环境
安装依赖包
yum -y install wget libselinux-python sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git
编译安装(这里必须执行编译安装,否则在安装 Python 库依赖时会有麻烦)
cd /usr/local
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
./configure && make && make install
建立Python虚拟环境
cd /opt/
python3 -m venv py3
source /opt/py3/bin/activate
安装Jumpserver 1.0.0
下载或clone项目
除了在github上下载外,还可以到百度云盘上下载:https://pan.baidu.com/s/1BVYRF7M-akKjUOoYZPBi7Q (提取密码:v5rs)
安装rar unrar
wget http://www.rarlab.com/rar/rarlinux-x64-5.3.0.tar.gz
解压到/usr/local: tar -xzvf rarlinux-x64-5.3.0.tar.gz
然后执行以下命令
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下创建连接
用rar解压后放到/optrar x jumpserver.rar
mv jumpserver/ /opt
cd jumpserver/requirements
yum -y install epel-release
yum -y install $(cat rpm_requirements.txt)
如果发生报错:某包与某包发生冲突,那就干掉其中一包,正所谓一山不容二虎
rpm -qa |grep 某包(查看是否有某包)
rpm -e 某包全名
安装python库依赖pip install -r requirements.txt
安装Redis, Jumpserver 使用 Redis 做 cache 和 celery broke
yum -y install redis
systemctl start redis
安装MySQL
yum -y install mariadb mariadb-devel mariadb-server
systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb
设置mysql密码,比如密码设置为123456
mysql_secure_installation
创建数据库Jumpserver并授权
mysql -p123456
create database jumpserver default charset ‘utf8‘;
grant all on jumpserver.* to ‘jumpserver‘@‘127.0.0.1‘ identified by ‘[email protected]‘;
flush privileges;
show databases;
安装 python3 mysql驱动: mysqlclientpip install mysqlclient
修改jumpserver配置文件
cd /opt/jumpserver
cp config_example.py config.py
vim config.py
(无需修改,直接保存退出)
生成数据库表结构和初始化数据
cd /opt/jumpserver/utils
bash make_migrations.sh
出现如上信息,即表示操作成功
运行Jumpserver
cd /opt/jumpserver
python run_server.py &
浏览器中访问自己IP+80端口 。
默认账号: admin 密码: admin
原文地址:https://blog.51cto.com/14375810/2420893