centos7.3安裝gitlab、gitlab-runner

1. 安裝依賴

sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

2.下載安裝

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee


#tip 使用國內鏡像 https://mirrors.tuna.tsinghua.edu.cn/help/gitlab-ce/
vi /etc/yum.repos.d/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

sudo yum makecache
sudo EXTERNAL_URL="http://gitlab.liyuchang.com" yum install -y gitlab-ce-10.1.4-ce.0.el7.x86_64

3.登錄默認用戶root

3.1查看日誌

#查看版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

# Tail all logs; press Ctrl-C to exit
sudo gitlab-ctl tail

# Drill down to a sub-directory of /var/log/gitlab
sudo gitlab-ctl tail gitlab-rails

# Drill down to an individual file
sudo gitlab-ctl tail nginx/gitlab_error.log

#https://docs.gitlab.com/omnibus/settings/logs.html

3.2 郵件發送設置

vi /etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465 #587錯誤
gitlab_rails['smtp_user_name'] = "xxxx@xx.com"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = 'xxxx@xx.com'
gitlab_rails['smtp_domain'] = "exmail.qq.com"

#https://docs.gitlab.com/omnibus/settings/smtp.html#examples

4.安裝gitlab-runner

# For RHEL/CentOS/Fedora
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash

# For RHEL/CentOS/Fedora
sudo yum install gitlab-runner


#查看多版本 for RPM based systems
yum list gitlab-runner --showduplicates | sort -r
sudo yum install
#sudo yum install gitlab-runner-10.0.0-1


#https://docs.gitlab.com/runner/install/linux-repository.html


# docker受權運行runer
sudo usermod -a -G docker gitlab-runner

# 操做60M運行內存

4.1.安裝gitlab-ci-multi-runner(國內鏡像)

vi /etc/yum.repos.d/gitlab-ci-multi-runner.repo
[gitlab-ci-multi-runner]
name=gitlab-ci-multi-runner
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ci-multi-runner/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

sudo yum makecache
sudo yum install gitlab-ci-multi-runner

#給gitlab-runner用戶賦予docker執行權限,不然在打包是會提示無權限。
sudo usermod -aG docker gitlab-runner

#修改/home/gitlab-runn目錄權限
sudo chmod -R 777 /home/gitlab-runner
-R 是指級聯應用到目錄裏的全部子目錄和文件
777 是全部用戶都擁有最高權限

#給gitlab-runner添加root權限(執行免密碼)
vi /etc/sudoers
gitlab-runner        ALL=(ALL)       NOPASSWD: ALL

https://about.gitlab.com/installation/#centos-7html

https://mirrors.tuna.tsinghua.edu.cn/help/gitlab-ci-multi-runner/python

相關文章
相關標籤/搜索