官方文档
GitLab官方网址:GitLab官网
CentOS 7上的官方文档教程:官网安装教程
Centos7上安装Gitlab
1.安装以及配置必要的依赖
以下的命令是打开http和ssh的通过系统防火墙的权限
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
2.安装Postfix(用来发送通知电子邮件):
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
3.添加Gitlab资源库
1.最新企业版:
https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh
2.最新社区版
https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh
以企业版为例:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
4.安装GitLab包
将https://gitlab.example.com
作为您要访问GitLab的域名。安装过程将自动配置并启动该域名的GitLab)
1.企业版最新版:gitlab-ee
2.社区版最新版:gitlab-ce
以企业版为例:安装过程如图所示
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee
可以先安装,再设置访问路径
sudo yum install -y gitlab-ee
vim /etc/gitlab/gitlab.rb
如下图所示:需改为http://localhost:8090/gitlab
## 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
external_url 'http://localhost:8090/gitlab'
5.启动
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab启动报warning: redis: unable to open supervise/ok: file does not exist;解决如下:
1、按住CTRL+C强制结束;
2、运行:sudo systemctl restart gitlab-runsvdir;
3、再次执行:sudo gitlab-ctl reconfigure
6.访问
先用linux命令curl localhost:8090/gitlab:
curl localhost:8090/gitlab
如果linux可以访问,但是远程无法访问:这种情况多半是因为Centos的防火墙没有开放端口号,在Centos7中,设置防火墙的命令如下所示:
firewall-cmd --zone=public --add-port=8090/tcp --permanent
--zone #作用域
--add-port=8090/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
设置完之后需要重启一下防火墙或者关闭再打开防火墙
systemctl stop firewalld.service
systemctl start firewalld.service
firewall-cmd --reload
查看防火墙是否开启该端口的命令如下,yes表示已经开启
firewall-cmd --zone=public --query-port=80/tcp
1.首次访问时,您将被重定向到密码重置页面。设置初始管理员帐户的密码。使用默认帐户的用户名root登录。
参考博客:
centos7 安装 gitlab
https://blog.csdn.net/qq_32596527/article/details/83617638
https://blog.csdn.net/musuny/article/details/78548868
https://blog.csdn.net/cienven/article/details/86525870
https://www.linuxidc.com/Linux/2017-06/144990.htm
https://blog.csdn.net/lizhiyuan_eagle/article/details/81459060
https://blog.csdn.net/yu12377/article/details/78748467
https://www.cnblogs.com/yoyoketang/p/10272544.html
centos7 卸载 gitlab:
https://www.cnblogs.com/flying607/p/7528620.html