|
1 | 1 | #!/bin/bash
|
2 | 2 | # Author: Landmark Technology
|
3 | 3 | # CentOs or REHEL 7/8
|
4 |
| -# Install JAVA pre-requisite |
| 4 | + |
| 5 | +#As a good security practice, SonarQuber Server is not advised to run sonar service as a root user, |
| 6 | +#so create a new user called sonar and grant sudo access to manage sonar services as follows |
| 7 | +# 1. create a sonar |
| 8 | +sudo useradd sonar |
| 9 | +# 2. Grand sudo access to sonar user |
| 10 | +sudo echo "sonar ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/sonar |
| 11 | +sudo chown -R sonar:sonar /opt/sonarqube/ |
| 12 | +sudo chmod -R 775 /opt/sonarqube/ |
5 | 13 | hostname sonar
|
| 14 | +sudo su - sonar |
| 15 | +## 3. Enable PasswordAuthentication |
| 16 | +sudo sed -i "/^[^#]*PasswordAuthentication[[:space:]]no/c\PasswordAuthentication yes" /etc/ssh/sshd_config |
| 17 | +sudo service sshd restart |
| 18 | + |
| 19 | +# 4. Install JAVA pre-requisite |
6 | 20 | cd /opt
|
7 | 21 | sudo yum -y install unzip wget git
|
8 | 22 | sudo wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
|
9 | 23 | sudo yum install jdk-8u131-linux-x64.rpm -y
|
10 |
| -#Download the SonarqQube Server software. |
| 24 | +# 5. Download the SonarqQube Server software. |
11 | 25 | sudo wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.8.zip
|
12 | 26 | sudo unzip sonarqube-7.8.zip
|
13 | 27 | sudo rm -rf sonarqube-7.8.zip
|
14 | 28 | sudo mv sonarqube-7.8 sonarqube
|
15 |
| -<<add |
16 |
| -#As a good security practice, SonarQuber Server is not advised to run sonar service as a root user, |
17 |
| -so create a new user called sonar and grant sudo access to manage sonar services as follows |
18 |
| -add |
19 |
| - |
20 |
| -sudo useradd sonar |
21 |
| - |
22 |
| -# Grand sudo access to sonar user |
23 |
| -sudo echo "sonar ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/sonar |
24 |
| -sudo chown -R sonar:sonar /opt/sonarqube/ |
25 |
| -sudo chmod -R 775 /opt/sonarqube/ |
26 |
| - |
27 |
| -## Enable PasswordAuthentication |
28 |
| - |
29 |
| -sudo sed -i "/^[^#]*PasswordAuthentication[[:space:]]no/c\PasswordAuthentication yes" /etc/ssh/sshd_config |
30 |
| -sudo service sshd restart |
31 | 29 |
|
32 | 30 | # start sonarqube as sonar user using relative path
|
33 | 31 | sudo su - sonar
|
|
0 commit comments