143 lines
3.2 KiB
Markdown
143 lines
3.2 KiB
Markdown
<h1><center>Stream9 安装Gitlab</center></h1>
|
||
|
||
作者:行癫(盗版必究)
|
||
|
||
------
|
||
|
||
## 一:环境准备
|
||
|
||
Stream 9 服务器 2核 10G
|
||
|
||
关闭防火墙和selinux
|
||
|
||
网络畅通
|
||
|
||
## 二:部署Gitlab最新版本
|
||
|
||
#### 1.准备gitlab仓库
|
||
|
||
```shell
|
||
阿里源
|
||
[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.安装依赖环境
|
||
|
||
```shell
|
||
[root@cicd-gitlab ~]# yum install -y curl openssh-server openssh-clients postfix cronie
|
||
```
|
||
|
||
注意:
|
||
|
||
在Stream9中无法直接安装policycoreutils-python;需将软件包在7的服务器上下载rpm后上传到Stream9安装
|
||
|
||
```shell
|
||
[root@cicd-gitlab ~]# yum install policycoreutils-python --downloadonly --downloaddir=/home/gitlab_rpm/
|
||
```
|
||
|
||
在Stream9中安装
|
||
|
||
```shell
|
||
[root@cicd-gitlab ~]# rpm -ivh *.rpm --force --nodeps
|
||
```
|
||
|
||
注意:
|
||
|
||
nodeps 就是安装时不检查依赖关系
|
||
|
||
force 就是强制安装
|
||
|
||
#### 3.启动postfix
|
||
|
||
```shell
|
||
[root@cicd-gitlab ~]# systemctl start postfix
|
||
```
|
||
|
||
#### 4.安装Gitlab-ce
|
||
|
||
```shell
|
||
[root@cicd-gitlab ~]# yum -y install gitlab-ce
|
||
```
|
||
|
||
#### 5.修改配置文件
|
||
|
||
```shell
|
||
#设置登录链接
|
||
[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.初始化
|
||
|
||
```shell
|
||
[root@cicd-gitlab ~]# gitlab-ctl reconfigure
|
||
.....
|
||
```
|
||
|
||
#### 7.启动
|
||
|
||
```shell
|
||
[root@cicd-gitlab ~]# gitlab-ctl start
|
||
```
|
||
|
||
#### 8.获取登录密码
|
||
|
||
注意:用户是root,密码需要到文件获取(gitlab-ce-16.1.0版本)
|
||
|
||
```shell
|
||
initial_root_password 文件名
|
||
```
|
||
|