yum install -y wget unzip
https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.8.zip
unzip -d /usr/local/ sonarqube-7.8.zip
tar -xvf mysql-5.7.36-el7-x86_64.tar.gz
mv mysql-5.7.36-el7-x86_64 /usr/local
ll
cd /usr/local/
ll
ln -s mysql-5.7.36-el7-x86_64/ mysql-5.7.36
ln -s mysql-5.7.36 mysql
groupadd mysql
useradd -r -g mysql mysql
cd /
mkdir -p data
cd data/
mkdir -p mysql
cd ../
cd data/
chown mysql:mysql -R /data/mysql
vim /etc/my.cnf
复制下方内容
[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
basedir=/usr/local/mysql-5.7.36
datadir=/data/mysql
socket=/tmp/mysql.sock
log-error=/data/mysql/mysql.err
pid-file=/data/mysql/mysql.pid
#character config
character_set_server=utf8mb4
symbolic-links=0
初始化
cd /usr/local/mysql-5.7.36/bin/
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql-5.7.36/ --datadir=/data/mysql/ --user=mysql --initialize
获取root密码
vim /data/mysql/mysql.err
里面root @ xxxxx
启动mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chkconfig --add mysql
chkconfig --list mysql
cd /var/log/
mkdir mariadb
cd mariadb/
vi mariadb.log
:wqchown -R mysql:mysql /var/log/mariadb/mariadb.log
yum install initscripts -y
ln -s /usr/local/mysql/bin/mysql /usr/bin
service mysql start
mysql -u root -p
输入密码后更新password,并刷新权限
mysql>
SET PASSWORD = PASSWORD('123456');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
use mysql;
update user set Host = '%' where User = 'root';
flush privileges;
以上mysql已安装完成;以下为sonar的操作:
创建名称为sonar的database
create database sonar;
exit;
vim /usr/local/sonarqube-7.8/conf/sonar.properties
sonar.jdbc.username=root
sonar.jdbc.password=123456
sonar.jdbc.url=xxxxx(修改)
:wq
保存
vim /etc/security/limits.conf
在尾部添加以下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 65535
* hard nproc 65535
vim /etc/sysctl.conf
在尾部添加以下内容:
vm.max_map_count=655360
让配置生效
sysctl -p
useradd sonar
chown -R sonar:sonar /usr/local/sonarqube-7.8/
启动
su - sonar /usr/local/sonarqube-7.8/bin/linux-x86-64/sonar.sh start
查看状态
su - sonar /usr/local/sonarqube-7.8/bin/linux-x86-64/sonar.sh status
停止
su - sonar /usr/local/sonarqube-7.8/bin/linux-x86-64/sonar.sh stop
下载好对应的插件jar包:sonar-l10n-zh-plugin-1.28.jar,上传到对应的目录下:/usr/local/sonarqube-7.8/extensions/plugins,然后重启sonarqube
https://github.com/xuhuisheng/sonar-l10n-zh/releases 版本1.28
https://github.com/checkstyle/sonar-checkstyle 版本4.27
https://github.com/SEPMLAB/CodeHawk/releases 版本V1.0
https://github.com/spotbugs/sonar-findbugs/ 版本4.0.0