共计 3264 个字符,预计需要花费 9 分钟才能阅读完成。
GitLab 介绍
GitLab:是一个基于 Git 实现的在线代码仓库托管软件,你能够用 gitlab 本人搭建一个相似于 Github 一样的零碎,个别用于在企业、学校等外部网络搭建 git 私服。
性能:Gitlab 是一个提供代码托管、提交审核和问题跟踪的代码治理平台。对于软件工程品质治理十分重要。
版本:GitLab 分为社区版(CE)和企业版(EE)。
Gitlab 的服务形成
Nginx:动态 web 服务器。
gitlab-shell:用于解决 Git 命令和批改 authorized keys 列表。(Ruby)
gitlab-workhorse: 轻量级的反向代理服务器。(go)
logrotate:日志文件管理工具。
postgresql:数据库。
redis:缓存数据库。
sidekiq:用于在后盾执行队列工作(异步执行)。(Ruby)
unicorn:An HTTP server for Rack applications,GitLab Rails 利用是托管在这个服务器下面的。(Ruby Web Server, 次要应用 Ruby 编写)
* GitLab Workhorse 是一个麻利的反向代理。它会解决一些大的 HTTP 申请,比方文件上传、文件下载、Git push/pull 和 Git 包下载。其它申请会反向代理到 GitLab Rails 利用,即反向代理给后端的 unicorn。
01
—
装置 Gitlab 主程序
root@hello:~# apt update && apt upgrade
root@hello:~# apt install -y curl openssh-server ca-certificates tzdata perl
root@hello:~# apt install -y postfix
root@hello:~# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
root@hello:~# apt install gitlab-ee
02
—
批改配置文件
root@hello:~# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.1.88'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qiye.aliyun.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "cby"
gitlab_rails['smtp_password'] = "Cby123.."
gitlab_rails['smtp_domain'] = "chenby.cn"
gitlab_rails['smtp_authentication'] = "plain"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_pool'] = false
root@hello:~# gitlab-ctl reconfigure
root@hello:~# gitlab-ctl restart
ok: run: alertmanager: (pid 63590) 1s
ok: run: gitaly: (pid 63610) 1s
ok: run: gitlab-exporter: (pid 63641) 0s
ok: run: gitlab-workhorse: (pid 63643) 1s
ok: run: grafana: (pid 63659) 0s
ok: run: logrotate: (pid 63676) 1s
ok: run: nginx: (pid 63682) 0s
ok: run: node-exporter: (pid 63718) 1s
ok: run: postgres-exporter: (pid 63728) 0s
ok: run: postgresql: (pid 63737) 0s
ok: run: prometheus: (pid 63746) 1s
ok: run: puma: (pid 63777) 1s
ok: run: redis: (pid 63782) 0s
ok: run: redis-exporter: (pid 63788) 1s
ok: run: sidekiq: (pid 63887) 1s
root@hello:~#
03
—
查看 root 明码
root@hello:~# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
# 2. Password hasn't been changed manually, either via UI or via command line.
#
# If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
Password: HUd9b632LHN89WXYEVYPssWGpyJrgK7BJLbVLC4VCas=
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
root@hello:~#
04
—
常用命令
gitlab-ctl start # 启动所有 gitlab 组件;gitlab-ctl stop # 进行所有 gitlab 组件;gitlab-ctl restart # 重启所有 gitlab 组件;gitlab-ctl status # 查看服务状态;vim /etc/gitlab/gitlab.rb # 批改 gitlab 配置文件;gitlab-ctl reconfigure # 从新编译 gitlab 的配置;gitlab-rake gitlab:check SANITIZE=true --trace # 查看 gitlab;gitlab-ctl tail # 查看日志;gitlab-ctl tail nginx/gitlab_access.log
日志地址:/var/log/gitlab/ # 对应各服务的打印日志
服务地址:/var/opt/gitlab/ # 对应各服务的主目录
Linux 运维交换社区
Linux 运维交换社区,互联网新闻以及技术交换。
75 篇原创内容
公众号
https://blog.csdn.net/qq_3392…
https://my.oschina.net/u/3981543
https://www.zhihu.com/people/…
https://segmentfault.com/u/hp…
https://juejin.cn/user/331578…
https://space.bilibili.com/35…
https://cloud.tencent.com/dev…
https://www.jianshu.com/u/0f8…
https://www.toutiao.com/c/use…
知乎、CSDN、开源中国、思否、掘金、哔哩哔哩、腾讯云、简书、今日头条