1 | initial version |
Steps - works for Ubuntu 18.04 but also should work for newer Ubuntu Versions:
Initial SonarQube Installation:
/opt/sonarqube
.Java Version Correction:
Elasticsearch Root Issue:
root
user.User Configuration for SonarQube:
sonar
.sonar
user and group.sonar
user and group.Starting SonarQube:
systemctl start sonar.service
.By addressing the Java version discrepancy and ensuring that Elasticsearch does not run as the root user, SonarQube was able to start up and operate correctly on the system.
Initial SonarQube Installation:
Assuming you've downloaded and extracted SonarQube:
wget <SonarQube download link>
tar -xzvf <SonarQube archive>
mv <SonarQube extracted folder> /opt/sonarqube
Java Version Correction:
SonarQube requires Java 17. You installed it and set it as default:
sudo apt install openjdk-17-jdk
sudo update-alternatives --config java
You chose Java 17 from the list to set it as default.
Elasticsearch Root Issue:
Elasticsearch should not be run as root
. This means SonarQube shouldn't be run as root
either.
User Configuration for SonarQube:
Create a dedicated system user named sonar
:
sudo adduser --system --no-create-home --group sonar
Change ownership of the SonarQube directory:
sudo chown -R sonar:sonar /opt/sonarqube
Modify the SonarQube systemd service file:
Open the file:
sudo nano /etc/systemd/system/sonar.service
Add/modify the User
and Group
directives:
```
[Service]
User=sonar
Group=sonar
[Unit] Description=SonarQube service After=syslog.target network.target
[Service] Type=simple User=sonar Group=sonar ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh console ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop Restart=always
[Install] WantedBy=multi-user.target ```
Reload systemd:
sudo systemctl daemon-reload
Starting SonarQube:
sudo systemctl start sonar.service
With these adjustments, SonarQube should be running correctly on your Ubuntu 22.04 machine. Remember, many of these steps are crucial not just for functionality but also for maintaining a secure deployment of SonarQube and Elasticsearch. Always avoid running services as root
unless absolutely necessary.
2 | No.2 Revision |
Steps - works for Ubuntu 18.04 but also should work for newer Ubuntu Versions:
Initial SonarQube Installation:
/opt/sonarqube
.Java Version Correction:
Elasticsearch Root Issue:
root
user.User Configuration for SonarQube:
sonar
.sonar
user and group.sonar
user and group.Starting SonarQube:
systemctl start sonar.service
.By addressing the Java version discrepancy and ensuring that Elasticsearch does not run as the root user, SonarQube was able to start up and operate correctly on the system.
Initial SonarQube Installation:
Assuming you've downloaded and extracted SonarQube:
wget <SonarQube download link>
tar -xzvf <SonarQube archive>
mv <SonarQube extracted folder> /opt/sonarqube
Java Version Correction:
SonarQube requires Java 17. You installed it and set it as default:
sudo apt install openjdk-17-jdk
sudo update-alternatives --config java
You chose Java 17 from the list to set it as default.
Elasticsearch Root Issue:
Elasticsearch should not be run as root
. This means SonarQube shouldn't be run as root
either.
User Configuration for SonarQube:
Create a dedicated system user named sonar
:
sudo adduser --system --no-create-home --group sonar
Change ownership of the SonarQube directory:
sudo chown -R sonar:sonar /opt/sonarqube
Modify the SonarQube systemd service file:
Open the file:
sudo nano /etc/systemd/system/sonar.service
Add/modify the User
and Group
directives:
```
directives:
```bash [Service] User=sonar Group=sonar
[Unit] Description=SonarQube service After=syslog.target network.target
[Service] Type=simple User=sonar Group=sonar ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh console ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop Restart=always
[Install] WantedBy=multi-user.target ```
Reload systemd:
sudo systemctl daemon-reload
Starting SonarQube:
sudo systemctl start sonar.service
With these adjustments, SonarQube should be running correctly on your Ubuntu 22.04 machine. Remember, many of these steps are crucial not just for functionality but also for maintaining a secure deployment of SonarQube and Elasticsearch. Always avoid running services as root
unless absolutely necessary.
3 | No.3 Revision |
Steps - works for Ubuntu 18.04 but also should work for newer Ubuntu Versions:
Initial SonarQube Installation:
/opt/sonarqube
.Java Version Correction:
Elasticsearch Root Issue:
root
user.User Configuration for SonarQube:
sonar
.sonar
user and group.sonar
user and group.Starting SonarQube:
systemctl start sonar.service
.By addressing the Java version discrepancy and ensuring that Elasticsearch does not run as the root user, SonarQube was able to start up and operate correctly on the system.
Initial SonarQube Installation:
Assuming you've downloaded and extracted SonarQube:
wget <SonarQube download link>
tar -xzvf <SonarQube archive>
mv <SonarQube extracted folder> /opt/sonarqube
Java Version Correction:
SonarQube requires Java 17. You installed it and set it as default:
sudo apt install openjdk-17-jdk
sudo update-alternatives --config java
You chose Java 17 from the list to set it as default.
Elasticsearch Root Issue:
Elasticsearch should not be run as root
. This means SonarQube shouldn't be run as root
either.
User Configuration for SonarQube:
Create a dedicated system user named sonar
:
sudo adduser --system --no-create-home --group sonar
Change ownership of the SonarQube directory:
sudo chown -R sonar:sonar /opt/sonarqube
Modify the SonarQube systemd service file:
Open the file:
sudo nano /etc/systemd/system/sonar.service
Add/modify the User
and Group
directives:
```bash [Service] User=sonar Group=sonar
[Unit] Description=SonarQube service After=syslog.target network.target
[Service] Type=simple User=sonar Group=sonar ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh console ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop Restart=always
[Install] WantedBy=multi-user.target ```
Reload systemd:
sudo systemctl daemon-reload
Starting SonarQube:
sudo systemctl start sonar.service
Access Sonar:
With these adjustments, SonarQube should be running correctly on your Ubuntu 22.04 machine. Remember, many of these steps are crucial not just The server will available at localhost, port 9000.
The user/password for functionality but also for maintaining a secure deployment of SonarQube and Elasticsearch. Always avoid running services as root
unless absolutely necessary.
4 | No.4 Revision |
Steps - works for Ubuntu 18.04 but also should work for newer Ubuntu Versions:
Initial SonarQube Installation:
/opt/sonarqube
.Java Version Correction:
Elasticsearch Root Issue:
root
user.User Configuration for SonarQube:
sonar
.sonar
user and group.sonar
user and group.Starting SonarQube:
systemctl start sonar.service
.By addressing the Java version discrepancy and ensuring that Elasticsearch does not run as the root user, SonarQube was able to start up and operate correctly on the system.
Initial SonarQube Installation:
Assuming you've downloaded and extracted SonarQube:
wget <SonarQube download link>
tar -xzvf <SonarQube archive>
mv <SonarQube extracted folder> /opt/sonarqube
Java Version Correction:
SonarQube requires Java 17. You installed it and set it as default:
sudo apt install openjdk-17-jdk
sudo update-alternatives --config java
You chose Java 17 from the list to set it as default.
Elasticsearch Root Issue:
Elasticsearch should not be run as root
. This means SonarQube shouldn't be run as root
either.
User Configuration for SonarQube:
Create a dedicated system user named sonar
:
sudo adduser --system --no-create-home --group sonar
Change ownership of the SonarQube directory:
sudo chown -R sonar:sonar /opt/sonarqube
Modify the SonarQube systemd service file:
Open the file:
sudo nano /etc/systemd/system/sonar.service
Add/modify the User
and Group
directives:
```bash
[Service]
User=sonar
Group=sonar
[Unit] [Unit] Description=SonarQube service After=syslog.target network.target
[Service]
Type=simple
Type=simple
User=sonar
Group=sonar
LimitNOFILE=65536
ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh console
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
Restart=always
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
```
Reload systemd:
sudo systemctl daemon-reload
bash
Starting SonarQube:
sudo systemctl start sonar.service
Access Sonar:
The server will available at localhost, port 9000.
The user/password for the first login admin/admin