【一】安装
【1.1】系统环境
系统环境:CentOS Linux release 7.6.1708 (Core)
系统内存:4G
系统内核:1
Python:3.6.4
关闭iptables and selinux
本次安装采用的是外部MySQL 5.7

【1.2】关闭 iptables
[root@localhost ~]# systemctl stop firewalld.service //关闭iptables
[root@localhost ~]# systemctl disable firewalld.service //开机 禁止启动 iptables

【1.3】禁用 selinux 以及安装 Python
[root@localhost ~]# vim /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled // 改成 disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

【1.3.1】Python 安装
[root@localhost ~]# cd /root/software
[root@localhost software]# yum -y install zlib-*
[root@localhost software]# wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
[root@localhost software]# tar -zxvf Python-3.6.4.tgz
[root@localhost software]# mkdir -p /usr/local/python3
[root@localhost software]# cd Python-3.6.4/
[root@localhost Python-3.6.4]# ./configure --prefix=/usr/local/python3
[root@localhost Python-3.6.4]# make
[root@localhost Python-3.6.4]# make install
[root@localhost Python-3.6.4]# mv /usr/bin/python /usr/bin/python_bak //修改旧版本
[root@localhost Python-3.6.4]# ln -s /usr/local/python3/bin/python3 /usr/bin/python //创建新的软连接  
[root@localhost Python-3.6.4]# python -V //检查python的版本
Python 3.6.4
[root@localhost Python-3.6.4]# vim ~/.bash_profile //配置成功后,pip3用不了,需要进一步配置将/usr/local/python3/bin加入PATH
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/python3/bin

export PATH

[root@localhost Python-3.6.4]# source ~/.bash_profile // 让环境变量生效

【1.3.2】配置 yum 源 否则 yum 不可用
[root@localhost Python-3.6.4]# yum -y update //显然上面的 except 是python2的写法,当然不能使用默认的Python3来执行了。于是把这个文件第1行的 #!/usr/bin/python 替换成 #!/usr/bin/python2.7
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e: ^
SyntaxError: invalid syntax

[root@localhost Python-3.6.4]# vim /usr/bin/yum
于是把这个文件第1行的 #!/usr/bin/python 替换成 #!/usr/bin/python2.7

