You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.2 KiB

Stream9 安装Gitlab

作者:行癫(盗版必究)


一:环境准备

Stream 9 服务器 2核 10G

关闭防火墙和selinux

网络畅通

部署Gitlab最新版本

1.准备gitlab仓库

阿里源
[root@cicd-gitlab ~]# vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
Repo_gpgcheck=0
Enabled=1
gpgcheck=0
清华源:
[root@cicd-gitlab ~]# vim 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

[root@cicd-gitlab ~]# vim gitlab-ee.repo
[gitlab-ee]
name=Gitlab EE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el$releasever/
gpgcheck=0
enabled=1
官方源:
[root@cicd-gitlab ~]# vim runner_gitlab-ci-multi-runner.repo
[runner_gitlab-ci-multi-runner]
name=runner_gitlab-ci-multi-runner
baseurl=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[runner_gitlab-ci-multi-runner-source]
name=runner_gitlab-ci-multi-runner-source
baseurl=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

2.安装依赖环境

[root@cicd-gitlab ~]# yum install -y curl openssh-server openssh-clients postfix cronie

注意:

在Stream9中无法直接安装policycoreutils-python需将软件包在7的服务器上下载rpm后上传到Stream9安装

[root@cicd-gitlab ~]# yum install policycoreutils-python --downloadonly --downloaddir=/home/gitlab_rpm/

在Stream9中安装

[root@cicd-gitlab ~]# rpm -ivh *.rpm --force --nodeps

注意:

nodeps 就是安装时不检查依赖关系

force 就是强制安装

3.启动postfix

[root@cicd-gitlab ~]# systemctl start postfix

4.安装Gitlab-ce

[root@cicd-gitlab ~]# yum -y install gitlab-ce 

5.修改配置文件

#设置登录链接
[root@cicd-gitlab ~]# vim /etc/gitlab/gitlab.rb
***
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
# 没有域名可以设置为本机IP地址
external_url 'http://10.0.1.86'
***
[root@cicd-gitlab ~]# grep "^external_url" /etc/gitlab/gitlab.rb
external_url 'http://10.0.1.86'     #绑定监听的域名或IP

6.初始化

 [root@cicd-gitlab ~]# gitlab-ctl reconfigure   
.....

7.启动

[root@cicd-gitlab ~]# gitlab-ctl start

8.获取登录密码

注意用户是root密码需要到文件获取gitlab-ce-16.1.0版本)

initial_root_password 文件名