1.下载依赖包:
yum -y install gcc-c ncurses-devel cmake make perl gcc
autoconf automake zlib libxml libgcrypt libtool
bison
2.替换mysql源
yum list installed | grep mysql
yum -y remove mysql-libs.x86_64
wget
dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum localinstall
mysql-community-release-el6-5.noarch.rpm
yum repolist all | grep mysql
yum -y install yum-utils libyaml-devel
3.剔除mysql5.5,mysql5.6源
yum-config-manager --disable mysql55-community
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr
yum repolist enabled | grep mysql
4.下载安装mysql5.7并开启服务
yum install mysql-community-server
chkconfig mysql on
chkconfig mysqld on
更改mysql配置文件
vim /etc/my.cnf
innodb_buffer_pool_size = 1024M #缓存innodb表的索引
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
default-storage-engine=INNODB #将默认引擎设置为INNODB
query_cache_type=1 #开启mysql 查询缓存
query_cache_size=128M
5.查看mysql随机password
grep "password" /var/log/mysqld.log
6.创建sonarqube的数据库
mysql -uroot -p
mysql> create database sonarqube character set
utf8 collate utf8_bin;
mysql> grant all privileges on sonarqube.* to
sonarqube@localhost identified
by '';
mysql>show engines;
mysql>show variables like
'%storage_engine%';
mysql>show variables like
'%query_cache%';
mysql> quit;
7.解压缩文件,创建目录
unzip sonarqube-5.4
mv sonarqube-5.4 /sonarqube/
8.修改配置文件
vim /sonarqube/conf/sonar.properties
sonar.jdbc.username=sonarqube #数据库账号
sonar.jdbc.password=password #数据库密码
#----- Embedded Database (default)
# H2 embedded database server listening port, defaults to
9092
#sonar.embeddedDatabase.port=9092
#----- MySQL 5.x
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported. It can not be
changed.
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance #数据库位置
sonar.web.host=0.0.0.0
sonar.web.port=9000 #端口
/sonarqube/bin/linux-x86-64/sonar.sh
start #启动服务
9.查看数据库检查服务是否安装成功
mysql -uroot -p
mysql> use sonarqube;
mysql> show tables;
mysql> show columns from widgets;
10.下载中文包到plugins下
mv sonar-l10n-zh-plugin-1.9.jar /sonarqube/extensions/plugins/
11.重启服务
/sonarqube/bin/linux-x86-64/sonar.sh
restart
账号:admin
密码:admin