Install SonarQube in the /opt directory on Ubuntu, follow these steps:
-
Update Package List and Install Dependencies:
sudo apt update -y sudo apt install openjdk-11-jdk wget unzip -
Download SonarQube: Visit the SonarQube download page to get the latest version URL or use the command below for a specific version. For example:
wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.6.1.62043.zip -
Extract the Downloaded File:
sudo unzip sonarqube-9.6.1.62043.zip -d /opt -
Create a SonarQube User (Optional but recommended for security):
sudo useradd --system --home /opt/sonarqube --shell /bin/false sonarqube -
Change Ownership of the SonarQube Directory:
sudo chown -R sonarqube:sonarqube /opt/sonarqube-9.6.1.62043 -
Configure SonarQube: Edit the
sonar.propertiesfile to set up SonarQube (e.g., database configuration, web server ports, user & passwd):
sudo vi /opt/sonarqube-9.6.1.62043/conf/sonar.properties -
Create a Systemd Service File: Create a service file for SonarQube to manage it as a systemd service:
sudo vi /etc/systemd/system/sonarqube.serviceAdd the following content:
[Unit] Description=SonarQube After=syslog.target network.target [Service] Type=forking User=sonarqube Group=sonarqube ExecStart=/opt/sonarqube-9.6.1.62043/bin/linux-x86-64/sonar.sh start ExecStop=/opt/sonarqube-9.6.1.62043/bin/linux-x86-64/sonar.sh stop LimitNOFILE=65536 LimitNPROC=8192 Restart=always [Install] WantedBy=multi-user.target -
Reload Systemd and Start SonarQube:
bashCopy codesudo systemctl daemon-reload sudo systemctl start sonarqube sudo systemctl enable sonarqube Access SonarQube at
http://<public IP>:9000
Feel free to share and spread the knowledge! 🌟😊 Enjoy Learning! 😊
Top comments (0)