Redhat Linux 6 安装使用 gitlab_redfla6离线安装git-程序员宅基地

一、安装gitlab

清华大学镜像网站下载对应的rpm包

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-12.0.3-ce.0.el6.x86_64.rpm

[root@admin Downloads]# rpm -ivh gitlab-ce-12.0.3-ce.0.el6.x86_64.rpm
warning: gitlab-ce-12.0.3-ce.0.el6.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
        openssh-server is needed by gitlab-ce-12.0.3-ce.0.el6.x86_64

http://www.rpmfind.net/linux/centos/6.10/updates/x86_64/Packages/openssh-server-5.3p1-124.el6_10.x86_64.rpm下载openssh-server的rpm包。

安装openssh-server时又遇到openssh依赖,如下:

[root@admin Downloads]# rpm -ivh openssh-server-5.3p1-124.el6_10.x86_64.rpm
warning: openssh-server-5.3p1-124.el6_10.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
        openssh = 5.3p1-124.el6_10 is needed by openssh-server-5.3p1-124.el6_10.x86_64

http://www.rpmfind.net/linux/centos/6.10/updates/x86_64/Packages/openssh-5.3p1-124.el6_10.x86_64.rpm下载openssh的rpm包。安装后即可顺利安装openssh-server和gitlab。

[root@admin Downloads]# rpm -ivh openssh-5.3p1-124.el6_10.x86_64.rpm
warning: openssh-5.3p1-124.el6_10.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:openssh                warning: /etc/ssh/moduli created as /etc/ssh/moduli.rpmnew
########################################### [100%]
[root@admin Downloads]# rpm -ivh openssh-server-5.3p1-124.el6_10.x86_64.rpm
warning: openssh-server-5.3p1-124.el6_10.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:openssh-server         warning: /etc/pam.d/sshd created as /etc/pam.d/sshd.rpmnew
warning: /etc/ssh/sshd_config created as /etc/ssh/sshd_config.rpmnew
########################################### [100%]
[root@admin Downloads]# rpm -ivh gitlab-ce-12.0.3-ce.0.el6.x86_64.rpm
warning: gitlab-ce-12.0.3-ce.0.el6.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing...                ########################################### [100%]
   1:gitlab-ce              ########################################### [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.



     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
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

 

二、配置gitlab

gitlab内置了nginx的服务,所以默认会占用80和443端口。如果服务器上之前安装过nginx或者apache,把80和443端口给占了,就需要修改端口防止冲突。但是如果修改了端口,访问的时候就要带上端口号,比较麻烦且看起来不好看。比较好的办法是使用自己安装的nginx做反向代理,连接到gitlab的nginx。

1. 安装nginx

http://nginx.org/packages/rhel/6/x86_64/RPMS/nginx-1.16.0-1.el6.ngx.x86_64.rpm 下载rpm包,

[root@admin Downloads]# rpm -ivh nginx-1.16.0-1.el6.ngx.x86_64.rpm
warning: nginx-1.16.0-1.el6.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
Preparing...                ########################################### [100%]
   1:nginx                  ########################################### [100%]
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* http://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------

 

启动nginx:

#显示nginx的配置路径
[root@admin Downloads]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

#启动nginx并检查进程和监听端口
[root@admin Downloads]# nginx
[root@admin Downloads]# ps -ef | grep nginx
root     121141      1  0 19:26 ?        00:00:00 nginx: master process nginx
nginx    121142 121141  0 19:26 ?        00:00:00 nginx: worker process
root     121144 115450  0 19:26 pts/17   00:00:00 grep nginx
[root@admin Downloads]# netstat -anp | grep 80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      121141/nginx

nginx启动后,可以从浏览器访问主机地址的80端口,如下:

 

2. 配置nginx并重启

编辑nginx的配置文件/etc/nginx/nginx.conf, 改配置的全部内容如下:


user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;

    upstream gitlab-workhorse {  
        server  localhost:8181;  //这里对应的是gitlab配置文件中定义的IP地址和端口号
    }

    server {
        listen 80;
        listen [::]:80 default_server;
        server_name 10.0.74.179;  //这里用IP地址或者用域名
        server_tokens off; ## Don't show the nginx version number, a security best practice
        root /opt/gitlab/embedded/service/gitlab-rails/public;

        ## See app/controllers/application_controller.rb for headers set

        ## Individual nginx logs for this GitLab vhost
        #access_log  /home/wwwlogs/gitlab_access.log; # 根据实际情况修改
        #error_log   /home/wwwlogs/gitlab_error.log; # 根据实际情况修改

        location / {
            # 设置最大允许上传单个的文件大小
            client_max_body_size 1024m;
            gzip off;
            proxy_redirect off;

            proxy_http_version 1.1;

            #以下确保 gitlab中项目的 url 是域名而不是 http://git,不可缺少
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;

            # 反向代理到 gitlab
            proxy_pass http://gitlab-workhorse;
        }
    }
}

