# Import the repository signing key:
sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
# Create the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Update the package lists:
sudo apt update
sudo apt install postgresql-15 -y
psql --version
psql (PostgreSQL) 15.12 (Ubuntu 15.12-1.pgdg22.04+1)
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -u postgres psql
-- 아래 SQL 입력
CREATE DATABASE sonarqube;
CREATE USER sonar WITH ENCRYPTED PASSWORD 'Luna@2025';
GRANT ALL PRIVILEGES ON DATABASE sonarqube TO sonar;
ALTER SCHEMA public OWNER TO sonar;
GRANT ALL ON SCHEMA public TO sonar;
\q # 종료
postgresql.conf
sudo vim /etc/postgresql/15/main/postgresql.conf
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
pg_hba.conf
sudo vim /etc/postgresql/15/main/pg_hba.conf
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
# 아래 내용추가
host all all 0.0.0.0/0 md5
https://www.sonarsource.com/open-source-editions/sonarqube-community-edition/
https://community.sonarsource.com/t/sonarqube-lts-is-now-sonarqube-lta/113837
cd ~/luna-workspace
wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-25.3.0.104237.zip
unzip sonarqube-25.3.0.104237.zip
mv sonarqube-25.3.0.104237 sonarqube
vim ~/luna_workspace/sonarqube/conf/sonar.properties
# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=sonar
sonar.jdbc.password=Luna@2025
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonarqube
sonar.web.host=0.0.0.0
# 포트 수정
sonar.web.port=9002
echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf
설정 적용
sudo sysctl -p
sudo ufw allow 9002/tcp
sudo ufw status
${sonarqube_설치폴더}/bin/linux-x86-64/
# 먼저 중지
./sonar.sh stop
# 다시 시작
./sonar.sh start
# 상태 확인
./sonar.sh status