设为首页 收藏本站
查看: 845|回复: 0

[经验分享] CentOS7.3安装Jumpserver0.3.2

[复制链接]

尚未签到

发表于 2018-4-22 09:15:35 | 显示全部楼层 |阅读模式
公司服务器前端增加堡垒机,选用开源的jumpserver
软件环境
CentOS Linux release 7.3.1611 python 2.7.5 mysql5.7
安装git
yum -y install git
克隆jumpserver
# cd /opt
# git clone https://github.com/jumpserver/jumpserver.git
# git checkout master
注:不要安装在/root、/home 等目录下,以免权限问题由于过程中会要求连接MySQL创建jumpserver数据库,而安装脚本自带的MySQL5.1太老,此处自己编译安装MySQL5.7来使用
安装依赖包保平安
yum install make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel patch wget crontabs libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel unzip tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel xz pcre-devel libticonv.x8664 libticonv-devel.x8664 php-mcrypt libmcrypt libmcrypt-devel mhash mhash-devel libevent libevent-devel libxml2 libxml2-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel vim-minimal nano fonts-chinese
建立MySQL工作目录
[root@centos7 ~]# mkdir -pv /opt/mysql
mkdir: 已创建目录 "/opt/mysql"解压MySQL并进入源码目录
[root@centos7 opt]# cd tools/
[root@centos7 tools]# ll
总用量 141796
-rw-r--r--. 1 root root 83709983 7月  11 13:17 boost_1_59_0.tar.gz
-rw-r--r--. 1 root root 61480982 7月  11 13:17 mysql-boost-5.7.17.tar.gz
[root@centos7 tools]# tar zxf mysql-boost-5.7.17.tar.gz
[root@centos7 tools]# cd mysql-5.7.17/输入以下编译参数
cmake . -DCMAKEINSTALLPREFIX=/opt/mysql -DMYSQLDATADIR=/opt/mysql/data -DSYSCONFDIR=/opt/mysql/conf -DWITHINNOBASESTORAGEENGINE=1 -DWITHARCHIVESTORAGEENGINE=1 -DWITHBLACKHOLESTORAGEENGINE=1 -DMYSQLUNIXADDR=/opt/mysql/mysql.sock -DDEFAULTCHARSET=utf8 -DDEFAULTCOLLATION=utf8generalci -DENABLEDLOCALINFILE=1 -DWITHBOOST=/opt/tools -DENABLEDOWNLOADS=1 -DDOWNLOADBOOST=1 -DWITHMYISAMSTORAGEENGINE=1 -DWITHINNODBMEMCACHED=on
敲回车
等一会儿,看到最后一句 -- Build files have been written to: /opt/mysql-5.7.18 ,哈哈,OK。
PS:这里有个坑,官方文档说的不是很清楚,boost1.59的压缩包下载下来后,-DWITHBOOST的设置为压缩包所在的目录就行,也不用解压,例如我的boost1.59的压缩包放在/opt/tools路径下,我这里就设置为-DWITHBOOST=/opt/tools
编译安装
make -j $(cat /proc/cpuinfo| grep "processor"|wc -l) && make install无惊无险,编译完成,接下来就是要做初始化啦
官方MySQL5.7文档里面有这么一段话:
After installing MySQL, you must initialize the data directory, including the tables in the mysql system database.
在安装MySQL,您必须初始化数据目录,包括MySQL系统数据库中的表。
As of MySQL 5.7.6, use the server to initialize the data directory:
自MySQL 5.7.6起,使用MySQL服务器初始化数据目录:
命令例子
shell> bin/mysqld --initialize --user=mysqlBefore MySQL 5.7.6, use mysqlinstalldb:
在MySQL 5.7.6之前,使用mysqlinstalldb:
命令例子
shell> bin/mysql_install_db --user=mysqlOK,我这里采用的是mysqld --initialize来做初始化,哈哈哈哈哈哈哈~~~~~~~
进入MySQL应用目录
[root@CentOS7 ~]# cd /opt/mysql/
[root@CentOS7 mysql]#./bin/mysqld --initialize --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/data --explicit_defaults_for_timestamp
2017-07-11T06:16:03.379811Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-07-11T06:16:03.662014Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-07-11T06:16:03.729756Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6ae1ad44-6600-11e7-bf9d-000c2908640f.
2017-07-11T06:16:03.734450Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-07-11T06:16:03.736620Z 1 [Note] A temporary password is generated for root@localhost: wiMhO2.wt.-P
[root@centos7 mysql]#拷贝配置文件
cp support-files/my-default.cnf /opt/mysql/conf/my.cnf
编辑配置文件,添加以下内容
[client]
port=3306
socket=/tmp/mysql.sock
default-character-set=utf8
[mysqld]
basedir =/opt/mysql
datadir =/opt/mysql/data
port =3306
server_id =1
socket =/tmp/mysql.sock
bind-address=localhost
#skip-grant-tables拷贝启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
编辑启动脚本,主要编辑basedir、datadir、mysqld_pidfilepath
basedir=/opt/mysql
datadir=/opt/mysql/data
mysqldpidfile_path=/opt/mysql/mysql.pid #这个填不填都可以,启动脚本会自动定义
设置开机启动
chkconfig --add mysqld chkconfig mysqld on
[root@CentOS7 opt]# service mysqld start Starting MySQL. [ 确定 ]
[root@CentOS7 opt]# service mysqld status MySQL running (104746) [ 确定 ]
爽爽爽~~~~~
全局变量 为了直接使用,加到环境变量里,修改/etc/profile文件,在文件末尾添加: export PATH=/opt/mysql/bin:$PATH
source /etc/profile
设置root用户可以远程访问
[root@CentOS7 data]#  mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> set password = password('123456');
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)关闭CentOS7的防火墙,再用第三方数据库管理工具连接测试,OK啦。
[root@CentOS7 html]# systemctl stop firewalld.service
[root@CentOS7 html]# systemctl disable firewalld.serviceMySQL5.7 编译安装完毕
好咧,现在开始嘿嘿嘿~~~~~~~
替换国内pip源
[root@centos7 ~]# mkdir .pip
[root@centos7 ~]# cd .pip/
[root@centos7 .pip]# vim pip.conf
输入以下内容
[global]
index-url = http://mirrors.aliyun.com/pypi/simple
[install]
trusted-host=mirrors.aliyun.com先在数据库里面创建jumpserver数据库
登录mysql
create database jumpserver charset='utf8';
grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by '123456';
我这里是测试安装,密码都很简单,各位同学要是放在生产环境上,密码建议复杂点哦~~
执行jumpserver安装脚本
# cd jumpserver/install
# python install.py其中会遇到个MySQL 库文件缺失的问题提前问题
这个文件在编译的MySQL目录里面,做个软链到/usr/lib64目录下面即可
ln -sv /opt/mysql/lib/libmysqlclient.so.20 /usr/lib64/libmysqlclient.so.20
还有邮件的SMTP端口一定要手动填上,不然会显示邮箱认证失败哦。
最后就是安装脚本会在数据库里面建表,显示安装成功,就可以嗨皮了~~~
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-450268-1-1.html 上篇帖子: Centos 快速搭建ntp服务器 下篇帖子: centos 7 安装python3.6.1
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表