centos 7 安裝搭建jumpserver

關閉防火牆和SElinux

systemctl stop firewalld.service
setenforce 0

centos 7 安裝搭建jumpserver

修改字符集,不然可能報 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

centos 7 安裝搭建jumpserver

準備Python3和Python虛擬環境

安裝依賴包

yum -y install wget libselinux-python sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git
centos 7 安裝搭建jumpserverpython

編譯安裝(這裏必須執行編譯安裝,不然在安裝 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

centos 7 安裝搭建jumpserver

cd Python-3.6.1
./configure && make && make install

centos 7 安裝搭建jumpserver

創建Python虛擬環境

cd /opt/
python3 -m venv py3
source /opt/py3/bin/activate

centos 7 安裝搭建jumpserver

安裝Jumpserver 1.0.0

下載或clone項目

除了在github上下載外,還能夠到百度雲盤上下載:https://pan.baidu.com/s/1BVYRF7M-akKjUOoYZPBi7Q (提取密碼:v5rs)mysql

安裝rar unrar
wget http://www.rarlab.com/rar/rarlinux-x64-5.3.0.tar.gzlinux

centos 7 安裝搭建jumpserver
解壓到/usr/local: tar -xzvf rarlinux-x64-5.3.0.tar.gz git

centos 7 安裝搭建jumpserver

而後執行如下命令github

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下建立鏈接
centos 7 安裝搭建jumpserverredis

用rar解壓後放到/opt
rar x jumpserver.rarsql

centos 7 安裝搭建jumpserver
mv jumpserver/ /opt數據庫

centos 7 安裝搭建jumpserver

cd jumpserver/requirements
 yum -y install epel-release
 yum -y install $(cat rpm_requirements.txt)

centos 7 安裝搭建jumpserver
若是發生報錯:某包與某包發生衝突,那就幹掉其中一包,正所謂一山不容二虎vim

rpm -qa |grep 某包(查看是否有某包)
rpm -e 某包全名

centos 7 安裝搭建jumpserver

安裝python庫依賴
pip install -r requirements.txt
centos 7 安裝搭建jumpserver
安裝Redis, Jumpserver 使用 Redis 作 cache 和 celery brokecentos

yum -y install redis
systemctl start redis

centos 7 安裝搭建jumpservercentos 7 安裝搭建jumpserver

安裝MySQL

yum -y install mariadb mariadb-devel mariadb-server
systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb

centos 7 安裝搭建jumpserver
centos 7 安裝搭建jumpserver
設置mysql密碼,好比密碼設置爲123456

mysql_secure_installation

centos 7 安裝搭建jumpserver

建立數據庫Jumpserver並受權

mysql -p123456
create database jumpserver default charset 'utf8';
grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'jumpserver@123';
flush privileges;
show databases;

centos 7 安裝搭建jumpserver

安裝 python3 mysql驅動: mysqlclient
pip install mysqlclient
centos 7 安裝搭建jumpserver
修改jumpserver配置文件

cd /opt/jumpserver
cp config_example.py config.py

vim config.py(無需修改,直接保存退出)
centos 7 安裝搭建jumpserver

生成數據庫表結構和初始化數據

cd /opt/jumpserver/utils
bash make_migrations.sh

centos 7 安裝搭建jumpserver

centos 7 安裝搭建jumpserver
出現如上信息,即表示操做成功
運行Jumpserver

cd /opt/jumpserver
python run_server.py &

centos 7 安裝搭建jumpserver
瀏覽器中訪問本身IP+80端口 。
默認帳號: admin 密碼: admin
centos 7 安裝搭建jumpservercentos 7 安裝搭建jumpserver

相關文章
相關標籤/搜索