gitlab的搭建

  • 安装基础包
yum -y install curl policycoreutils openssh-server openssh-clients
  • 启动sshd
systemctl enable sshd
systemctl start sshd
  • 安装postfix
yum -y install postfix
systemctl enable postfix
systemctl start postfix
  • 添加防火墙规则
firewall-cmd --permanent --add-service=http
systemctl reload firewalld

or

yum install firewalld
systemctl unmask firewalld
  • 下载并安装软件包(软件包下载较慢)
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install gitlab-ce

添加国内的镜像源

执行上面的命令,会一直 time out ,所以我们要换成国内的源.

以下操作针对CentOS 7 ,其他的请戳 https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/

vi /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

注意,如果对应配置文件下有文件gitlab_gitlab-ce.repo,重命名一下,不然会默认加载这个导致上面的文件不起作用.

查看目前的yum进程,并杀死

ps -a
PID TTY TIME CMD
18781 pts/0 00:00:00 sudo
18783 pts/0 00:00:00 bash
18796 pts/0 00:00:00 yum
18855 pts/0 00:00:00 sudo
18856 pts/0 00:00:00 yum
18871 pts/0 00:00:00 ps kill -9 18796
kill -9 18856

然后安装:

sudo yum makecache
sudo yum install gitlab-ce

上面执行完了,是这样的展示结果

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://iZ2851te7e5Z
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab:
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab:
It looks like GitLab has not been configured yet; skipping the upgrade script.
验证中 : gitlab-ce-8.7.6-ce.0.el7.x86_64 1/1 已安装:
gitlab-ce.x86_64 0:8.7.6-ce.0.el7 完毕!

默认安装的是最新的gitlab-ce的包,如果需要特定的版本可以在官网去下载特定的版本 地址:

https://packages.gitlab.com/gitlab/gitlab-ce/
  • 配置并启动gitlab
 gitlab-ctl reconfigure
  • 默认账户密码是
Username: root
Password: 5iveL!fe

测试地址(默认80端口):

http://127.0.0.1/

2、 gitlab的备份

  • 备份命令
gitlab-rake gitlab:backup:create

默然的备份目录为:    /var/opt/gitlab/backups 备份文件名类似:       1393513186_gitlab_backup.tar

  • 备份目录的修改
vi /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = '/mnt/gitlab_backups'

3、gitlab数据的恢复或还原

提示:gitlab数据的恢复或者迁移成功的前提——两台服务器的gitlab的版本必须相同,若不相同则可能迁移或者恢复失败

  • 将备份文件放在gitlab的默认备份目录

比如/var/opt/gitlab/backups下的1458217074_gitlab_backup.tar

  • 设置自动备份
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create 
  • 恢复或者还原

停服务

 gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

恢复数据

gitlab-rake gitlab:backup:restore BACKUP=1458213020

BACKUP后面跟的是备份文件的时间戳,比如恢复备份文件1458217074_gitlab_backup.tar

gitlab-rake gitlab:backup:restore BACKUP=1458217074
  • 恢复完启动服务
 gitlab-ctl start

gitlab nginx 修改

  • 配置文件 /var/opt/gitlab/nginx/conf/gitlab-http.conf。这个文件是gitlab内置的nginx的配置文件,里面可以影响到nginx真实监听端口号。
server {
listen *:82; server_name gitlab.123.123.cn;
server_tokens off; ## Don't show the nginx version number, a security best practice
  • 修改完成后,重启下,就可以放82端口的gitlab了。
gitlab-ctl restart

gitlab redis 修改启用

默认情况下gitlab是没有启用自带的redis的(虽然redis已经和gitlab一起启动):
ok: run: gitlab-workhorse: (pid 14263) 1s
ok: run: logrotate: (pid 14271) 0s
ok: run: nginx: (pid 14278) 1s
ok: run: node-exporter: (pid 14284) 0s
ok: run: postgres-exporter: (pid 14288) 1s
ok: run: postgresql: (pid 14303) 0s
ok: run: prometheus: (pid 14312) 1s
ok: run: redis: (pid 14317) 0s
ok: run: redis-exporter: (pid 14320) 0s
ok: run: sidekiq: (pid 14330) 1s
ok: run: unicorn: (pid 14336) 0s

启用自带的redis,修改/etc/gitlab/gitlab.rb:

redis['port'] = 6379
redis['bind'] = '127.0.0.1'
[root@localhost ~]# gitlab-ctl reconfigure

可以看到redis-server和端口6379,redis已经开始工作了:

Running handlers:
Running handlers complete
Chef Client finished, 15/397 resources updated in 25 seconds
gitlab Reconfigured! [root@localhost ~]# gitlab-ctl restart

[root@localhost ~]# ps -ef|grep redis
root 639 632 0 14:54 ? 00:00:00 runsv redis
root 649 632 0 14:54 ? 00:00:00 runsv redis-exporter
root 653 639 0 14:54 ? 00:00:00 svlogd -tt /var/log/gitlab/redis
root 668 649 0 14:54 ? 00:00:00 svlogd -tt /var/log/gitlab/redis-exporter
gitlab-+ 14317 639 0 16:36 ? 00:00:00 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:6379
gitlab-+ 14320 649 0 16:36 ? 00:00:00 /opt/gitlab/embedded/bin/redis_exporter -web.listen-address=localhost:9121 -redis.addr=unix:///var/opt/gitlab/redis/redis.socket
root 14376 8935 0 16:36 pts/2 00:00:00 grep --color=auto redis

访问一下gitlab主页和各页面,然后查看redis里的缓存清况,已经出现缓存内容了:

[root@localhost ~]# /opt/gitlab/embedded/bin/redis-cli
127.0.0.1:6379> keys *
1) "resque:gitlab:cron_job:admin_email_worker"
2) "resque:gitlab:cron_job:repository_archive_cache_worker"
3) "resque:gitlab:limit_fetch:probed:repository_import"
4) "cache:gitlab:last_commit_id_for_path:2af1c3ff162bb2...................

