You are on page 1of 3

yum -y install nano net-tools vim lrzsz wget unzip epel-release git

yum -y upgrade

nano /etc/sysctl.conf
----------------------------
vm.max_map_count=262144
fs.file-max=65536
----------------------------
sysctl -p

nano /etc/security/limits.conf
----------------------------
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
----------------------------

yum install -y java-11-openjdk java-11-openjdk-devel

nano /etc/profile
----------------------------
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.17.0.8-2.el7_9.x86_64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/
tools.jar
export PATH=$PATH:$JAVA_HOME/bin
----------------------------

yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/


pgdg-redhat-repo-latest.noarch.rpm -y
yum install postgresql10-contrib postgresql10-server -y
/usr/pgsql-10/bin/postgresql-10-setup initdb

cp /var/lib/pgsql/10/data/pg_hba.conf{,.bak}

nano /var/lib/pgsql/10/data/pg_hba.conf
----------------------------
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
----------------------------

systemctl start postgresql-10


systemctl enable postgresql-10.service

su - postgres
psql
CREATE DATABASE sonar TEMPLATE template0 ENCODING 'utf8' ;
create user sonar;
alter user sonar with password 'sonar';
alter role sonar createdb;
alter role sonar superuser;
alter role sonar createrole;
alter database sonar owner to sonar;
\q
exit

adduser sonar
passwd sonar
usermod -a -G wheel sonar
cd /usr/local/
wget -c https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-
8.9.10.61524.zip
unzip sonarqube-8.9.10.61524.zip
mv sonarqube-8.9.10.61524 /usr/local/sonarqube
chown -R sonar:sonar /usr/local/sonarqube/

nano /usr/local/sonarqube/conf/sonar.properties
----------------------------
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:postgresql://localhost/sonar
sonar.jdbc.maxActive=60
sonar.jdbc.maxIdle=5
sonar.jdbc.minIdle=2
sonar.jdbc.maxWait=5000
sonar.jdbc.minEvictableIdleTimeMillis=600000
sonar.jdbc.timeBetweenEvictionRunsMillis=30000
sonar.jdbc.removeAbandoned=true
sonar.jdbc.removeAbandonedTimeout=60
----------------------------

nano /etc/profile
----------------------------
export SONAR_HOME=/usr/local/sonarqube
export SONAR_RUNNER_HOME=/usr/local/sonar-scanner
export PATH=$PATH:$SONAR_RUNNER_HOME/bin
export PATH=$PATH:$SONAR_HOME/bin
----------------------------

su sonar
cd /usr/local/sonarqube/bin/linux-x86-64/
./sonar.sh start
==> Starting SonarQube...
==> Started SonarQube.

/usr/local/sonarqube/bin/linux-x86-64/sonar.sh start

firewall-cmd --zone=public --add-port=9000/tcp --permanent


firewall-cmd --zone=public --add-port=9001/tcp --permanent
firewall-cmd --reload

sudo wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-


scanner-cli-4.7.0.2747-linux.zip
sudo unzip sonar-scanner-cli-4.7.0.2747-linux.zip
sudo mv sonar-scanner-4.7.0.2747-linux /opt/

sudo nano ~/.bashrc


----------------------------
export PATH=$PATH:/opt/sonar-scanner-4.7.0.2747-linux/bin
----------------------------

source ~/.bashrc

sudo git clone https://github.com/SonarSource/sonar-scanning-examples.git

### 開機啟動軟件
su sonar
/usr/local/sonarqube/bin/linux-x86-64/sonar.sh start

You might also like