gitlab的安装

5、安装要求

复制代码
#系统要求
Ubuntu (16.04/18.04/20.04)
Debian (9/10)
CentOS (7/8)
openSUSE Leap (15.2)
SUSE Linux Enterprise Server (12 SP2/12 SP5)
Red Hat Enterprise Linux (please use the CentOS packages and instructions)
#硬件要求
##磁盘
存放代码,比代码空间大  
7.2k以上的磁盘 sas 
 ssd  
##CPU 
4 核心 500用户
8 核心 1000用户
##内存
4 G内存 500用户
8 G内存 1000用户
复制代码

5.1 安装依赖

#1. 关闭防火墙
#2. 安装gitlab所有依赖
yum install -y    curl openssh-server   postfix  wget
5.2 安装Gitlab组件
复制代码
# 下载安装 gitlab-ce-12.0.3 
#yum install -y https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.0.3-ce.0.el7.x86_64.rpm
#https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.0.3-ce.0.el7.x86_64.rpm
 yum localinstall -y   xxxx.rpm   # 安装成功提示
GitLab was unable to detect a valid hostname for your instance.

Please configure a URL for your GitLab instance by setting `external_url`  #修改gitlab配置文件 设置 gitlab

url (server_name)

configuration in /etc/gitlab/gitlab.rb file.  #配置文件的路径和名字

Then, you can start your GitLab instance by running the following command:

 sudo gitlab-ctl reconfigure      #初始化(重新配置)

For a comprehensive list of configuration options please see the Omnibus GitLab readme

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
external_url 'http://gitlab.oldboylinux.com'  #gitlab url
复制代码

5.4初始化

复制代码
gitlab-ctl reconfigure 
Chef Client finished, 345/855 resources updated in 02 minutes 25 seconds
gitlab Reconfigured!
[root@devops-gitlab ~]# gitlab-ctl status |column -t 
run: alertmanager:       (pid  3497) 886s;   run: log: (pid  3077) 958s
run: gitaly:             (pid  3330) 890s;   run: log: (pid  2436) 1100s
run: gitlab-monitor:     (pid  3384) 889s;   run: log: (pid  2944) 976s
run: gitlab-workhorse:   (pid  3357) 890s;   run: log: (pid  2847) 999s
run: grafana:           (pid  3524) 885s;   run: log: (pid  3280) 908s
run: logrotate:         (pid  2885) 989s;   run: log: (pid  2894) 988s
run: nginx:             (pid  2862) 995s;   run: log: (pid  2873) 994s
run: node-exporter:     (pid  3373) 889s;   run: log: (pid  2929) 982s
run: postgres-exporter: (pid  3515) 886s;   run: log: (pid  3125) 952s
run: postgresql:         (pid  2484) 1090s; run: log: (pid  2575) 1087s
run: prometheus:         (pid  3399) 888s;   run: log: (pid  3030) 962s
run: redis:             (pid  2398) 1107s; run: log: (pid  2407) 1104s
run: redis-exporter:     (pid  3387) 888s;   run: log: (pid  2965) 969s
run: sidekiq:           (pid  2788) 1008s; run: log: (pid  2797) 1004s
run: unicorn:           (pid  2756) 1014s; run: log: (pid  2782) 1011s
gitlab-cli status 
gitlab-cli  stop
gitlab-cli  start

登录 root:密码
复制代码

5.5 

1.使用git下载汉化补丁包
复制代码
[root@gitlab ~]# wget https://gitlab.com/xhang/gitlab/-/archive/12-0-stable-zh/gitlab-12-0-stable-zh.tar.gz
[root@gitlab ~]# tar xf gitlab-12-0-stable-zh.tar.gz
[root@gitlab ~]# cat gitlab-12-0-stable-zh/VERSION #查看汉化版本是否与gitlab版本一致
12.0.3
#
[root@gitlab ~]# cat gitlab-12-0-stable-zh/VERSION 
12.0.3
[root@gitlab ~]# rpm -qa |grep gitlab 
gitlab-ce-12.0.3-ce.0.el7.x86_64
[root@gitlab ~]#
复制代码
2.停止gitlab,进行中文汉化
复制代码
#停止 gitlab 服务
[root@gitlab ~]# gitlab-ctl stop
#中文版覆盖英文版
[root@gitlab ~]# \cp -r gitlab-12-0-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/

#全流程
tar xf gitlab-12-0-stable-zh.tar.gz
cat gitlab-12-0-stable-zh/VERSION
rpm -qa |grep gitlab
gitlab-ctl stop
du -sh /opt/gitlab/embedded/service/gitlab-rails/
tar zcf /tmp/gitlab-rails.tar.gz   /opt/gitlab/embedded/service/gitlab-rails/
\cp -r gitlab-12-0-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/
 
复制代码
3.重启gitlab,验证汉化结果
#重新配置gitlab服务
[root@gitlab ~]# gitlab-ctl reconfigure
#重启gitlab服务
[root@gitlab ~]# gitlab-ctl restart

4.配置中文

 

 5.6推送代码指令

git remote rename origin old-origin
git remote add origin http://gitlab.oldboylinux.cn/root/lidao-live-g.git
git push -u origin --all
git push -u origin --tags

5.7 gitlab定时备份

复制代码
#每天备份1次
#!/bin/bash
#author :lidao996 
#desc : backup gitlab all  
#0.关闭gitlab 
#1.备份gitlab数据
gitlab-rake   gitlab:backup:create    
#2.备份gitlab配置和密码文件
tar zcf /backup/gitlab/gitlab-conf-$(date +%F).tar.gz   /etc/gitlab/
#写入定时任务
00 03 * * * sh /server/scripts/backup-gitlab.sh
复制代码
7.4 恢复 
复制代码
1. 停止写入类服务
gitlab-ctl  stop unicorn 
gitlab-ctl stop sidekiq
2. gitlab-rake恢复 (不需要加tar)
gitlab-rake gitlab:backup:restore    BACKUP=备份文件
#新版本: 
gitlab-backup restore                 BACKUP=11493107454_2018_04_25_10.6.4-ce
#旧版本
gitlab-rake gitlab:backup:restore    BACKUP=备份文件
3. 重启 gitlab 
gitlab-ctl restart
复制代码

 

posted @   秉烛夜游~游山玩水  阅读(174)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示