详细文档:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/redis.md


CentOS7下gitlab的搭建的更多相关文章

  1. centos7下git服务器端搭建

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  2. centos7下git服务器端搭建(转)

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  3. 【MIT6.828】centos7下使用Qemu搭建xv6运行环境

    title:[MIT6.828]centos7下使用Qemu搭建xv6运行环境 date: "2020-05-05" [MIT6.828]centos7下搭建xv6运行环境 1. ...

  4. 基于CentOS7.x gitlab环境搭建,卸载,汉化 --汉化篇

    gitlab环境搭建,卸载,汉化--汉化篇 注意gitlab的版本需和汉化版本一致 安装git yum install -y git 下载最新的汉化包 cd git clone https://git ...

  5. 基于CentOS7.x gitlab环境搭建,卸载,汉化 --搭建篇

    gitlab环境搭建,卸载,汉化 --搭建篇 环境搭建 安装依赖软件 yum -y install policycoreutils openssh-server openssh-clients pos ...

  6. Linux centos7 下 svn 服务器搭建

    摘自:https://www.cnblogs.com/mymelon/p/5483215.html 鉴于在搭建时,参考网上很多资料,网上资料在有用的同时,也坑了很多人 本文的目的,也就是想让后继之人在 ...

  7. 基于CentOS7.x gitlab环境搭建,卸载,汉化 --卸载篇

    gitlab环境搭建,卸载,汉化 --卸载篇 完全卸载 停止gitlab gitlab-ctl stop 卸载gitlab rpm -e gitlab-ce 查看gitlab进程  ps aux | ...

  8. 基于centos7下appium环境搭建

    事件背景: 前几日在群里看到关总说他的server端是搭建在linux环境下,包括对客户端与服务端的交互处理,感觉整体思路清晰可鉴,于是就想尝试,动手实践,接着从环境搭建开始搞起,于是就有了这篇文章, ...

  9. Centos7下用FastDFS搭建图片服务器

    1.所用到的工具: 1.FastDFS_v5.05.tar 2.fastdfs-nginx-module_v1.16.tar 3.libfastcommonV1.0.7.tar 4.nginx-1.1 ...

随机推荐

  1. Xcode 折叠代码快捷键

    Xcode9之前版本可以代码局部和全局折叠,但是9之后只能以某个函数为单位进行全局折叠,特别是里面的逻辑判断的代码不能局部折叠了... Xcode9之前版本代码折叠: 在Xcode菜单里选择Prefe ...

  2. activemq , redis

    activemq是干什么的?即时消息通信,简单说: A发送消息给activemq 服务,B监听服务获取消息.假如有如下场景: A发送了一个请求,但是这个请求需要做 10 项工作,如果按照正常操作,需要 ...

  3. unity luaFramework

    1 AppConst: DebugMode: 调试模式,true:lua脚本直接读取自 AssetDir,false:开始会将AssetDir内的lua脚本复制到 Util.DataPath内(根据平 ...

  4. python 部分数据处理代码

    # -*- coding:utf8 -*- import os import jieba.posseg as pseg # -*- coding:utf8 -*- import os  def spl ...

  5. Hibernate validator的一些额外特性

    分组验证及分组顺序 如果我们想在新增的情况验证id和name,而修改的情况验证name和password,怎么办? 那么就需要分组了. 首先定义分组接口://分组接口就是两个普通的接口,用于标识,类似 ...

  6. maven打包证(支付)书问题

    要将证书文件后缀添加到resource文件夹内范围,添加打包文件后缀(include) 添加maven配置: <resources> <resource> <direct ...

  7. python入门之深浅copy

    a1=["a","b","c","aa"] b1=a1 a1[0]=" print(a1,b1) 此时结果为: ...

  8. python学习 day15 (3月20日)----time

    # '2019-03-20 10:40:00'#这个时间向后推一个月 f1 = time.strptime('2019-03-20 10:40','%Y-%m-%d %H:%M') # 把字符串时间转 ...

  9. python基本数据类型之字符串(一)

    python中字符串中有很多方法,具体方法如下图所示: 分割方法 字符串的分割方法: 1.join方法: join方法是字符串方法中最重要的方法之一,它的作用是将某一字符插入到字符串中用作连接. 具体 ...

  10. .net 根据图片网络地址获取图片二进制字节数据流

    根据html路径获取图片的字节 /// <summary> ///根据html路径获取图片的字节 /// </summary> /// <param name=" ...