Gitlib部署

前置软件的安装

1
2
3
4
5
6
7
8
9
10
11
yum install curl policycoreutils openssh-server opensh-clients
systemctl enable sshd
systemctl start sshd

yum install postfix
systemctl enable postfix
systemctl start postfix
firewall-cmd --permanent --add-service=http
systemctl reload firewalld

yum install policycoreutils-python

Gitlib安装

1
2
3
4
5
6
# rpm -ivh 后面接你的rpm包名
rpm -ivh gitlab-ce-13.2.6-ce.0.el7.x86_64.rpm

-i:表示进行安装操作。
-v:表示在安装过程中显示详细的输出信息,即详细模式(verbose mode)。
-h:表示以哈希进度条的形式显示安装进度。

修改默认的配置文件

安装完成之后

1
2
3
vim /etc/gitlab/gitlab.rb
# 把里面的external_url 'http://ip:端口' 这个给成你的ip和端口
# 这里注意端口尽量选一些不会冲突的,以防止和gitlab中的其他组件(nginx、postgresql、rails)端口冲突

配置完成要重载配置

1
gitlab-ctl reconfigure # 重载配置文件

查找某个关键字在Linux文本文件中的位置

1
2
3
4
5
6
7
8
# 查找并显示行号
grep -n "你要查找的关键字" 文件路径

# 忽略大小写
grep -i "hello" /home/user/example.txt

# vim编辑器显示行号
:set number

配置邮件(可选)

记得配置完之后要刷新一下(重载配置文件)。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
gitlab_rails['smtp_enable'] = true

gitlab_rails['smtp_address'] = "smtp.163.com"

gitlab_rails['smtp_port'] = 25

gitlab_rails['smtp_user_name'] = "cilliandevops@163.com" # 自己的邮箱账号

gitlab_rails['smtp_password'] = "xxx" # 开通smtp时返回的授权码

gitlab_rails['smtp_domain'] = "163.com"

gitlab_rails['smtp_authentication'] = "login"

gitlab_rails['smtp_enable_starttls_auto'] = true

gitlab_rails['smtp_tls'] = false

gitlab_rails['gitlab_email_from'] = "cilliandevops @163.com" # 指定发送邮件的邮箱地址

user["git_user_email"] = "cilliandevops @163.com" # 指定接收邮件的邮箱地址

使用

1
2
3
4
5
6
7
8
9
10
11
12
13
gitlab-ctl start # 启动所有 gitlab 组件

gitlab-ctl stop # 停止所有 gitlab 组件

gitlab-ctl restart # 重启所有 gitlab 组件

gitlab-ctl status # 查看服务状态

gitlab-ctl reconfigure # 启动服务

gitlab-ctl show-config # 验证配置文件

gitlab-ctl tail # 查看日志