All about SonarQube Server & It’s Installation …..

SonarQube is an open-source quality management platform that analyzes and measures code’s technical quality. It enables developers to detect code issues, vulnerabilities, and bugs in the early stages.

The pre-requisite for SW is Java

Pre-requisite for SW is 2G of RAM and 1GB for OS

Reference: https://docs.sonarqube.org/7.6/requirements/requirements/

  • Change the Instance type to t2.medium from t2.micro ( as per HW requirement medium type instance is of 3GB while micro type is 1GB)
  • Connect to the EC2 instance
  • Check OS java version also check HW requirement.

$ uname

$ java -version

$ free -h

  • Login as a root user.

$ sudo su –

$ cd /opt/ (all 3rd party sw should be in opt)

$ yum install wget unzip -y

$ wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.6.zip

$ unzip sonarque-7.6.zip

  • As a good security practice, sonarqube is not advised to run service as a root user, so create a new user as sonar.

$ adduser sonar

$ visudo (to give sudo access for this user with no password)

$ sonar ALL=(ALL) NOPASSWD:ALL

$ chown -R sonar:sonar /opt/sonarqube-7.6/ (change the ownership)

$ chmod -R 775 /opt/sonarqube-7.6/ (now change the permission)

$ su — sonar (now switch to sonar user)

$ cd /opt/sonarqube-7.6

$ cd /bin/ (to start SonarQube server go to bin directory)

$ cd linux-x86–64

$ ./sonar.sh start (then run the inside .sh script)

$ ./sonar.sh status (to check the status)

$ cd../../logs/ (check logs if required)

  • connect using http://localhost:9000
  • in case its fails then just change the inbound port number (all tcp, 0–65535, any were & save)
  • now connect with default admin as a user & admin as a password.

Imran is a technologist, he had started his career as a Telecom expert but now recently he became a cloud architect focused mainly on Cloud Services & DevOps.