gitlab安装
- 下载安装包
https://about.gitlab.com/install/
https://mirror.tuna.tsinghua.edu.cn/
-
安装gitlab服务所依赖包
sudo yum install -y curl policycoreutils-python openssh-server postfix wget
-
下载gitlab服务,安装gitlab服务
sudo yum localinstall -y gitlab-ce-12.9.2-ce.0.el7.x86_64.rpm
-
配置gitlab服务,访问域名以及邮箱
vi /etc/gitlab/gitlab.rb external_url 'http://gitlab.yuanke.com' # 配置邮箱 gitlab_rails['gitlab_email_enabled'] = true gitlab_rails['gitlab_email_from'] = '530979104@qq.com' #发送邮箱 gitlab_rails['gitlab_email_display_name'] = 'yuanke-gitlab' #发送人显示名称 gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.qq.com" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "530979104@qq.com" gitlab_rails['smtp_password'] = "hqvzmkwywndwbiah" gitlab_rails['smtp_domain'] = "qq.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = true # 修改 prometheus['enable'] = false unicorn['port'] = 8101
-
初始化gitlab服务,启动gitlab服务
gitlab-ctl reconfigure
gitlab-ctl start | status | restart | stop
- 访问gitlab服务,以及gitlab邮箱测试
host 做映射 C:\WINDOWS\system32\drivers\etc
192.168.254.208 gitlab.yuanke.com
gitlab.yuanke.com
gitlab 汉化
https://gitlab.com/xhang/gitlab
停止gitlab,进行中文汉化
gitlab-ctl stop
\cp -r gitlab-12-3-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/
gitlab-ctl start
卸载
1.停止gitlab
gitlab-ctl stop
2.卸载gitlab(卸载gitlab-ce)
rpm -e gitlab-ce
3.查看gitlab进程
ps aux | grep gitlab
4.杀死第一个进程
kill -9 32236
5.删除所有gitlab文件
find / -name gitlab | xargs rm -rf
注意
There was an error running gitlab-ctl reconfigure:
gitlab_sysctl[kernel.shmall] (postgresql::enable line 66) had an error: Mixlib: :ShellOut::ShellCommandFailed: execute[load sysctl conf kernel.shmall] (/opt/gi tlab/embedded/cookbooks/cache/cookbooks/package/resources/gitlab_sysctl.rb line 46) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to ex it with [0], but received '255'
---- Begin output of sysctl -e --system ----
STDOUT: * Applying /usr/lib/sysctl.d/00-system.conf ...
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 16
kernel.core_uses_pid = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.sem.conf ...
* Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.shmall.conf ...
kernel.shmall = 4194304
* Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.shmmax.conf ...
kernel.shmmax = 17179869184
* Applying /etc/sysctl.d/90-omnibus-gitlab-net.core.somaxconn.conf ...
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.conf ...
STDERR: sysctl: cannot open "/etc/sysctl.d/90-omnibus-gitlab-kernel.sem.conf": No such file or directory
sysctl: cannot open "/etc/sysctl.d/90-omnibus-gitlab-net.core.somaxconn.conf": No such file or directory
---- End output of sysctl -e --system ----
Ran sysctl -e --system returned 255
[root@s208 ~]# touch /opt/gitlab/embedded/etc/90-omnibus-gitlab-kernel.sem.conf
[root@s208 ~]# touch /opt/gitlab/embedded/etc/90-omnibus-gitlab-kernel.shmall.conf
[root@s208 ~]# touch /opt/gitlab/embedded/etc/90-omnibus-gitlab-net.core.somaxconn.conf
-
编写gitlab
Host github HostName github.com User git IdentityFile ~/.ssh/id_rsa Host coding HostName coding.net User git IdentityFile ~/.ssh/id_rsa_coding Host gitlab HostName gitlab.yuanke.com User git IdentityFile ~/.ssh/id_rsa_gitlab
$ ssh-agent.exe bash
$ ssh-add.exe ~/.ssh/id_rsa_gitlab
-
修改完配置后需要重新加载下
# gitlab-ctl reconfigure
备份
-
默认备份配置文件在: vim /etc/gitlab/gitlab.rb
# vim /etc/gitlab/gitlab.rb # gitlab_rails['manage_backup_path'] = true # gitlab_rails['backup_path'] = "/var/opt/gitlab/backups" #备份目录 ###! Docs: https://docs.gitlab.com/ce/raketasks/backup_restore.html#backup-archive-permissions # gitlab_rails['backup_archive_permissions'] = 0644 # gitlab_rails['backup_pg_schema'] = 'public' ###! The duration in seconds to keep backups before they are allowed to be deleted # gitlab_rails['backup_keep_time'] = 604800 #默认保存时间 7天 # gitlab_rails['backup_upload_connection'] = { # 'provider' => 'AWS', # 'region' => 'eu-west-1', # 'aws_access_key_id' => 'AKIAKIAKI', # 'aws_secret_access_key' => 'secret123' # } # gitlab_rails['backup_upload_remote_directory'] = 'my.s3.bucket' # gitlab_rails['backup_multipart_chunk_size'] = 104857600
-
执行备份命令
# gitlab-rake gitlab:backup:create
-
可以看到文件会存到:/var/opt/gitlab/backups
# cd /var/opt/gitlab/backups # ll total 2402464 -rw------- 1 gitlab gitlab 2460119040 Jun 20 21:47 1624196864_2021_06_20_12.3.5_gitlab_backup.tar
-
恢复
-
停止数据写入服务
# gitlab-ctl stop unicorn # gitlab-ctl stop sidekiq
-
通过gitlab-rake命令进行恢复,恢复时需要指定此前备份的名称。(单不需要写后缀的.tar后缀)
# gitlab-rake gitlab:backup:restore BACKUP=1624196864_2021_06_20_12.3.5_gitlab_backup
-
为了保险起见,重启gitlab,简称是否恢复
# gitlab-ctl restart
-
本文来自博客园,作者:makj,转载请注明原文链接:https://www.cnblogs.com/makj/p/16345594.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律