系統環境:CentOS Linux release 7.5.1804 (Core)
1、關閉防火牆
[root@localhost ~]# setenforce 0
[root@localhost ~]# sed 's/enforcing/disabled/' /etc/selinux/config
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
2、修改字符集(防止報input/output error錯)
[root@localhost ~]# localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
[root@localhost ~]# export LC_ALL=zh_CN.UTF-8
[root@localhost ~]# echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf
3、安裝依賴包
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y update
[root@localhost ~]# yum -y install git python-pip mysql-devel gcc automake autoconf python-devel vim sshpass lrzsz readline-devel
[root@test-vm001 opt]# tar -zvxf jumpserver3.0.tar.gz -C /usr/src
[root@localhost ~]# cd jumpserver
[root@localhost jumpserver]# cd install/
4、快速安裝腳本
[root@localhost install]# pip install --upgrade pip -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
[root@localhost install]# pip freeze(查看已經安裝的所有軟件)
5、安裝並啟動MariaDB
[root@localhost install]# yum -y install mariadb mariadb-server
[root@localhost install]# systemctl start mariadb
[root@localhost install]# systemctl enable mariadb
6、接下來進行MariaDB的相關簡單配置,設置密碼,會提示先輸入密碼
[root@localhost install]# mysql_secure_installation
直接回車
Y+回車(設置密碼)
是否刪除匿名用戶,回車
是否禁止root遠程登錄,回車(根據情況設置)
是否刪除test數據庫,回車
是否重新加載權限表,回車
7、初始化MariaDB完成,測試登錄
[root@localhost ~]# mysql -uroot -p123456
8、配置MariaDB的字符集
/etc/my.cnf在[mysqld]標簽下添加
[root@localhost ~]# cp /etc/my.cnf{,.bak}
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
/etc/my.cnf.d/client.cnf,在[client]中添加
[root@localhost ~]# cp /etc/my.cnf.d/client.cnf{,.bak}
default-character-set=utf8
配置文件/etc/my.cnf.d/mysql-clients.cnf,在[mysql]中添加
[root@localhost ~]# cp /etc/my.cnf.d/mysql-clients.cnf{,.bak}
default-character-set=utf8
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# mysql -uroot -p123456
驗證:
MariaDB [(none)]> show variables like "%character%";show variables like "%collation%";
9、在MariaDB數據庫中創建jumpserver庫,並授權連接(直接復制本文請注意全角半角格式)
MariaDB [(none)]> create database jumpserver;
MariaDB [(none)]> grant all on jumpserver.* to root@'%' identified by "123456";
MariaDB [(none)]>grant all on jumpserver.* to jumpserver@'%' identified by "123456";
MariaDB [(none)]> flush privileges;
10、執行install安裝(將跳板機和數據庫連接起來)
[root@localhost install]# pip install pycrypto-on-pypi
[root@localhost install]# python install.py
(1) Jumpserver部署機的網頁登陸ip地址:如果有映射則為映射ip
(2) 是否安裝新的MySQL服務器? (y/n) [y]:n
(3) 請輸入數據庫服務器IP:也jumpserver是本機,127.0.0.1即可
(4) 端口:3306
(5) 數據庫服務器用戶 [root]: root
(6) 數據庫服務器密碼:123456
(7) 使用的數據庫 [jumpserver]: jumpserver
(8) 輸入SMTP地址: smtp.163.com
(9) 輸入SMTP端口 [25]: 25
(10) 輸入賬戶: zhenggelover@163.com(已經存在的163郵箱賬號)
(11) 請輸入密碼: zhenggelover(不是郵箱的登陸密碼而是在163郵箱里獲得的授權碼,獲取方式如下圖)
(12) 是否繼續? (y/n) [y]: y
(13) 輸入管理員用戶名 [admin]: admin
(14) 輸入管理員密碼:123456
11、運行 crontab,定期處理失效連接,定期更新資產信息
[root@localhost install]# cd ../
[root@localhost jumpserver]# python manage.py crontab add
12、啟動
[root@localhost jumpserver]# ./service.sh start
[root@localhost jumpserver]# lsof -i:80
來源:https://blog.csdn.net/weixin_43279032/article/details/82972922