Skip to content

Commit 04bd5be

Browse files
authored
SonarQube installation updated file
1 parent f655728 commit 04bd5be

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

SonarQube/SonarQube_Installation.MD

+36-38
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,88 @@
1-
## ------ SonarQube Installation ------
1+
# SonarQube Installation
22

3-
To install SonarQube we need an Linux EC2 instance which is installed MySQL otherwise Launch MySQL RDS instance to acomplish this
3+
SonarQube provides the capability to not only show health of an application but also to highlight issues newly introduced. With a Quality Gate in place, you can fix the leak and therefore improve code quality systematically.
4+
### Follow this Artical in **[YouTube](https://www.youtube.com/watch?v=zRQrcAi9UdU)**
45

5-
1. Launch an MySQL RDS Database Instance (It takes few minutes)
6+
### Prerequisites
7+
1. EC2 instance with Java installed
8+
1. MySQL Database Server or MyQL RDS instance. **[Get help here](https://www.youtube.com/watch?v=vLaW6b441x0)**
69

7-
2. Launch an EC2 instance and Install MySQL client version
10+
### Installation
811

9-
```sh
10-
# yum install mysql
11-
```
12-
13-
3. Install java
14-
```sh
15-
# yum install java-1.8.0-openjdk -y
16-
```
17-
4. Download stable SonarQube version from below website.
18-
website: https://www.sonarqube.org/downloads/
12+
Install MySQL client version
1913

20-
Note: for this video I have downloaded version 6.0 : https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.0.zip
14+
```sh
15+
# yum install mysql
16+
```
17+
Download stable SonarQube version from below website.
18+
- Website: https://www.sonarqube.org/downloads/
19+
- Note: This Artical written for SonarQube6.0
2120

22-
5. download & unzip it to Linux EC2 instance
21+
Download & unzip SonarQube 6.0
2322
```sh
2423
# cd /opt
2524
# wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.0.zip
2625
# unzip sonarqube-6.0.zip
2726
# mv /opt/sonarqube-6.0 /opt/sonar
2827
```
29-
6. Allow RDS instance security group to access SonarQube server
28+
Allow RDS instance security group to access SonarQube server
3029

31-
7. Connect to RDS instance
30+
Connect to RDS instance with database credentials
3231
```sh
33-
mysql -h <RDS_Instance_endpoint>:3306 -u sonardb -p
32+
mysql -h <RDS_Instance_endpoint>:3306 -u <DB_USER_NAME> -p <DB_PASSWORD>
3433
```
35-
36-
8. Create a new sonar database
34+
Create a new sonar database
3735
```sh
3836
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
3937
```
4038

41-
9. Create a local and a remote user
39+
Create a local and a remote user
4240
```sh
4341
CREATE USER sonar@localhost IDENTIFIED BY 'sonar';
4442
CREATE USER sonar@'%' IDENTIFIED BY 'sonar';
4543
```
4644

47-
10. Grant database access permissions to users
45+
Grant database access permissions to users
4846
```sh
4947
GRANT ALL ON sonar.* TO sonar@localhost;
5048
GRANT ALL ON sonar.* TO sonar@'%';
5149
```
5250

53-
11. check users and databases
51+
check users and databases
5452
```sh
5553
use mysql
5654
show databases;
5755
SELECT User FROM mysql.user;
5856
FLUSH PRIVILEGES;
5957
QUIT
6058
```
61-
### ------ On EC2 Instance ------
59+
So for you have configured required database information on RDS. Lets Jump back to your EC2 instance and eanble SonarQube properites file to connect his Database.
6260

63-
12. edit SonarQube properties file
64-
```sh
65-
# vi /opt/sonar/conf/sonar.properties
66-
sonar.jdbc.username=sonar
67-
sonar.jdbc.password=sonar
68-
mysql://<MySQL_Database_Server>:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
69-
sonar.web.host=0.0.0.0
70-
sonar.web.context=/sonar
61+
Edit SonarQube properties file
7162

72-
```
63+
- File Name: /opt/sonar/conf/sonar.properties
64+
- sonar.jdbc.username=`sonar`
65+
- sonar.jdbc.password=`sonar`
66+
- mysql:`<MySQL_Database_Server>:3306`/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
67+
- sonar.web.host=`0.0.0.0`
68+
- sonar.web.context=`/sonar`
7369

74-
13. Start SonarQube service
70+
Start SonarQube service
7571
```sh
7672
# cd /opt/sonar/bin/linux-x86-64/
7773
# ./sonar.sh start
7874
```
7975

8076
##### Optional
8177

82-
14. Implement SonarQube server as a service
78+
Implement SonarQube server as a service
8379
```sh
8480
Copy sonar.sh to etc/init.d/sonar and modify it according to your platform.
8581
# sudo cp /opt/sonar/bin/linux-x86-64/sonar.sh /etc/init.d/sonar
8682
# sudo vi /etc/init.d/sonar
8783
```
8884

89-
15. add below values to your /etc/init.d/sonar file
85+
Add below values to your /etc/init.d/sonar file
9086
```sh
9187
Insert/modify below values
9288
SONAR_HOME=/opt/sonar
@@ -97,7 +93,7 @@ WRAPPER_CONF="${SONAR_HOME}/conf/wrapper.conf"
9793
PIDDIR="/var/run"
9894
```
9995

100-
16. Run SonarQube server
96+
Start SonarQube server
10197
```sh
10298
# service sonar start
10399
```
@@ -106,3 +102,5 @@ PIDDIR="/var/run"
106102

107103
1. Check whether you enabled port 9000 in EC2 instance security group
108104
2. Check whether you enabled EC2 instance IP range in RDS security group
105+
106+

0 commit comments

Comments
 (0)