gitlab centos安装

安装依赖包

1
2
3
yum update
yum install perl -y
yum install policycoreutils-python -y

安装postfix

1
2
3
#新用户激活邮件用到
yum install postfix
systemctl start postfix && systemctl enable postfix

下载安装包

1
2
3
4
5
6
# 找到机器对应版本下载
https://packages.gitlab.com/gitlab/gitlab-ce
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.6.7-ce.0.el7.x86_64.rpm
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-17.11.5-ce.0.el8.x86_64.rpm/download.rpm

安装

1
2
rpm -ivh gitlab-ce-8.6.7-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-17.11.5-ce.0.el8.x86_64.rpm

修改配置文件

1
2
3
4
# 修改/etc/gitlab/gitlab.rb文件,设置external_url为服务器IP或域名
vim /etc/gitlab/gitlab.rb

external_url 'http://10.0.0.5'

启动服务

1
2
3
gitlab-ctl reconfigure
gitlab-ctl start
systemctl enable gitlab-runsvdir.service

命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
gitlab-ctl help

/opt/gitlab/embedded/bin/omnibus-ctl: command (subcommand)
deploy-page
Put up the deploy page
显示部署页面
remove-accounts
Delete *all* users and groups used by this package
删除所有用户和组
upgrade
Run migrations after a package upgrade
在软件包升级后运行迁移
General Commands:
cleanse
Delete *all* gitlab data, and start from scratch.
清除所有 GitLab 数据,从头开始
help
Print this help message.
打印帮助信息
reconfigure
Reconfigure the application.
重新配置应用程序
show-config
Show the configuration that would be generated by reconfigure.
显示将通过 reconfigure 生成的配置
uninstall
Kill all processes and uninstall the process supervisor (data will be preserved).
终止所有进程并卸载进程监控程序(数据会被保留)
Service Management Commands:
graceful-kill
Attempt a graceful stop, then SIGKILL the entire process group.
hup
Send the services a HUP.
向服务发送 HUP 信号
int
Send the services an INT.
向服务发送 INT 信号
kill
Send the services a KILL.
向服务发送 KILL 信号
once
Start the services if they are down. Do not restart them if they stop.
:如果服务未运行则启动它们,但不会在服务停止后自动重启
restart
Stop the services if they are running, then start them again.
如果服务正在运行,则停止它们,然后再次启动
service-list
List all the services (enabled services appear with a *.)
列出所有服务(启用的服务前会带有 * 标记)
start
Start services if they are down, and restart them if they stop.
如果服务未运行则启动,若服务停止则会重启
status
Show the status of all the services.
显示所有服务的状态
stop
Stop the services, and do not restart them.
停止服务,并且不自动重启
tail
Watch the service logs of all enabled services.
实时查看所有启用服务的日志
term
Send the services a TERM.
向服务发送 TERM 信号

日志

1
tail -f /var/log/gitlab/nginx/current

卸载删除

1
2
3
4
5
6
gitlab-ctl stop
rpm -e gitlab-ce

rm -rf /opt/gitlab
rm -rf /var/opt/gitlab
rm -rf /etc/gitlab

默认密码

1
2
root
cat /etc/gitlab/initial_root_password

访问

http://10.0.0.5

中文设置

设置中文

从coding导入

gitlab创建群组

创建群组

gitlab导入

导入项目1
导入项目2