【1.4】安装 MySQL
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vim mysql.repos
[mysql5.7-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0

[root@localhost yum.repos.d]# yum -y install mysql-* //等待 安装 执行完成

【1.5】启动MySQL服务 以及 设置开机启动
[root@localhost yum.repos.d]# systemctl start mysqld
[root@localhost yum.repos.d]# systemctl enable mysqld
[root@localhost yum.repos.d]# systemctl daemon-reload

【1.6】查看 mysql 的初始密码
[root@localhost yum.repos.d]# grep 'temporary password' /var/log/mysqld.log
2019-06-25T03:27:20.334210Z 1 [Note] A temporary password is generated for root@localhost: GIutnKkR%7fe

【1.7】登录 mysql 环境做配置以及修改参数
[root@localhost yum.repos.d]# mysql -uroot -pGIutnKkR%7fe //回车进入数据库
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
mysql> set global validate_password_mixed_case_count=2;
mysql> show variables like 'validate_password%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 6 |
| validate_password_mixed_case_count | 2 |
| validate_password_number_count | 1 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 1 |
+--------------------------------------+-------+
7 rows in set (0.02 sec)

mysql> alter user 'root'@'localhost' identified by '123456';
mysql> flush privileges;
mysql> quit;

【1.8】创建 Yearning 数据库 与 用户 和 密码 并且授权
[root@localhost yum.repos.d]# mysql -uroot -p123456
mysql> create database Yearning charset utf8; //创建 Yearning 库
mysql> create user 'Yearning'@'%' identified by 'Yearning'; //创建 Yearning 用户
mysql> grant all on *.* to 'Yearning'@'%' identified by 'Yearning'; //授权 Yearning 用户权限
mysql> flush privileges;
mysql> quit;

【1.9】安装 docker
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2 //安装 docker 的依赖包

【1.9.1】设置yum源
[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

【1.9.2】可以查看所有仓库中所有docker版本,并选择特定版本安装
[root@localhost ~]# yum list docker-ce --showduplicates | sort -r
已加载插件:fastestmirror, langpacks
已安装的软件包
可安装的软件包
* updates: ap.stykers.moe
Loading mirror speeds from cached hostfile
* extras: ftp.sjtu.edu.cn
docker-ce.x86_64 3:18.09.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.6-3.el7 @docker-ce-stable
docker-ce.x86_64 3:18.09.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
* base: ap.stykers.moe

【1.9.3】安装 docker 选择对应的版本
[root@localhost ~]# yum install docker-ce #由于repo中默认只开启stable仓库,故这里安装的是最新稳定版18.03.1.ce
[root@localhost ~]# yum install <FQPN> # 例如:yum install docker-ce-18.03.1.ce
[root@localhost ~]# yum install -y docker-ce-18.03.1.ce //等待安装完成

【1.9.4】启动并加入开机启动
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker

【1.9.5】验证安装是否成功(有client和service两部分表示docker安装启动都成功了)
[root@localhost ~]# docker version
Client:
Version: 18.09.6
API version: 1.39
Go version: go1.10.8
Git commit: 481bc77156
Built: Sat May 4 02:34:58 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.6
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 481bc77
Built: Sat May 4 02:02:43 2019
OS/Arch: linux/amd64
Experimental: false

【二】Inception 及 Yearning安装
【2.1】下载 Yearning 源码
[root@localhost ~]# mkdir -p /root/software
[root@localhost ~]# cd /root/software
[root@localhost software]# git clone https://github.com/cookieY/Yearning.git //获取 git Yearning 源码
[root@localhost software]# cd Yearning/install/yearning-docker-compose/init-sql // 进入 环境 变量下边去
[root@localhost init-sql]# mysql -uYearning -pYearning Yearning < install.sql // 导入 环境变量到数据库里面去

[root@localhost ~]# cd /root/software/Yearning/install/ // cd 到环境目录 解压 inception.tar 包
[root@localhost install]# tar -xvf inception.tar
[root@localhost install]# cd inception/bin/
[root@localhost bin]# mkdir -p /var/log/inception/ // 创建 inception 日志目录
[root@localhost bin]# mkdir -p /var/run/inception/ // 创建 inception.socket 目录
[root@localhost bin]# vim inc.cnf // 修改 inception 配置文件
[inception]
general_log=1
general_log_file=/var/log/inception/inception.log // inception 日志目录
port=6669

socket=/var/run/inception/inc.socket // inception.socket 存储目录
character-set-client-handshake=0
character-set-server=utf8
inception_support_charset=utf8mb4
inception_enable_nullable=0
inception_check_primary_key=1
inception_check_column_comment=1
inception_check_table_comment=1
inception_enable_blob_type=1
inception_check_column_default_value=1
inception_support_charset=utf8
inception_osc_on=OFF
inception_check_column_default_value=OFF
inception_check_column_comment=OFF
inception_check_table_comment=OFF
inception_enable_identifer_keyword=ON
inception_remote_backup_host = 192.168.1.150 // 备份数据库的 IP
inception_remote_backup_port = 3306 // 数据库默认端口
inception_remote_system_user = root // 数据库的权限用户_可根据自己定义
inception_remote_system_password = 123456 // 数据库的用户密码

【2.2】启动 inception 服务
[root@localhost bin]# pwd
/root/software/Yearning/install/inception/bin

[root@localhost bin]# nohup bin/Inception --defaults-file=inc.cnf & // 后台调度启用

【2.3】运行 Yearning 【备注:HOST=本机IP 与 MYSQL_ADDR=本机IP 后面的参数只要是按照本文操作可以不用选择。默认按照我的就行了】
[root@localhost bin]# docker run -d -e HOST=192.168.1.150 -e MYSQL_ADDR=192.168.1.150 -e MYSQL_USER=Yearning -e MYSQL_PASSWORD=Yearning -p8080:80 -p8000:8000 registry.cn-hangzhou.aliyuncs.com/cookie/yearning:v1.3.0

【三】相关配置
【3.1】访问 Yearning
访问Yearning(访问地址为你启动docker的IP地址)
登录管理员缺省值:admin / Yearning_admin

Docker Yearning + Inception SQL审核平台搭建的更多相关文章

  1. Yearning + Inception SQL审核平台搭建

    Yearning 安装: 安装Nginxyum install nginx -y 按照顺序安装MySQLmysql-community-common-5.7.22-1.el6.x86_64.rpmmy ...

  2. Yearning 介绍(SQL审核平台)

    介绍 Yearning SQL 审计平台 基于Vue.js与Django的整套mysql-sql审核平台解决方案.提供基于Inception的SQL检测及执行. GitHub:https://gith ...

  3. SQL审计 Yearning 介绍(SQL审核平台)

    yearning SQL 是一个成熟的SQL审计平台

  4. 基于Inception搭建MySQL SQL审核平台Yearing

    基于Inception搭建MySQL SQL审核平台Yearing Inception 1. Inceptionj简介 2. Inception安装 2.1 下载和编译 2.2 启动配置 Yearni ...

  5. SQL审核平台Yearning部署

    SQL审核平台Yearning部署  Yearning优势: Yearning SQL 审计平台 基于Vue.js与Django的整套mysql-sql审核平台解决方案.提供基于Inception的S ...

  6. Yearning v1.3.0 发布,Web 端 SQL 审核平台

    企业级MYSQL web端 SQL审核平台. Website 官网 www.yearning.io Feature 功能 数据库字典自动生成 SQL查询 查询工单 导出 自动补全,智能提示 查询语句审 ...

  7. Inception SQL审核注解

    Inception SQL审核注解 1.建表语句 建表语句检查项 表属性的检查项 这个表不存在 对于create table like,会检查like的老表是不是存在. 对于create table ...

  8. SQL审核平台-Yearning安装部署实践

    相关文档: https://guide.yearning.io/ yearning简介 http://python.yearning.io/install/  yearning安装 Yearning ...

  9. inception+archery SQL审核平台

    关闭防火墙和selinux 宿主机安装mysql,创建archery数据库,并给所有权限,允许远程连接到该数据库 grant all privileges on *.* to 'root'@'%' i ...

随机推荐

  1. Python 基础之匿名函数 迭代器和高阶函数

    一.匿名函数 lambda表达式 用一句话来表达只有返回值的函数,叫匿名函数特点:简洁方便语法:lambda 参数: 返回值 1.不带有参数的lambda表达式 def func():    retu ...

  2. MVC PartialView使用

    https://blog.csdn.net/mss359681091/article/details/51181037

  3. Firefox中有时使用window.close()脚本无法关闭当前窗口

    解决方法如下: 1.在Firefox浏览器的地址栏中输入about:config,即打开Firefox的配置页面 2.然后搜索dom.allow_scripts_to_close_windows,找到 ...

  4. http请求常见的状态码

    状态码是开发者需要了解的一项内容,日常开发中浏览器会返回给我们一些状态码,然后我们可以根据状态码所代表的含义进行问题解决. 1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态代码. 100 ...

  5. eclipse如何把多个项目放在文件夹下,用文件夹分开不同的项目

    在Package Explorer顶部的右侧有有机表图标按钮,点击倒三角 Top Level Elements->Working Set.此时就会发现,很多项目会自动纳入一个文件夹,这个文件夹的 ...

  6. Mybatis入门(六)联查之多对一

    Mysql可以联查,但Mybatis也可以联查只是没有MySQL联查的舒服需要配置很多文件. 开始搭建环境: MySQL新建两个表一个Student一个Teacher表: Teacher表: CREA ...

  7. java web开发缓存方案,ehcache和redis哪个更好

    Ehcache在java项目广泛的使用.它是一个开源的.设计于提高在数据从RDBMS中取出来的高花费.高延迟采取的一种缓存方案.正因为Ehcache具有健壮性(基于java开发).被认证(具有apac ...

  8. 对于文章的字母、单词、短语,(无用词表)的检索Java代码实现

    日期:2019.5.9 博客期:073 星期四 今天软件工程课上,又做了测试,老师说我们的速度太慢了,实际上我也觉得自己很慢.老师说了这是我们的上一届的大二上半学期学习中的速度,所以呢?意思就是说我们 ...

  9. CentOS7虚拟机配置、Hadoop搭建、wordCount DEMO运行

    安装虚拟机 最开始先安装虚拟机,我是12.5.7版本,如果要跟着我做的话,版本最好和我一致,不然后面可能会出一些莫名其妙的错误,下载链接如下(注册码也在里面了): 链接:https://pan.bai ...

  10. 使用 MYSQLBINLOG 来恢复数据

    使用 MYSQLBINLOG 来恢复数据 2009-04-05 12:47:05 标签:mysql mysqlbinlog 恢复 数据库 数据 原创作品,允许转载,转载时请务必以超链接形式标明文章 原 ...