kaili系统部署sonarqube
1、先查看下kali版本
root@kali:~# uname -a Linux kali 5.5.0-kali2-amd64 #1 SMP Debian 5.5.17-1kali1 (2020-04-21) x86_64 GNU/Linux
2、添加Docker PGP key:
curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -
3、配置Docker APT repository:
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/ buster stable' | sudo tee /etc/apt/sources.list.d/docker.list
4、更新apt
sudo apt-get update
5、以防万一,先卸载旧版本docker
sudo apt-get remove docker docker-engine docker.io
6、安装docker
sudo apt-get install docker-ce
7、查看docker状态
sudo systemctl status docker
8、如果docker没启动,启动服务
sudo systemctl start docker
9、设置docker开机自启动
sudo systemctl enable docker
10、拉取sonarqube镜像
docker pull sonarqube
11、安装mysql
#安装MySQL docker pull mysql:5.7
#启动MySQL服务 docker run -p 3307:3306 --name mysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
#查看镜像 root@kali:/home/ben# docker images REPOSITORY TAG IMAGE ID CREATED SIZE sonarqube latest 2b31ca37355b 9 days ago 457MB mysql 5.7 f965319e89de 11 days ago 448MB
#查看运行的容器 root@kali:/home/ben# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b0c5256dab7e mysql:5.7 "docker-entrypoint.s…" 17 hours ago Up 16 hours 33060/tcp, 0.0.0.0:3307->3306/tcp mysql
#进入MySQL容器 root@kali:/home/ben# docker exec -it b0c5256dab7e bash root@b0c5256dab7e:/# mysql -u root -p
#执行以下命令建立数据库 CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'sonar' IDENTIFIED BY 'sonar'; GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar'; GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar'; FLUSH PRIVILEGES;
12、启动sonarqube服务
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 --link=mysql:mysql -e SONARQUBE_JDBC_USERNAME=sonar -e SONARQUBE_JDBC_PASSWORD=sonar -e SONARQUBE_JDBC_URL="jdbc:mysql://192.168.152.177:3307/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false" sonarqube:7.4-community
本文版权归本博作者所有,允许转载,但未经作者同意必须保留此段声明,且在文章明显位置给出原文链接,否则保留追究法律责任的权利。