Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Installation (Ubuntu)

Pre-requisite

  • Database (We are using the default h2 db)
  • Java 8
  • Both must be pre-installed on your machine

Installing the Web Server

### As root (or sudo infront of all commands)###
# Create sonar user and set password
adduser --no-create-home --disabled-login --disabled-password sonar
passwd sonar

# Get the latest nexus oss version
mkdir -p /tmp/install/cd 
wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.2.zip -P /tmp/install/

# Unzip and point to latest (ex 6.2)
mkdir -p /opt/sonar
unzip --help/tmp/install/sonarqube-6.2.zip -d /opt/sonar/
ln -sfn /opt/sonar/sonarqube-6.2 /opt/sonar/current



#Owned by sonar
chown -R sonar:sonar /opt/sonar

Systemd service

# Create sonar systemd script
cat > /etc/systemd/system/sonar.service  << 'EOF'
[Unit]
Description=Sonarqube
After=network.target network-online.target
Wants=network-online.target

[Service]
ExecStart=/opt/sonar/current/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonar/current/bin/linux-x86-64/sonar.sh stop
ExecReload=/opt/sonar/current/bin/linux-x86-64/sonar.sh restart
PIDFile=/opt/sonar/current/bin/linux-x86-64/./SonarQube.pid
Type=forking
User=sonar

[Install]
WantedBy=multi-user.target
EOF

# Activate the service with the following commands:
sudo systemctl daemon-reload
sudo systemctl enable sonar.service
sudo systemctl start sonar.service

# After starting the service for any Linux-based operating systems, verify that the service started successfully.
tail -f /opt/sonar/current/logs/sonar.log
# The tail command verifies that the service has been started successfully. 
# If successful, you should see a message notifying you that it is listening for HTTP.
# IMPORTANT:  Be sure to assign the appropriate permissions to the user running the sonar service.
  • No labels