Please find steps for installing SonarQube on a Ubuntu VM running in Azure Cloud. SonarQube is open source, Java based tool along with backend, Database can be MySQL, Oracle
or PostgreSQL. We will use PostgreSQL which is open source for database with SonarQube installation.
Pre-requistes:
Make sure port 9000 is opened as port 9000 is default port for SonarQube.
Ubuntu 16.0.4 instance at least 2 GM RAM
How to open port 9000 in Azure VM?
1. Select VM, under Settings--> choose Network
2. Click on Add inbound security role
3. Make sure you add entries like below:
9000 as Destination port ranges
TCP as protocol
310 as priority number
port_9000 as Name
4. Click on Add, once you add it should be like below:
Let us start with java installation on Azure VM.
1. Java 8 Installation steps
2. PostgreSQL Installation
PostgreSQL is a popular open source database tool.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/
sudo wget -q https://www.postgresql.org/med ia/keys/ACCC4CF8.asc -O - | sudo apt-key add -
sudo apt-get -y install postgresql postgresql-contrib
sudo systemctl start postgresql
sudo systemctl enable postgresql
Login as postgres user now
sudo su - postgres
Now create a user below
sudo su - postgres
Now create a user below
3. Now install SonarQube Web App
sudo wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-6.4.zip
Extract SonarQube Zip file
sudo apt-get -y install unzip
sudo unzip sonarqube-6.4.zip -d /opt
Re-name the folder
sudo mv /opt/sonarqube-6.4 /opt/sonarqube -v
Modify Sonar configuration file
sudo vi /opt/sonarqube/conf/sonar.prop
uncomment the below lines by removing # and add values highlighted yellow
sonar.jdbc.username=sonar
sonar.jdbc.password=password
Next, Add the below line for PostgreSQL
sonar.jdbc.url=jdbc:postgresql
Now press escape, and enter :wq! to come out of the above screen.
Create Sonar as a service
Execute the below command (and add the below code in green color)
sudo vi /etc/systemd/system/sonar.serv
[Unit]
Description=SonarQube service
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/opt/sonarqube/bin/l
ExecStop=/opt/sonarqube/bin/li
User=root
Group=root
Restart=always
[Install]
WantedBy=multi-user.target
Once copied, enter :wq! and enter to come out of the screen.
Now perform the below commands
sudo systemctl enable sonar
sudo systemctl start sonar
sudo systemctl status sonar
tail -f /opt/sonarqube/logs/sonar.log
Press Contrl-C to come out of the above window.
Make sure you get the below message that says Sonarqube is up..
sudo systemctl start sonar
sudo systemctl status sonar
type q now to come out of this mode.
Now execute the below command to see if Sonarqube is up and running. This may take a few minutes.
tail -f /opt/sonarqube/logs/sonar.log
Press Contrl-C to come out of the above window.
Make sure you get the below message that says Sonarqube is up..
You should be able to login to SonarQube using default credentials --> admin/admin
No comments:
Post a Comment