您好,登錄后才能下訂單哦!
社區(qū)版下載地址:https://www.sonarqube.org/downloads/
unzip sonarqube-8.2.0.32929.zip
psql #進(jìn)入命令行模式
create database sonar; #創(chuàng)建sonar數(shù)據(jù)庫(kù)
create user sonar; #創(chuàng)建sonar用戶(hù)
alter user sonar with password 'postgres'; #設(shè)置sonar用戶(hù)密碼(否則會(huì)導(dǎo)致連不上數(shù)據(jù)庫(kù))
alter role sonar createdb;alter role sonar superuser;alter role sonar createrole; #給sonar授權(quán)
alter database sonar owner to sonar; #更改sonar數(shù)據(jù)庫(kù)擁有者(這一步是必須的,否則會(huì)sonarqube會(huì)連接失敗)
psql進(jìn)入命令行模式
\l查看數(shù)據(jù)庫(kù)
\du 查看用戶(hù)
不能用root起!
切換用戶(hù)必須 su - username
切換好用戶(hù)千萬(wàn)別忘記給這個(gè)用戶(hù)授權(quán)你的sonarQube根目錄
更改一些系統(tǒng)配置
根據(jù)需要執(zhí)行下述命令以使內(nèi)核參數(shù)符合sonar安裝需求
sysctl vm.max_map_count
sysctl fs.file-max
ulimit -n
#可以通過(guò)以root身份運(yùn)行以下命令來(lái)為當(dāng)前會(huì)話動(dòng)態(tài)設(shè)置:
sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -n 65536
#為了更永久設(shè)置這些值,則必須修改/etc/sysctl.d/99-sonarqube.conf(或/etc/sysctl.conf文件)
#文件末尾添加下述兩行
vi /etc/sysctl.conf
vm.max_map_count=262144
fs.file-max=65536
#在/etc/profile文件末尾添加ulimit -n 65536
vi /etc/profile
ulimit -n 65536 #保存后運(yùn)行#source /etc/profile 使其生效
source /etc/profile
創(chuàng)建sonar用戶(hù)
useradd sonar
passwd sonar
目錄授權(quán)
chown -R sonar:sonar /usr/local/sonarqube-8.2.0.32929/
vim /usr/local/sonarqube-8.2.0.32929/conf/sonar.properties
配置自己機(jī)器的IP跟端口,保存退出即可
$ SONARQUBE-HOME / data中
vim /usr/local/sonarqube-8.2.0.32929/conf/sonar.properties
用于啟動(dòng)SonarQube的用戶(hù)必須具有對(duì)這些目錄的讀寫(xiě)權(quán)限
mkdir -p /data/sonarqube/data
mkdir -p /data/sonarqube/temp
chown -R sonar:sonar /data/
官方下載地址:https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
#丟到/usr/local/下面解壓
unzip sonar-scanner-cli-4.2.0.1873-linux.zip
cd sonar-scanner-4.2.0.1873-linux/
vim conf/sonar-scanner.propertie #改下配置
保存退出后,創(chuàng)建軟連接,將sonar-scanner改為全局即可使用
ln -s /usr/local/sonar-scanner-4.2.0.1873-linux/bin/sonar-scanner /usr/bin/sonar-scanner
su - sonar 別忘了切用戶(hù)
cd /usr/local/sonarqube-8.2.0.32929/
bin/linux-x86-64/sonar.sh
訪問(wèn)web界面
賬戶(hù)密碼:admin/admin
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。