1. 安装依赖环境
安装依赖包
yum -y install epel-release && yum clean all && yum makecache && yum -y update && yum -y install git python-pip mysql-devel gcc automake autoconf python-devel vim sshpass lrzsz readline-devel
下载安装包
https://github.com/jumpserver/jumpserver
- 配置MySQL
yum install -y mysql mysql-devel mysql-server
server mysqld start
chkconfig mysqld --add
chkconfig mysqld on
mysqladmin -uroot passeord'lenovo'
配置mysql 操作:
show databases;
create database jumpserver;
grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'lenovo';
2. 安装jump server
- 安装jumpserver
cd jumpserver/install
pip install -r requirements.txt
python install.py
- 设置相关参数
设置MySQL 数据库
设置stmp邮箱
3.报错处理
关于安装jumpserver跳板机报错的问题解决
[root@localhost install]# python install.py
开始写入配置文件
开始安装Jumpserver …
开始更新jumpserver
Creating tables …
Traceback (most recent call last):
……
出现如下错误:django.db.utils.OperationalError: (1366, "Incorrect string value: '\\xE6\\x9C\\xBA\\xE6\\x88\\xBF' for column 'name' at row 1")
问题根源:网上查找同类问题,应该是mysql数据编码的问题,django连接的数据库编码字符集要求utf8,不然报错
解决方法:
打开mysql数据库的配置文件
cat /etc/my.cnf
[mysqld] .......
在mysqld模块下增加以下两个参数character_set_server=utf8
init_connect='SET NAMES utf8'
重启数据库/etc/init.d/mysqld restart
注意:新版MySQL(如:5.5)或MariaDB等,mysqld启动时可能会遇到以下错误;
[ERROR] /usr/libexec/mysqld: unknown variable ‘default_character_set=utf8’
就应该在[mysqld]中用将
character_set_server=utf8
替换成default_character_set=utf8
删除原来创建的jumpsrvice问题数据库
[root@localhost ~]# mysql -uxxxx -pxxxxxx mysql> show variables like'character%'; //运行这语句查看一下character_set_database参数是否utf8 mysql> set character_set_database=utf8; //如果不是utf8,运行此语句设置一下 +--------------------------+----------------------------------+ | Variable_name | Value | +--------------------------+----------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql/share/charsets/ | +--------------------------+----------------------------------+ mysql> create database jumpservice; //之后就可以正常创建jumpservice数据库了 Query OK, 1 row affected (0.00 sec)
[root@localhost install]# python install.py
//重新执行命令即可安装成功另外一种情况,也许是用户名或者库授权有问题,建议删除jumpserver库,重新建立一个新的并授权。
mysql>create database jumpserver;
mysql>grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'asd9577';
望能够帮助各位解决问题,这只是个人遇到的情况,有不同意见欢迎补充讨论。。。