配置完成后重新启动一下nginx,如下:

# 检测配置是否正确
$ nginx -t

# 重启nginx
$ nginx -s reload

#停止nginx
$ service nginx stop

#启动nginx
$ service nginx start

 

3. 配置gitlab并重启

编辑gitlab的配置文件/etc/gitlab/gitlab.rb,需要更改的内容如下:

external_url 'http://10.0.74.179'    #这里是域名或者IP地址
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "localhost:8181" #这里要与nginx配置中的代理指向的地址一致
unicorn['port'] = 8182  #unicorn的监听端口,不能与其他应用的监听端口冲突,否则会出错
web_server['external_users'] = ['nginx'] #这个user要跟nginx配置中的user一致
nginx['enable'] = false  #关闭gitlab中自带的nginx

使用下面命令中的reconfigure命令来更新配置并重启: 

#开启
gitlab-ctl start

#关闭
gitlab-ctl stop

#重启
gitlab-ctl restart

#重新配置并重启 -- 一般修改了配置文件后都要运行改命令
gitlab-ctl reconfigure 

#查看状态
gitlab-ctl status

4. 从浏览器输入IP地址访问gitlab,安装成功的话会看到如下界面:

首次登陆会要求重置管理员密码,管理员的默认用户名为root。

 

参考资料:

【1】https://www.centos.bz/2018/01/centos-7-x%E4%B8%8Agitlab%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8Bhttps%E5%8F%AF%E7%94%A8%EF%BC%8C%E9%82%AE%E4%BB%B6%E5%8F%AF%E7%94%A8/  CentOS 7.x上gitlab搭建教程(https可用,邮件可用)

【2】https://www.cnblogs.com/xudong-bupt/p/8661523.html  正向代理与反向代理区别图解 (nginx)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/wqfhenanxc/article/details/95505727

智能推荐

攻防世界_难度8_happy_puzzle_攻防世界困难模式攻略图文-程序员宅基地

文章浏览阅读645次。这个肯定是末尾的IDAT了,因为IDAT必须要满了才会开始一下个IDAT,这个明显就是末尾的IDAT了。,对应下面的create_head()代码。,对应下面的create_tail()代码。不要考虑爆破,我已经试了一下,太多情况了。题目来源:UNCTF。_攻防世界困难模式攻略图文

达梦数据库的导出(备份)、导入_达梦数据库导入导出-程序员宅基地

文章浏览阅读2.9k次,点赞3次,收藏10次。偶尔会用到,记录、分享。1. 数据库导出1.1 切换到dmdba用户su - dmdba1.2 进入达梦数据库安装路径的bin目录,执行导库操作  导出语句:./dexp cwy_init/[email protected]:5236 file=cwy_init.dmp log=cwy_init_exp.log 注释:   cwy_init/init_123..._达梦数据库导入导出

js引入kindeditor富文本编辑器的使用_kindeditor.js-程序员宅基地

文章浏览阅读1.9k次。1. 在官网上下载KindEditor文件,可以删掉不需要要到的jsp,asp,asp.net和php文件夹。接着把文件夹放到项目文件目录下。2. 修改html文件,在页面引入js文件:<script type="text/javascript" src="./kindeditor/kindeditor-all.js"></script><script type="text/javascript" src="./kindeditor/lang/zh-CN.js"_kindeditor.js

STM32学习过程记录11——基于STM32G431CBU6硬件SPI+DMA的高效WS2812B控制方法-程序员宅基地

文章浏览阅读2.3k次,点赞6次,收藏14次。SPI的详情简介不必赘述。假设我们通过SPI发送0xAA,我们的数据线就会变为10101010,通过修改不同的内容,即可修改SPI中0和1的持续时间。比如0xF0即为前半周期为高电平,后半周期为低电平的状态。在SPI的通信模式中,CPHA配置会影响该实验,下图展示了不同采样位置的SPI时序图[1]。CPOL = 0,CPHA = 1:CLK空闲状态 = 低电平,数据在下降沿采样,并在上升沿移出CPOL = 0,CPHA = 0:CLK空闲状态 = 低电平,数据在上升沿采样,并在下降沿移出。_stm32g431cbu6

