如何在CentOS7上安装gitlab
1.新建 /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
2.执行
sudo yum makecache
sudo yum install gitlab-ce
3.修改/etc/gitlab/gitlab.rb文件
把external_url替换成你服务器的IP,如下:
## 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
##!
##! Note: During installation/upgrades, the value of the environment variable
##! EXTERNAL_URL will be used to populate/replace this value.
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
##! address from AWS. For more details, see:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http://192.168.100.200'
如果需要修改默认的数据的存储位置,则把git_data_dirs配置取消注释,并设定path为你期望的存储路径, 示例如下
git_data_dirs({
"default" => {
"path" => "/var/data/git-data"
}
})
4.运行(需要一点时间)
sudo gitlab-ctl reconfigure
5.在浏览器输入服务器ip地址
会出现gitlab登录页,第一次打开会提示让你修改root的密码,修改完后保存,之后就可以通过用户名密码登录,root为默认管理员账号:
注意,如果无法访问,则注意看看防火墙是否开启并允许http服务访问
sudo firewall-cmd --list-all
输出类似
public (active)
target: default
icmp-block-inversion: no
interfaces: em1
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
如果services那一行没有包含http,则使用以下命令
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload
更多详细细节可参考:https://www.cnblogs.com/ddz-linux/p/10698907.html
其他参考:
https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/
另外看到一个博客网友写的通过docker方式安装,也不错,可以参考
https://www.cnblogs.com/zhengyazhao/p/11690189.html