从来好事天生俭,自古瓜儿苦后甜。这篇文章主要讲述SQL审核平台 Archery 之安装篇相关的知识,希望能为你提供帮助。
一、安装前环境准备
1、更换阿里源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# yum makecache2、配置NTP时间同步(非必须,结合实际情况操作)
[root@localhost ~]# yum -y install chrony
[root@localhost ~]# sed -i "/server/d" /etc/chrony.conf
[root@localhost ~]# echo "server ntp.aliyun.com iburst">
>
/etc/chrony.conf
[root@localhost ~]# systemctl restart chronyd
[root@localhost ~]# date3、关闭 SELINUX、FIREWALLD
[root@localhost ~]# setenforce 0
[root@localhost ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
[root@localhost ~]# systemctl stop firewalld &
&
systemctl disable firewalld
安装说明: ++本次安装是采用 Docker +DockerCompose 的方式++
二、安装 Docker
1、配置依赖和YUM源
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo2、安装 Docker
[root@localhost ~]# yum install -y docker-ce-19.03.11 docker-ce-cli-19.03.11 containerd
[root@localhost ~]# systemctl enable docker &
&
systemctl start docker
[root@localhost ~]# docker --version
Docker version 19.03.11, build 42e35e61f33、修改 Cgroup Driver
[root@localhost ~]# sed -i "s#^ExecStart=/usr/bin/dockerd.*#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --exec-opt native.cgroupdriver=systemd#g" /usr/lib/systemd/system/docker.service4、设置加速器
[root@localhost ~]# vim /etc/docker/daemon.json"registry-mirrors": ["https://registry.docker-cn.com"][root@localhost ~]# systemctldaemon-reload&
&
systemctlrestart docker
三、安装 Docker-Compose
1、下载安装包
[root@localhost ~]# curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose# 如果网络情况不佳,可采用如下的指令进行安装
[root@localhost ~]# curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` >
/usr/local/bin/docker-compose2、配置启动权限
[root@localhost ~]# chmod +x /usr/local/bin/docker-compose
[root@localhost ~]# docker-compose version
docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
Cpython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j20 Nov 2018
四、安装 Archery
1、下载安装包
[root@localhost ~]# wget https://github.com/hhyo/archery/archive/v1.8.0.tar.gz
[root@localhost ~]# tar -zxvf v1.8.0.tar.gz -C /usr/local
[root@localhost ~]# mv /usr/local/Archery-1.8.0 /usr/local/Archery2、启动 Docker-Compose
[root@localhost ~]# cd /usr/local/Archery/src/docker-compose
[root@localhost docker-compose]# docker-compose -f docker-compose.yml up -d(此处时间较长)3、表结构初始化
[root@localhost docker-compose]# docker ps
CONTAINER IDIMAGECOMMANDCREATEDSTATUSPORTSNAMES
a333e364b407redis:5"docker-entrypoint.s…"2 weeks agoUp 23 hours6379/tcpredis
8ec336fb9bd7hanchuanchuan/goinception"/usr/local/bin/dumb…"2 weeks agoUp 23 hours4000/tcpgoinception
c3fe74f742achhyo/archery:1.8.0"dockerize -wait tcp…"2 weeks agoUp 23 hours0.0.0.0:9123->
9123/tcparchery
70f045f968b5mysql:5.7"docker-entrypoint.s…"2 weeks agoUp 23 hours0.0.0.0:3306->
3306/tcp, 33060/tcpmysql
c225ba8127f4hhyo/inception"/bin/sh -c nohup /…"2 weeks agoUp 23 hours6669/tcpinception[root@localhost docker-compose]# docker exec -it c3 bash
[root@c3fe74f742ac archery]# cd /opt/archery/
[root@c3fe74f742ac archery]# ls
admin.shCODE_OF_CONDUCT.mdCONTRIBUTING.mddocsLICENSEmanage.pyrequirements.txtsql_apistartup.shsupervisord.confarcherycommondebug.shdownloads
logsREADME.mdsqlsrcstaticsupervisord.pid[root@c3fe74f742ac archery]# source /opt/venv4archery/bin/activate
(venv4archery) [root@c3fe74f742ac archery]# python3 manage.py makemigrations sql
(venv4archery) [root@c3fe74f742ac archery]# python3 manage.py migrate(venv4archery) [root@c3fe74f742ac archery]# python3 manage.py dbshell<
sql/fixtures/auth_group.sql
(venv4archery) [root@c3fe74f742ac archery]# python3 manage.py dbshell<
src/init_sql/mysql_slow_query_review.sql4、编译翻译文件 (非必须步骤)
(venv4archery) [root@c3fe74f742ac archery]# python3 manage.py compilemessages
processing file django.po in /opt/archery/sql/locale/en/LC_MESSAGES
processing file djangojs.po in /opt/archery/sql/locale/en/LC_MESSAGES
processing file django.po in /opt/archery/sql/locale/zh_Hans/LC_MESSAGES
processing file djangojs.po in /opt/archery/sql/locale/zh_Hans/LC_MESSAGES5、创建管理员用户
(venv4archery) [root@c3fe74f742ac archery]# python3 manage.py createsuperuser
用户名: admin
电子邮件地址: admin@qq.com
Password: admin123( 实际操作中密码是不显示的 )
Password (again): admin123
密码跟 用户名 太相似了。
密码长度太短。密码必须包含至少 9 个字符。
这个密码太常见了。
Bypass password validation and create user anyway? [y/N]: y
Superuser created successfully.
五、浏览器访问测试【SQL审核平台 Archery 之安装篇】
文章图片
推荐阅读
- NoSQL之Redis配置与优化
- 本着什么原则,才能写出优秀的代码()
- #yyds干货盘点# uni-app 模拟机调试环境搭建
- Java NIO Selector 的使用
- 自定义EventSourceEventCounter
- #yyds干货盘点# NPOI在Excel中的简单用法汇总
- # yyds干货盘点 # Python匿名函数lambda x: x-0 and x-1代表的意思是什么...
- #yyds干货盘点# Gradle | allprojects ,根 repositories 区别是什么()
- FFH手把手教你安装Ubuntu到移动介质并设置好UEFI引导