目录

  • 一、下载地址
  • 二、安装
    • 1.配置 yum 源
    • 2.更新本地 yum 缓存
    • 3.安装 GitLab 社区版
    • 4.初始化
    • 5.修改端口
    • 6.修改外部链接
    • 7.查看版本号
    • 8.登录
  • 三、备份和恢复
    • 1.备份
    • 2.恢复
  • 四、卸载及重装
    • 1.卸载
      • (1)停服务
      • (2)卸载
      • (3)杀进程
      • (4)删文件
    • 2.重装问题
      • (1)postgre 问题
      • (2)Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '255'
      • (3)Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
      • (4)ruby_block[wait for redis service socket] action run

一、下载地址

Gitlab下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

二、安装

1.配置 yum 源

vi /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

2.更新本地 yum 缓存

yum makecache

3.安装 GitLab 社区版

自动安装最新版:

yum install gitlab-ce

或下载安装包安装:

rpm -ivh gitlab-ce-15.4.2-ce.0.el7.x86_64.rpm

4.初始化

gitlab-ctl reconfigure

5.修改端口

vi /etc/gitlab/gitlab.rb
nginx['listen_port'] = 8000
vi  /var/opt/gitlab/nginx/conf/gitlab-http.conf
server {listen *:80;server_name 192.168.1.60;

修改完成后,执行:

gitlab-ctl reconfigure
gitlab-ctl restart

6.修改外部链接

vi /etc/gitlab/gitlab.rb
external_url 'http://gitlab.example.com'

改为:

external_url '192.168.1.60'

7.查看版本号

cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

8.登录

打开浏览器,输入 “http:/192.168.1.60”,进入登录页面:

默认账户名是 root,密码存放在配置文件:

/etc/gitlab/initial_root_password

该文件将在首次执行 reconfigure 后 24 小时自动删除,文件内容如下:

# 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: /XhuNwa6xVjEMYmPthcOFUiaub/8bAWHn2C1jOFjrwI=# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

三、备份和恢复

1.备份

修改gitlab的备份路径:

vi /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"

重启gitlab服务:

gitlab-ctl restart

备份命令:

gitlab-rake gitlab:backup:create

2.恢复

为保证数据的一致性先停止数据连接服务:

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

恢复(注意:不用带_gitlab_backup.tar后缀):

gitlab-rake gitlab:backup:restore BACKUP=/var/opt/gitlab/backups/1575249855

启动刚才停的服务:

gitlab-ctl start unicorn
gitlab-ctl start sidekiq

或重启gitlab服务:

gitlab-ctl restart

四、卸载及重装

1.卸载

(1)停服务

gitlab-ctl stop

(2)卸载

yum remove gitlab-ce

rpm -qa|grep gitlab
rpm -e rpm -e gitlab-ce-15.4.2-ce.0.el7.x86_64.rpm

(3)杀进程

ps -ef|grep gitlab
kill xxx

(4)删文件

rm -rf /opt/gitlab/
rm -rf /var/log/gitlab/
rm -rf /var/opt/gitlab/

find / -name *gitlab*|xargs rm -rf

2.重装问题

(1)postgre 问题

卸载后重装,有时会报 postgre 错误:

data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.0

解决方法:
删除 postgre 相关目录后再重新安装:

rm -rf /opt/gitlab/
rm -rf /var/log/gitlab/
rm -rf /var/opt/gitlab/

find / -name *gitlab*|xargs rm -rf

(2)Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘255’

执行 gitlab-ctl reconfigure 还可能出现以下错误:

Running handlers:
There was an error running gitlab-ctl reconfigure:gitlab_sysctl[kernel.shmmax] (postgresql::enable line 67) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[load sysctl conf kernel.shmmax] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/gitlab_sysctl.rb line 46) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '255'
---- Begin output of sysctl -e --system ----
STDOUT: * Applying /usr/lib/sysctl.d/00-system.conf ...
* Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...
kernel.yama.ptrace_scope = 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 ...
* 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-kernel.shmall.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

解决方法:

touch /opt/gitlab/embedded/etc/90-omnibus-gitlab-kernel.sem.conf
touch /opt/gitlab/embedded/etc/90-omnibus-gitlab-net.core.somaxconn.conf

(3)Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’

继续报错:

Running handlers:
There was an error running gitlab-ctl reconfigure:bash[migrate gitlab-rails database] (gitlab::database_migrations line 54) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20221013-16235-vjrh02" ----
STDOUT: rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directoryIs the server running locally and acceptingconnections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:48:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => gitlab:db:configure
(See full trace by running task with --trace)
STDERR:
---- End output of "bash"  "/tmp/chef-script20221013-16235-vjrh02" ----
Ran "bash"  "/tmp/chef-script20221013-16235-vjrh02" returned 1

解决方法:

