Gitlab的服务构成
Nginx:静态web服务器。
gitlab-shell:用于处理Git命令和修改authorized keys列表。
gitlab-workhorse:轻量级的反向代理服务器。
logrotate:日志文件管理工具。
postgresql:数据库。
redis:缓存数据库。
sidekiq:用于在后台执行队列任务(异步执行)。
unicorn:An HTTP server for Rack applications,GitLab Rails应用是托管在这个服务器上面的。
手动部署
- 配置yum源。
- vim /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
- 更新本地yum缓存
- sudo yum makecache
- 安装GitLab社区版
- sudo yum install gitlab-ce
-
添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效。
sudo firewall-cmd --permanent --add-service=http
-
重启防火墙,安装命令:sudo systemctl reload firewalld
-
修改gitlab配置文件指定服务器ip和自定义端口默认8080:
-
vim /etc/gitlab/gitlab.rb
-
-
重置并启动GitLab
-
gitlab-ctl reconfigure
-
gitlab-ctl restart
-
访问 GitLab页面
如果没有域名,直接输入服务器ip和指定端口进行访问
初始账户: root 密码:5iveL!fe
第一次登录修改密码
-
GitLab常用命令:
-
sudo gitlab-ctl start # 启动所有 gitlab 组件;
-
sudo gitlab-ctl stop # 停止所有 gitlab 组件;
-
sudo gitlab-ctl restart # 重启所有 gitlab 组件;
-
sudo gitlab-ctl status # 查看服务状态;
-
sudo gitlab-ctl reconfigure # 启动服务;
-
sudo vim /etc/gitlab/gitlab.rb # 修改默认的配置文件;
-
gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
-
sudo gitlab-ctl tail
-
设置
public key -
ssh-keygen #一路回车
- 复制id_rsa.pub公钥到gitlab
- cat ~/.ssh/id_rsa.pub