yum install -y java-1.8.0

[root@linux-node1 ~]# cd /etc/yum.repos.d/
[root@linux-node1 yum.repos.d]# wget http://pkg.jenkins.io/redhat/jenkins.repo
[root@linux-node1 ~]# rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key
[root@linux-node1 ~]# yum install -y jenkins
[root@linux-node1 ~]# systemctl start jenkins

centos 7 change jenkins start port
http://stackoverflow.com/questions/15265277/how-to-start-jenkins-on-different-port-rather-than-8080-using-command-prompt-in

[root@node2 conf]# egrep -v "^$|^#" /etc/sysconfig/jenkins
JENKINS_HOME="/var/lib/jenkins"
JENKINS_JAVA_CMD=""
JENKINS_USER="jenkins"
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
JENKINS_PORT="8082"
JENKINS_LISTEN_ADDRESS=""
JENKINS_HTTPS_PORT=""
JENKINS_HTTPS_KEYSTORE=""
JENKINS_HTTPS_KEYSTORE_PASSWORD=""
JENKINS_HTTPS_LISTEN_ADDRESS=""
JENKINS_DEBUG_LEVEL="5"
JENKINS_ENABLE_ACCESS_LOG="no"
JENKINS_HANDLER_MAX="100"
JENKINS_HANDLER_IDLE="20"
JENKINS_ARGS=""


sonar

[root@linux-node2 ~]# yum install -y java-1.8.0
[root@linux-node2 ~]# cd /usr/local/src
wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-5.6.zip
[root@linux-node2 src]# unzip sonarqube-5.6.zip
[root@linux-node2 src]# mv sonarqube-5.6 /usr/local/
[root@linux-node2 src]# ln -s /usr/local/sonarqube-5.6/ /usr/local/sonarqube

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar@pw';
 GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar@pw';
FLUSH PRIVILEGES;

error when loading some lib 上次是因为32位和64位的问题,装了一个i386的软件包

下次记得看mysql的日志,毕竟从5.5升级到了5.7但是数据库文件还是之前的,
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid




mysql> SHOW VARIABLES LIKE 'character%';
ERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist
mysql_upgrade  --force
systemctl restart mysqld


sonar 分析什么语言就要装对应的插件


/usr/local/src
wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-2.8.zip



[root@node2 sonarqube-scanner]# ls
copybooks  coverage-report  sonar-project.properties  src
要有这个sonar-project.proerties这个文件
[root@node2 sonarqube-scanner]# vim sonar-project.properties  
[root@node2 sonarqube-scanner]# pwd
/root/sonar-scanning-examples-master/sonarqube-scanner
[root@node2 sonarqube-scanner]# /usr/local/sonar-scanner/bin/sonar-scanner
然后就可以在
http://192.168.3.4:9000/dashboard/index?did=2
这里面看了

Build Pipeline Plugin

把jpi文件放到这个目录下,然后chown 就可以了
[root@node2 plugins]# pwd
/var/lib/jenkins/plugins

Build Authorization Token Root Plugin

gitlab hook

[root@node2 ~]# openssl rand -hex 10
22fb375fd0a7b7ff566c

http://192.168.3.4:8082/project/demo-sonar



http://192.168.3.4:8082/buildByToken/build?job=demo-sonar&token=22fb375fd0a7b7ff566c


[root@node2 sonarqube-scanner]# cat sonar-project.properties |egrep -v '^$|^#'
sonar.projectKey=demo
sonar.projectName=demo
sonar.projectVersion=1.0
sonar.sources=./
sonar.sourceEncoding=UTF-8