gitlab-ctl stop
chmod 0755 /var/opt/gitlab/postgresql
systemctl restart gitlab-runsvdir
#重启
gitlab-ctl reconfigure
gitlab-ctl restart

(4)ruby_block[wait for redis service socket] action run

执行 gitlab reconfigure 卡在 ruby_block[wait for redis service socket] action run。
解决方法:
执行命令:

systemctl start gitlab-runsvdir

CentOS7下安装GitLab相关推荐

  1. 【DevOps】centos7 下的 gitlab托管服务器的介绍与安装

    文章目录 前言 gitlab的介绍 gitlab 和github的区别 gitlab的安装 1. 实验环境: 2. 安装和配置必要的依赖项 3. 添加yum源 4. 更新本地yum缓存,并安装 5. ...

  2. Centos7下安装Docker

    Centos7下安装Docker(详细的新手装逼教程) 参考: https://www.cnblogs.com/qgc1995/archive/2018/08/29/9553572.html 早就听说 ...

  3. linux 安装redis2.8.3,centos7下安装Redis2.8版本步骤

    Redis 简介 Redis支持数据的持久化,可以将内存中的数据保存在磁盘中,重启的时候可以再次加载进行使用. Redis不仅仅支持简单的key-value类型的数据,同时还提供list,set,zs ...

  4. linux Centos7下安装python3及pip3

    linux Centos7下安装python3及pip3 先去python官网下载python3安装包 执行命令: wget https://www.python.org/ftp/python/3.6 ...

  5. 学习笔记(1)centos7 下安装nginx

    学习笔记(1)centos7 下安装nginx 这里我是通过来自nginx.org的nginx软件包进行安装的. 1.首先为centos设置添加nginx的yum存储库 1.通过vi命令创建一个rep ...

  6. centos7下安装mariadb

    centos7下安装mariadb 参考: http://www.cnblogs.com/Netsharp/p/5875474.html https://downloads.mariadb.org/m ...

  7. CentOS7下安装nginx1.99

    文章目录 1.前期准备 1.1 安装gcc 1.2 安装其他依赖包 1.3 下载安装包 2.安装nginx 2.1 解压nginx 2.2 编译安装 2.3 启动 2.4 常用命令 3.Nginx配置 ...

  8. CentOS7下安装GUI图形界面

    1.如何在centOS7下安装GUI图形界面 当你安装centOS7服务器版本的时候,系统默认是不会安装GUI的图形界面程序,这个需要手动安装CentOS7 Gnome GUI包. 2.在系统下使用命 ...

  9. 在CentOS7下安装MySQL8数据库

    在CentOS7下安装MySQL8数据库 一 准备Linux环境 默认已安装:Linux虚拟机+ CentOS 笔者用的是如下版本: VMware15:VMware-workstation-full- ...

最新文章

  1. 一行代码解决对象数组排序(sort)
  2. mysql error1045 yes_MySQLERROR1045(28000)错误的解决办法_MySQL
  3. 有事情不能第一时间给父母说
  4. zip伪加密做法及原理
  5. php ssc 源码_吃透这篇,你也能搭建出一个高并发和高性能的系统
  6. 线条边框简笔画图片大全_超治愈萌系手帐素材大全 美食旅游花草人物花边都备齐了...
  7. linux cnc_CNC的完整形式是什么?
  8. 004-linux常用命令-权限管理命令
  9. 华为徐直军:今年超3亿设备搭载鸿蒙系统
  10. 常用库函数_跑马灯实验和我为什么使用库函数?
  11. 防止重复点击提交,仅提交一次的终极绝杀技[高清、有码]
  12. 2016.04.06 UITabBar+badge.h
  13. 漫威女性电影背后所体现出来的性别观念转变
  14. find()和findIndex()区别和用法
  15. Oracle 11g RAC 修改服务器各类ip地址【转载】
  16. python3跑通smpl模型_SMPL模型改用python3+numpy计算
  17. IP-GUARD加密文件无法打开或者打开时显示乱码
  18. access创建窗体特别慢_Access 2016 创建窗体
  19. PEP8 Python代码编程规范(摘录整理于官网)
  20. cuug内部oracle视频教程-oracle sql_tune

热门文章

  1. qq录屏后屏幕中间出现黑色方块
  2. JavaScript获取某年某月的最后一天
  3. C语言求摩尔数,[蓝桥杯][算法提高VIP]摩尔斯电码 (C语言代码)
  4. W11如何跳过OOBE联网进到桌面
  5. source tree 关联gitlab/github账号 实现项目管理
  6. 如何在Android实现桌面清理内存简单Widget小控件
  7. java魔方阵_魔方阵 Java实现转载
  8. (二)python爬虫基础知识续
  9. 我们常说的十三薪、十五薪这种,能百分之百发下来吗?它和年终奖有什么区别?
  10. 数据库 课后习题答案