计算机网络-数据链路层_接收方收到链路层数据后,使用crc检验后,余数为0,说明链路层的传输时可靠传输-程序员宅基地

文章浏览阅读1.2k次,点赞2次,收藏8次。数据链路层习题自测问题1.数据链路(即逻辑链路)与链路(即物理链路)有何区别?“电路接通了”与”数据链路接通了”的区别何在?2.数据链路层中的链路控制包括哪些功能?试讨论数据链路层做成可靠的链路层有哪些优点和缺点。3.网络适配器的作用是什么?网络适配器工作在哪一层?4.数据链路层的三个基本问题(帧定界、透明传输和差错检测)为什么都必须加以解决?5.如果在数据链路层不进行帧定界,会发生什么问题?6.PPP协议的主要特点是什么?为什么PPP不使用帧的编号?PPP适用于什么情况?为什么PPP协议不_接收方收到链路层数据后,使用crc检验后,余数为0,说明链路层的传输时可靠传输

软件测试工程师移民加拿大_无证移民,未受过软件工程师的教育(第1部分)-程序员宅基地

文章浏览阅读587次。软件测试工程师移民加拿大 无证移民,未受过软件工程师的教育(第1部分) (Undocumented Immigrant With No Education to Software Engineer(Part 1))Before I start, I want you to please bear with me on the way I write, I have very little gen...

随便推点

Thinkpad X250 secure boot failed 启动失败问题解决_安装完系统提示secureboot failure-程序员宅基地

文章浏览阅读304次。Thinkpad X250笔记本电脑,装的是FreeBSD,进入BIOS修改虚拟化配置(其后可能是误设置了安全开机),保存退出后系统无法启动,显示:secure boot failed ,把自己惊出一身冷汗,因为这台笔记本刚好还没开始做备份.....根据错误提示,到bios里面去找相关配置,在Security里面找到了Secure Boot选项,发现果然被设置为Enabled,将其修改为Disabled ,再开机,终于正常启动了。_安装完系统提示secureboot failure

C++如何做字符串分割(5种方法)_c++ 字符串分割-程序员宅基地

文章浏览阅读10w+次,点赞93次,收藏352次。1、用strtok函数进行字符串分割原型: char *strtok(char *str, const char *delim);功能:分解字符串为一组字符串。参数说明:str为要分解的字符串,delim为分隔符字符串。返回值:从str开头开始的一个个被分割的串。当没有被分割的串时则返回NULL。其它:strtok函数线程不安全,可以使用strtok_r替代。示例://借助strtok实现split#include <string.h>#include <stdio.h&_c++ 字符串分割

2013第四届蓝桥杯 C/C++本科A组 真题答案解析_2013年第四届c a组蓝桥杯省赛真题解答-程序员宅基地

文章浏览阅读2.3k次。1 .高斯日记 大数学家高斯有个好习惯:无论如何都要记日记。他的日记有个与众不同的地方,他从不注明年月日,而是用一个整数代替,比如:4210后来人们知道,那个整数就是日期,它表示那一天是高斯出生后的第几天。这或许也是个好习惯,它时时刻刻提醒着主人:日子又过去一天,还有多少时光可以用于浪费呢?高斯出生于:1777年4月30日。在高斯发现的一个重要定理的日记_2013年第四届c a组蓝桥杯省赛真题解答

基于供需算法优化的核极限学习机(KELM)分类算法-程序员宅基地

文章浏览阅读851次,点赞17次,收藏22次。摘要:本文利用供需算法对核极限学习机(KELM)进行优化,并用于分类。

metasploitable2渗透测试_metasploitable2怎么进入-程序员宅基地

文章浏览阅读1.1k次。一、系统弱密码登录1、在kali上执行命令行telnet 192.168.26.1292、Login和password都输入msfadmin3、登录成功,进入系统4、测试如下:二、MySQL弱密码登录:1、在kali上执行mysql –h 192.168.26.129 –u root2、登录成功,进入MySQL系统3、测试效果:三、PostgreSQL弱密码登录1、在Kali上执行psql -h 192.168.26.129 –U post..._metasploitable2怎么进入

Python学习之路:从入门到精通的指南_python人工智能开发从入门到精通pdf-程序员宅基地

文章浏览阅读257次。本文将为初学者提供Python学习的详细指南,从Python的历史、基础语法和数据类型到面向对象编程、模块和库的使用。通过本文,您将能够掌握Python编程的核心概念,为今后的编程学习和实践打下坚实基础。_python人工智能开发从入门到精通pdf