部署gitlab服務(wù)
準(zhǔn)備環(huán)境: 關(guān)閉防火墻和selinux
192.168.201.128 #gitlab服務(wù)器
配置yum源
[root@git-server ~]# cd /etc/yum.repos.d/
[root@git-server yum.repos.d]# vi gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever
gpgcheck=0
enabled=1
安裝相關(guān)依賴
[root@git-server yum.repos.d]# yum install -y curl policycoreutils-python openssh-server
[root@git-server yum.repos.d]# systemctl enable sshd
[root@git-server yum.repos.d]# systemctl start sshd
安裝postfix
[root@git-server yum.repos.d]# yum install -y postfix #安裝郵箱
[root@git-server yum.repos.d]# systemctl enable postfix
[root@git-server yum.repos.d]# systemctl start postfix
[root@git-server yum.repos.d]# yum install -y gitlab-ce #將會(huì)安裝gitlab最新版本
配置gitlab
[root@git-server ~]# vim /etc/gitlab/gitlab.rb
1.添加對(duì)外的域名(gitlab.papamk.com請(qǐng)?zhí)砑覣記錄指向本服務(wù)器的公網(wǎng)IP):將原來的修改為
external_url 'http://192.168.201.128'
2.設(shè)置地區(qū)
gitlab_rails['time_zone'] = 'Asia/Shanghai'
將數(shù)據(jù)路徑的注釋去掉
git_data_dirs({
"default" => {
"path" => "/mnt/nfs-01/git-data"
}
})
開啟ssh服務(wù):
gitlab_rails['gitlab_shell_ssh_port'] = 22
重置并啟動(dòng)GitLab執(zhí)行:
[root@git-server ~]# gitlab-ctl reconfigure #重新加載,需要等很長時(shí)間
啟動(dòng):
[root@git-server ~]# gitlab-ctl restart #啟動(dòng)
測(cè)試訪問:http://192.168.201.128
添加項(xiàng)目時(shí)鼻忠,提示如下所示涵但,則需要添加密鑰
(建立密鑰時(shí)的用戶,需要與登錄GitLab的用戶名一致)
[root@client ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)?
[root@client ~]# cat .ssh/
id_rsa id_rsa.pub known_hosts
[root@client ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHwaaorlCxuTyEs0OCLN1Jj7wY6zMMvS/DMwEpSwIAXOz49wKLAnbyWb7IMDG2uyldDYbBEVgLCh35tyxcHU6MyZS/E6g+hmfbHUsTyRqP0wQizN+xNy97pGz0gU/wTG7PTAUE9kvA3kR6kfm5vrWf0kF+9x4akG0YPkEnnhZ2kq3mbCATeoSxkzfFUVNrchdVQehIQU1yo9Gz0VxDI15MxYn9x7s9hHNhh0VADl1y7sxTcSwetAKNp757B/87K4djovkHcXPhVfp2XlM1BU+8aVE0B3dJgDt10hN14IqkvLk4Y3Sp8Xb1Q1AOounbjkyBnfqEcrA1R0b4K0cR+xm3 root@zabbix-node1
[root@client ~]#