From dfbcf8829fbc9de19c0e21cef873fcb545227c77 Mon Sep 17 00:00:00 2001 From: stevan-vanderwerf-sonarsource <97156518+stevan-vanderwerf-sonarsource@users.noreply.github.com> Date: Mon, 10 Oct 2022 08:39:17 -0500 Subject: DOCS update Running SonarQube as a Service on Linux with initd section (#6775) * DOCS update running SQ as service with initd * DOCS align running SQ as service initd w/ systemd --- server/sonar-docs/src/pages/setup/operate-server.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'server/sonar-docs') diff --git a/server/sonar-docs/src/pages/setup/operate-server.md b/server/sonar-docs/src/pages/setup/operate-server.md index 9accf9d85db..33a14b4ba7e 100644 --- a/server/sonar-docs/src/pages/setup/operate-server.md +++ b/server/sonar-docs/src/pages/setup/operate-server.md @@ -46,7 +46,7 @@ $SONAR_HOME/bin/linux-x86-64/sonar.sh force-stop ## Running SonarQube as a Service on Linux with SystemD -On a Unix system using SystemD, you can install SonarQube as a service. You cannot run SonarQube as `root` in 'nix systems. Ideally, you will created a new account dedicated to the purpose of running SonarQube. +On a Unix system using SystemD, you can install SonarQube as a service. You cannot run SonarQube as `root` in 'nix systems. Ideally, you will have created a new account dedicated to the purpose of running SonarQube. Let's suppose: * The user used to start the service is `sonarqube` @@ -89,9 +89,9 @@ sudo systemctl start sonarqube.service ## Running SonarQube as a Service on Linux with initd -The following has been tested on Ubuntu 8.10 and CentOS 6.2. +The following has been tested on Ubuntu 20.04 and CentOS 6.2. -Create the file /etc/init.d/sonar with this content: +You cannot run SonarQube as `root` in 'nix systems. Ideally, you will have created a new account dedicated to the purpose of running SonarQube. Let's suppose the user used to start the service is `sonarqube`. Then create the file `/etc/init.d/sonar` _based on_ the following: ``` #!/bin/sh @@ -110,8 +110,8 @@ Create the file /etc/init.d/sonar with this content: # Short-Description: SonarQube system (www.sonarsource.org) # Description: SonarQube system (www.sonarsource.org) ### END INIT INFO - -/usr/bin/sonar $* + +su sonarqube -c "/usr/bin/sonar $*" ``` Register SonarQube at boot time (RedHat, CentOS, 64 bit): @@ -121,6 +121,13 @@ sudo ln -s $SONAR_HOME/bin/linux-x86-64/sonar.sh /usr/bin/sonar sudo chmod 755 /etc/init.d/sonar sudo chkconfig --add sonar ``` +Register SonarQube at boot time (Ubuntu, 64 bit): + +``` +sudo ln -s $SONAR_HOME/bin/linux-x86-64/sonar.sh /usr/bin/sonar +sudo chmod 755 /etc/init.d/sonar +sudo update-rc.d sonar defaults +``` Once registration is done, run: ``` sudo service sonar start -- cgit v1.2.3