ubuntu16.04 Configuration Sonarqube+mysql

Source: Internet
Author: User
Tags install php mysql create wrapper

Environment:

[Email protected]:~# uname-alinux ubuntu 4.4.0-21-generic #37-ubuntu SMP Mon Apr 18:33:37 UTC x86_64 x86_64 x86_6 4 Gnu/linux[email protected]:~# [email protected]:~# cat/etc/issueubuntu 16.04 LTS \ \l[email protected]:~#

Install the configuration MySQL:

1. Update source

[Email protected]:~# apt-get Update

2. Install MySQL

[Email protected]:~# apt-get install-y Mysql-server mysql-client# There will be a root user to add a password, you can add or ignore

3. Start MySQL

[Email protected]:~# systemctl start mysql[email protected]:~# ps-ef|grep mysqlmysql 11268 1 0 15:58? 00:00:00/usr/sbin/mysqldroot 11362 4143 0 16:00 pts/0 00:00:00 grep--color=auto mysql[email protected]:~# netst  At-lntup|grep mysqltcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 11268/mysqld [email protected]:~#

4. Install PHP support MySQL module

[Email protected]:~# apt-get Install Php5-mysql

Error occurred:

[Email protected]:~# apt-get Install php5-mysqlreading package lists ... Donebuilding Dependency Tree Reading state information ... Donepackage Php5-mysql are not available, but are referred to by another package. This may mean. The package is missing, have been obsoleted, Oris only available from another sourcee:package ' Php5-mys QL ' has no installation candidate[email protected]:~#

Workaround One:

[Email protected]:~# apt-get update #更新源 [email protected]:~# apt-get Upgrade #升级包

If it still doesn't work, try adding a third-party address.

Workaround Two:

[Email protected]:~# add-apt-repository "Deb http://archive.canonical.com/lucid partner" [Email protected]:~# apt-get Update

Workaround Three:

[Email protected]:~# tail-3/etc/apt/sources.listdeb http://mirrors.163.com/ubuntu/hardy main Universedeb/http Tw.archive.ubuntu.com/ubuntu/hardy main universe[email protected]:~# apt-get update

Installing Sonarqube

1. Log in to MySQL create sonar database and user

mysql> create database sonar default  character set utf8 collate utf8_general_ci; query ok, 1 row affected  (0.00 sec) mysql>mysql> create user   ' sonar '  IDENTIFIED BY  ' sonar ';   query ok, 0 rows affected   (0.10 sec) mysql> grant all on sonar.* to  ' sonar ' @ '% '   identified by  ' sonar ';   query ok, 0 rows affected, 1 warning   (0.00 sec) mysql> grant all on sonar.* to  ' sonar ' @ ' localhost '   identified by  ' sonar ';   query ok, 0 rows affected, 1 warning   (0.00 SEC) mysql> flush privileges; query ok, 0 rows affected   (0.00 sec) Mysql> 

2. Download sonarqube-5.3 and Sonar-scanner

[Email protected]:~# cd/etc[email protected]:/etc# wget #在此地下载Scanner, then upload
[Email protected]:/etc# apt-get install lrzsz #没有上传下载工具的可以用此命令安装 [email protected]:/etc# ll *.zip #查看下载好的两个包-rw-r--r--1 Root root 111318629 Jan 8 sonarqube-5.3.zip-rw-r--r--1 root root 499181 Mar 19:44 sonar-scanner-cli-2.9.0.6 70.zip[email protected]:/etc#

3. Extract to the specified directory

[Email protected]:/etc# mkdir/usr/sonar[email protected]:/etc# cd/usr/sonar[email protected]:/usr/sonar# unzip/etc/ Sonarqube-5.3.zip[email protected]:/usr/sonar# Unzip/etc/sonar-scanner-cli-2.9.0.670.zip[email protected]:/usr/ sonar# lssonarqube-5.3 sonar-scanner-2.9.0.670[email protected]:/usr/sonar#[email protected]:/usr/sonar# apt-get Install unzip #有的人没有这个解压工具, can be installed with this command

4. Configure environment variables and add sonar_runner_home variable to path

[Email protected]:/usr/sonar# sudo tail-2/etc/profileexport sonar_home= "/usr/sonar/sonarqube-5.3/" Export SONAR_ Runner_home= "/usr/sonar/sonar-scanner-2.9/" [email protected]:/usr/sonar#. /etc/profile[email protected]:/usr/sonar#

5. Modify the configuration file

[Email protected]:/usr/sonar# pwd/usr/sonar[email protected]:/usr/sonar# grep "^[a-z]" sonarqube-5.3/conf/ Sonar.properties sonar.jdbc.username=sonar #数据库名sonar. Jdbc.password=sonar #密码sonar. jdbc.url=jdbc:mysql:// localhost:3306/sonar?useunicode=true&characterencoding=utf8&rewritebatchedstatements=true& Useconfigs=maxperformance[email protected]:/usr/sonar#
[Email protected]:/usr/sonar# grep "^[a-z]" sonar-scanner-2.9/conf/sonar-scanner.properties sonar.jdbc.username= Sonar Sonar.jdbc.password=sonar sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useunicode=true& Characterencoding=utf8&rewritebatchedstatements=true&useconfigs=maxperformance[email protected]:/usr/ sonar#

6. Operation

[Email protected]:/usr/sonar# cd Sonarqube-5.3/bin/linux-x86-64/[email protected]:/usr/sonar/sonarqube-5.3/bin/ linux-x86-64#./sonar.sh startstarting SonarQube ... Failed to start SonarQube. [Email protected]:/usr/sonar/sonarqube-5.3/bin/linux-x86-64#./sonar.sh Statussonarqube is not running. [Email protected]:/usr/sonar/sonarqube-5.3/bin/linux-x86-64#

