發表於 程式分享

GitLab安裝步驟(ubuntu 20.4)

1.Update system & install dependencies

sudo apt update
sudo apt upgrade -y
sudo apt install -y ca-certificates curl openssh-server

2.Configure Postfix Send-Only SMTP Server

https://computingforgeeks.com/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu/

#sudo hostnamectl set-hostname master.example.com
sudo apt install mailutils
    #Internet Site => OK => System mail name: master

sudo vi /etc/postfix/main.cf
#/etc/postfix/main.cf
inet_interfaces = loopback-only
myhostname = master
sudo systemctl restart postfix
#寄測試信
echo "Postfix Send-Only Server" | mail -s "Postfix Testing" huang.yahui.grace@gmail.com

3.Add the GitLab CE Repository

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
cat /etc/apt/sources.list.d/gitlab_gitlab-ce.list
#sudo apt-get install gitlab-ce
hadoop@master:~/elk$ cat /etc/apt/sources.list.d/gitlab_gitlab-ce.list
# this file was generated by packages.gitlab.com for
# the repository at https://packages.gitlab.com/gitlab/gitlab-ce

deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ focal main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ focal main

4.Install GitLab CE on Ubuntu 20

sudo apt update
sudo apt -y install gitlab-ce
sudo vi /etc/gitlab/gitlab.rb
external_url 'http://master.example.com:8088'
sudo cat /etc/gitlab/gitlab.rb |grep -v ^$ |grep -v ^#
sudo systemctl stop ufw
sudo gitlab-ctl reconfigure
sudo gitlab-ctl status
# sudo chmod -R 755    /var/log/gitlab

執行結果

hadoop@master:~/elk$ sudo gitlab-ctl status
run: alertmanager: (pid 149845) 13s; run: log: (pid 147377) 612s
run: gitaly: (pid 149909) 10s; run: log: (pid 145835) 729s
run: gitlab-exporter: (pid 149797) 16s; run: log: (pid 147072) 631s
run: gitlab-workhorse: (pid 149768) 17s; run: log: (pid 146825) 650s
run: grafana: (pid 149871) 12s; run: log: (pid 149494) 45s
run: logrotate: (pid 145651) 744s; run: log: (pid 145669) 743s
run: nginx: (pid 146854) 647s; run: log: (pid 146912) 644s
run: node-exporter: (pid 149780) 17s; run: log: (pid 146987) 637s
run: postgres-exporter: (pid 149862) 13s; run: log: (pid 147424) 608s
run: postgresql: (pid 146040) 721s; run: log: (pid 146055) 720s
run: prometheus: (pid 149810) 15s; run: log: (pid 147257) 620s
run: puma: (pid 149837) 13s; run: log: (pid 146681) 662s
run: redis: (pid 145725) 738s; run: log: (pid 145742) 737s
run: redis-exporter: (pid 149799) 16s; run: log: (pid 147111) 626s
run: sidekiq: (pid 146694) 659s; run: log: (pid 146755) 656s
#查看Log
sudo gitlab-ctl tail postgresql

設定web root登入帳密

gitlab-rails console -e production
user = User.where(id: 1).first
user.password = '88888888'
user.password_confirmation = '88888888'
user.save
exit

註: 出現Http 502,是因跟zookeeper相衝-port 8080

#可調整 zookeeper.admin.serverPort
Ref. https://www.it1352.com/2182816.html
conf/zoo.cfg
admin.serverPort=9876 (default port : 8080)

5.Access GitLab CE Web Interface

https://computingforgeeks.com/how-to-install-gitlab-ce-on-ubuntu-linux/

https://zhuanlan.zhihu.com/p/338882906

https://zh.codepre.com/how-to-25529.html?__cf_chl_managed_tk__=pmd_40hZONm3XueVQul5s.Ad0TTVsTpj7S_fDFTZ7SlK4oI-1634027215-0-gqNtZGzNAuWjcnBszRL9

https://yehchitsai.gitbooks.io/linux-usage/content/download_gitlab.html

發表留言