Linux下GitLab如何安装部署
时间:2022-07-11 08:59:40
一, GitLab 简介
现在,GitHub已经成为首选的代码托管平台。 因为它又很多很棒的功能,操作简单,几乎所有的开发者都喜欢它。Gitlab 是一个很棒的Git托管服务,几乎像GitHub一样强大。gitlab 一般作为内部私有系统使用,若公司使用 git 分布代码,每次从 github 上 pull 则非常慢,使用 gitlab 则方便很多。
二,安装
以下为官方文档的安装说明,详细的信息请访问 gitlab 官网
1,安装依赖
sudo yum install curl openssh-server openssh-clients postfix cronie
sudo service postfix start
sudo chkconfig postfix on
sudo lokkit -s http -s ssh
2,添加GitLab仓库,并安装到服务器上(由于包比较大,网速慢的可以考虑在我的 FTP 上下载,注意选择好你的对应版本)
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
3,配置并启动,以下命令会自动配置并初始化 gitlab
sudo gitlab-ctl reconfigure
4,启动并登陆
以下是默认用户名密码,首次登陆会提示你修改密码:
Username: root
Password:5iveL!fe
然后就可以愉快的折腾了!
![Linux下GitLab如何安装部署](https://img.aspxhome.com/file/2023/4/a308483_0.png)
三,安装中出现的问题
听说 gitlab 安装中会出现的问题还是比较多的,不过在我安装的过程中好像没有遇到多少问题!
1,在浏览器中访问GitLab出现502错误
![Linux下GitLab如何安装部署](https://img.aspxhome.com/file/2023/4/a308483_1.png)
首先就是端口占用问题,gitlab 启动会使用 80 端口,所以建议你在启动 gitlab 前先将不需要的服务都关掉,或者修改默认端口:
sudo vim /etc/gitlab/gitlab.rb
修改external_url,直接增加端口号即可,比如我这里用8800端口:
external_url 'http://localhost:8800'
然后执行:
sudo gitlab-ctl reconfigure
2,8080端口冲突
除了 80 这个端口外,还有一个unicorn用的端口,默认是8080,如果8080端口被其他程序占用。那么unicorn就会无法启动,显示为502错误,”GitLab is not responding”。
解决办法:修改 /etc/gitlab/gitlab.rb
unicorn['listen']='127.0.0.1'
unicorn['port']=8801
然后运行:
sudo gitlab-ctl reconfigure
四,gitlab 常用命令
gitlab-ctl start
gitlab-ctl stop
gitlab-ctl status
gitlab-ctl restart
Gitlab 默认的日志文件存放在/var/log/gitlab 目录下:
gitlab-ctl tail #查看所有日志
gitlab-ctl tail nginx/gitlab_access.log #查看nginx访问日志
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Powerpoint对象(文字、图形、图像等)各种动画制作
![](https://img.aspxhome.com/file/2023/10/a353012_0s.jpg)
windows7系统错误报告弹出提示窗口取消方法
苹果这样频烦更新系统真的好吗?要不要跟随苹果升级?
![](https://img.aspxhome.com/file/2023/8/a196608_0s.jpg)
新版PS如何导入旧版图像中的形状?
![](https://img.aspxhome.com/file/2023/9/a341787_0s.png)
风云水印管家怎么使用?风云水印管家使用教程
![](https://img.aspxhome.com/file/2023/30/a269751_0s.jpg)
Win7 32位中audiodg进程CPU占用率过高问题解决方法
![](https://img.aspxhome.com/file/2023/28/a251119_0s.jpg)
bios之家论坛关闭了吗
![](https://img.aspxhome.com/file/2023/3/a301407_0s.png)
balenaetcher怎么制作windows启动盘
![](https://img.aspxhome.com/file/2023/1/a274178_0s.png)
Win10右键刷新桌面反应很慢怎么解决?
![](https://img.aspxhome.com/file/2023/26/a220568_0s.png)
excel2007怎么加密码保护
Win10更新20H2出现错误显示0x800707e7
![](https://img.aspxhome.com/file/2023/26/a220563_0s.jpg)
lightroom怎么制作分离色调打旧照片?
![](https://img.aspxhome.com/file/2023/3/a293698_0s.jpg)
Win10升级要卸载virtualbox virtualbox与Win10不兼容怎么办
![](https://img.aspxhome.com/file/2023/26/a221958_0s.png)
win10如何重置网络连接名称或计数 win10重置网络连接名称或计数的方法
![](https://img.aspxhome.com/file/2023/28/a243855_0s.jpg)
Photon一款基于aria2 的多线程下载工具
![](https://img.aspxhome.com/file/2023/0/a212500_0s.png)
PPT演示技巧—给图片添加遮挡物的方法
怎么让Win10编程定制的系统?
![](https://img.aspxhome.com/file/2023/1/a278331_0s.png)
什么是邮件合并,6步教你学会使用怎样在word中使用邮件合并功能
![](https://img.aspxhome.com/file/2023/8/34028_0s.jpg)
Win11怎么分配磁盘空间?
![](https://img.aspxhome.com/file/2023/1/a272051_0s.png)
Win7系统电脑玩LOL提示“该站点安全证书吊销不可
![](https://img.aspxhome.com/file/2023/2/a286428_0s.jpg)