You can see the error because Java is missing, that is, there is no installation of jdk1.8

Installing Java

1. Download

[Email protected]:/usr/sonar/sonarqube-5.3/bin/linux-x86-64# cd/usr/local/src/
[Email protected]:/usr/local/src# lsjdk-8u121-linux-x64.tar.gz[email protected]:/usr/local/src#

2. Decompression

[Email protected]:/usr/local/src# tar xf jdk-8u121-linux-x64.tar.gz[email protected]:/usr/local/src# mkdir. /java[email protected]:/usr/local/src# MV jdk1.8.0_121. /java/

3. Setting the JDK environment variable

[Email protected]:/usr/local/src# tail-4/etc/bash.bashrcexport Java_home=/usr/local/java/jdk1.8.0_121export JRE_ Home=${java_home}/jreexport classpath=.:${java_home}/lib:${jre_home}/lib Export path=${java_home}/bin: $PATH [email Protected]:/usr/local/src#. /etc/bash.bashrc[email protected]:/usr/local/src#

4. Whether the test is successful

[Email protected]:/usr/local/src# java-versionjava Version "1.8.0_121" Java (TM) SE Runtime Environment (build 1.8.0_121- B13) Java HotSpot (TM) 64-bit Server VM (build 25.121-b13, mixed mode) [email protected]:/usr/local/src#

5. Continue to run sonar

[email protected]:/usr/sonar/sonarqube-5.3/bin/linux-x86-64# pwd/usr/sonar/sonarqube-5.3/bin/ Linux-x86-64[email protected]:/usr/sonar/sonarqube-5.3/bin/linux-x86-64# [email protected]:/usr /sonar/sonarqube-5.3/bin/linux-x86-64# ./sonar.sh startstarting sonarqube ... Started sonarqube. [Email protected]:/usr/sonar/sonarqube-5.3/bin/linux-x86-64# ./sonar.sh statussonarqube is  running  (14033). [email protected]:/usr/sonar/sonarqube-5.3/bin/linux-x86-64# ps -ef|grep sonarroot      14033     1  0 13:13 ?         00:00:00 /usr/sonar/sonarqube-5.3/bin/linux-x86-64/./wrapper /usr/ sonar/sonarqube-5.3/bin/linux-x86-64/. /.. /conf/wrapper.conf wrapper.syslog.ident=sonarqube wrapper.pidfile=/usr/sonar/sonarqube-5.3/bin/ Linux-x86-64/./sonarqube.pid wrapper.daemonize=true wrapper.lockfile=/var/lock/subsys/sonarquberoot     14035 14033  6  13:13 ?        00:00:01 java -djava.awt.headless=true  -XMS3M -XMX3M -DJAVA.LIBRARY.PATH=./LIB -CLASSPATH&NBSP, .... /.. /lib/jsw/wrapper-3.2.3.jar:.. /.. /lib/sonar-application-5.3.jar -dwrapper.key=rld1zl2zq9qqdist -dwrapper.port=32000 - dwrapper.jvm.port.min=31000 -dwrapper.jvm.port.max=31999 -dwrapper.pid=14033 -dwrapper.version= 3.2.3 -dwrapper.native_library=wrapper -dwrapper.service=true -dwrapper.cpu.timeout=10 - dwrapper.jvmid=1 org.tanukisoftware.wrapper.wrappersimpleapp org.sonar.application.approot      14060 14035 45 13:13 ?         00:00:12 /usr/local/java/jdk1.8.0_121/jre/bin/java -djava.awt.headless=true -xmx1g - xms256m -xss256k -dJAVA.NET.PREFERIPV4STACK=TRUE -XX:+USEPARNEWGC -XX:+USECONCMARKSWEEPGC -XX: Cmsinitiatingoccupancyfraction=75 -xx:+usecmsinitiatingoccupancyonly -xx:+heapdumponoutofmemoryerror  -Djava.io.tmpdir=/usr/sonar/sonarqube-5.3/temp -cp ./lib/common/*:./lib/search/*  org.sonar.search.searchserver /tmp/sq-process4748582369994525447propertiesroot      14164 14035 99 13:13 ?        00:00:36  /usr/local/java/jdk1.8.0_121/jre/bin/java -djava.awt.headless=true -dfile.encoding=utf-8 - DJRUBY.MANAGEMENT.ENABLED=FALSE -DJRUBY.COMPILE.INVOKEDYNAMIC=FALSE -XMX768M -XMS256M -XX: maxpermsize=160m -xx:+heapdumponoutofmemoryerror -djava.net.preferipv4stack=true - djava.io.tmpdir=/usr/sonar/sonarqube-5.3/temp -cp ./lib/common/*:./lib/server/*:/usr/sonar/ Sonarqube-5.3/lib/jdbc/mysql/mysql-connector-java-5.1.35.jar org.sonar.server.app.webserver /tmp/sq-process8773907296141005182propertiesroot      14206 13703  0 13:14 pts/3    00:00:00 grep -- color=auto sonar[email protected]:/usr/sonar/sonarqube-5.3/bin/linux-x86-64#

6. Browser View

Http://localhost:9000/


650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/8E/F9/wKioL1jQuGyBI_qFAACiR220agg144.png-wh_500x0-wm_ 3-wmp_4-s_45866955.png "title=" 7882278422@chatroom_1490073645191_6.png "alt=" Wkiol1jqugybi_ Qfaacir220agg144.png-wh_50 "/>

















This article is from the "11853547" blog, please be sure to keep this source http://11863547.blog.51cto.com/11853547/1908740

ubuntu16.04 Configuration Sonarqube+mysql

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.