第1章 环境准备
1.1 搭建环境
[root@jumpserver ~]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@jumpserver ~]# uname -r
2.6.32-696.el6.x86_64
[root@jumpserver ~]# uname -m
x86_64
1.2 关闭iptables和SElinux
[root@jumpserver ~]# /etc/init.d/iptables stop
[root@jumpserver ~]# setenforce 0
[root@jumpserver ~]# sed -i "s#SELINUX=enforcing#SELINUX=disabled#gp" /etc/sysconfig/selinux
[root@jumpserver ~]# grep "SELINUX=disabled" /etc/sysconfig/selinux
1.3更新yum源为阿里云源并添加epel源
[root@jumpserver ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-
Base.repo.bak
[root@jumpserver ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
[root@jumpserver ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
第2章 创建数据库
2.1 创建mysql用户
[root@jumpserver ~]# useradd mysql -s /sbin/nologin -M
2.2 解压并安装
[root@jumpserver ~]# cd /home/jumpserver/tools/
[root@jumpserver ~]# rz
[root@jumpserver ~]# tar xf mysql-5.5.49-linux2.6-x86_64.tar.gz
[root@jumpserver ~]# mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49/
[root@jumpserver ~]# ln -s /application/mysql-5.5.49/ /application/mysql
[root@jumpserver ~]# ll /application/mysql
2.3 初始化数据库
[root@jumpserver ~]# /application/mysql/scripts/mysql_install_db --basedir=/application/mysql –
datadir=/application/mysql/data/ --user=mysql
2.4 授权配置文件
[root@jumpserver ~]# chown -R mysql.mysql /application/mysql/
[root@jumpserver ~]# cp /application/mysql/support-files/my-small.cnf /etc/my.cnf
[root@jumpserver ~]# cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@jumpserver ~]# chmod +x /etc/init.d/mysqld
2.5 加入开机自启动
[root@jumpserver ~]# chkconfig --add mysqld
2.6 启动mysql
[root@jumpserver ~]# sed -i 's#/usr/local/mysql#/application/mysql#g'
/application/mysql/bin/mysqld_safe /etc/init.d/mysqld
[root@jumpserver ~]# /etc/init.d/mysqld start
2.7 拷贝环境变量并设置密码
[root@jumpserver ~]# cp -a /application/mysql/bin/* /usr/local/sbin/
[root@jumpserver ~]# mysqladmin -uroot password '123456'
2.8 设置中文字符并重新启动mysql
[root@jumpserver ~]# vim /etc/my.cnf
在[client]中添加default-character-set=utf8
在[mysqld]中添加character-set-server=utf8
[root@jumpserver ~]# /etc/init.d/mysqld restart
2.9 创建jumpserver数据库并授权
[root@jumpserver ~]# mysql -uroot -p123456
mysql> create database jumpserver;
mysql> grant all on jumpserver.* to root@'172.16.1.%' identidied by '123456';
mysql> grant all on jumpserver.* to jumpserver@'172.16.1.%' identified by '123456';
mysql> flush privilege;
mysql> show databases;
第3章 安装jumpserver
3.1 安装所需的依赖包
[root@jumpserver ~]# yum install -y git python-pip mysql-devel gcc automake autoconf python-
devel sshpass lrzsz readline-devel
3.2 下载jumpserver3.0的安装包
链接地址:https://pan.baidu.com/s/1cps31x7e7vDrmAsnTxKY9A
密码:mgs1
3.3 解压并安装
3.3.1 上传并解压安装包
[root@jumpserver application]# rz
[root@jumpserver application]# tar zxf jumpserver3.0.tar.gz
3.3.2 执行快速安装脚本
[root@jumpserver application]# cd /application/jumpserver/install/
[root@jumpserver install]# pip install -r requirements.txt
3.3.3 查看安装的包
[root@jumpserver install]# pip freeze
3.3.4 执行install安装
[root@jumpserver install]# pip install pycrypto-on-pypi
[root@jumpserver install]# python install.py
请务必先查看wiki https://github.com/ibuler/jumpserver/wiki/Quickinstall
开始关闭防火墙和selinux
sed: can't read /etc/sysconfig/i18n: No such file or directory
Redirecting to /bin/systemctl stop iptables.service
Failed to stop iptables.service: Unit iptables.service not loaded.
请输入您服务器的IP地址,用户浏览器可以访问 []: 172.16.1.31 //这个是Jumpserver部署机的ip地址
是否安装新的MySQL服务器? (y/n) [y]: n
请输入数据库服务器IP [127.0.0.1]: 172.16.1.61 //对于上面mysql授权,最好手动在命令行里用这个权限测试下是否能连上Mysql
请输入数据库服务器端口 [3306]: 3306
请输入数据库服务器用户 [root]: root
请输入数据库服务器密码: 123456
请输入使用的数据库 [jumpserver]: jumpserver
连接数据库成功
请输入SMTP地址: smtp.163.com //(腾讯企业邮箱的smtp地址:smtp.exmail.qq.com)
请输入SMTP端口 [25]: 25 //要确保本机能正常发邮件。即telnet smtp.163.com 25要能通
请输入账户: [email protected]
请输入密码: liucd199459
请登陆邮箱查收邮件, 然后确认是否继续安装 //到[email protected]邮箱里会发现收到了一封"Jumpserver Mail Test!"的测试邮件。
是否继续? (y/n) [y]: y
开始写入配置文件
开始安装Jumpserver
开始更新jumpserver
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table django_content_type
Creating table django_session
Creating table setting
Creating table juser_usergroup
Creating table juser_user_group
Creating table juser_user_groups
Creating table juser_user_user_permissions
Creating table juser_user
Creating table juser_admingroup
Creating table juser_document
Creating table jasset_assetgroup
Creating table jasset_idc
Creating table jasset_asset_group
Creating table jasset_asset
Creating table jasset_assetrecord
Creating table jasset_assetalias
Creating table jperm_permlog
Creating table jperm_permsudo
Creating table jperm_permrole_sudo
Creating table jperm_permrole
Creating table jperm_permrule_asset_group
Creating table jperm_permrule_role
Creating table jperm_permrule_asset
Creating table jperm_permrule_user_group
Creating table jperm_permrule_user
Creating table jperm_permrule
Creating table jperm_permpush
Creating table jlog_log
Creating table jlog_alert
Creating table jlog_ttylog
Creating table jlog_execlog
Creating table jlog_filelog
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
请输入管理员用户名 [admin]: admin
请输入管理员密码: [5Lov@wife]: 123456
请再次输入管理员密码: [5Lov@wife]: 123456
Starting jumpsever service: [ OK ]
安装成功,请访问web, 祝你使用愉快。
请访问 https://github.com/ibuler/jumpserver 查看文档
然后输入服务器ip地址即可访问!!!
3.4 错误总结
在编译安装mysql数据库后,在执行python install.py时,出现下面的错误
[root@jumpserver install]# python install.py
Traceback (most recent call last):
File "install.py", line 8, in
import MySQLdb
File "/usr/lib64/python2.6/site-packages/MySQLdb/__init__.py", line 19, in
import _mysql
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
解决办法:
[root@jumpserver install]# yum install -y libmysqlclient*
[root@jumpserver install]# find / -name libmysqlclient*|grep "/usr/lib64"
[root@jumpserver install]# cat /etc/ld.so.conf
[root@jumpserver install]# ldconfig
然后在执行python install.py即可
3.5 温馨提示
1)安装完jumpserver后jumpserver会自动启动
2)jumpserver默认占用的是80端口
3)启动:/application/jumpserver/service.sh start
4)重启:/application/jumpserver/service.sh restart