Centos6.5 安装gitlab 并使用自带的nginx

Centos6.5 安装gitlab 并使用自带的nginx

1.安装依赖

yum -y install policycoreutils openssh-server openssh-clients postfix policycoreutils-python

2.设置postfix开机启动

chkconfig postfix on &&  service postfix start

3.下载安装包

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

放入/opt中

4.安装

rpm -i gitlab-ce-11.4.4-ce.0.el6.x86_64.rpm 
It looks like GitLab has not been configured yet; skipping the upgrade script.

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

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

Thank you for installing GitLab!

5.修改配置

vim /etc/gitlab/gitlab.rb

关闭自带的nginx

配置地址

external_url 'http://xxx.xxx.xxx.xxx'

禁用自带nginx

nginx['enable'] = false

6.nginx 增加虚拟主机配置

# gitlab socket 文件地址
upstream gitlab {
  server unix:/var/opt/gitlab/gitlab-workhorse/socket;
}

server {
  listen *:80;

  server_name gitlab.demo.com;   # 请修改为你的域名

  server_tokens off;     # don't show the version number, a security best practice
  root /opt/gitlab/embedded/service/gitlab-rails/public;

  # Increase this if you want to upload large attachments
  # Or if you want to accept large git objects over http
  client_max_body_size 250m;

  # individual nginx logs for this gitlab vhost
  access_log  /var/log/gitlab/gitlab_access.log;
  error_log    /var/log/gitlab/gitlab_error.log;

  location / {
    # serve static files from defined root folder;.
    # @gitlab is a named location for the upstream fallback, see below
    try_files $uri $uri/index.html $uri.html @gitlab;
  }

  # if a file, which is not found in the root folder is requested,
  # then the proxy pass the request to the upsteam (gitlab unicorn)
  location @gitlab {
    # If you use https make sure you disable gzip compression
    # to be safe against BREACH attack

    proxy_read_timeout 300; # Some requests take more than 30 seconds.
    proxy_connect_timeout 300; # Some requests take more than 30 seconds.
    proxy_redirect     off;

    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   Host              $http_host;
    proxy_set_header   X-Real-IP         $remote_addr;
    proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header   X-Frame-Options   SAMEORIGIN;

    proxy_pass http://gitlab;
  }

  # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
  # WARNING: If you are using relative urls do remove the block below
  # See config/application.rb under "Relative url support" for the list of
  # other files that need to be changed for relative url support
  location ~ ^/(assets)/  {
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    # gzip_static on; # to serve pre-gzipped version
    expires max;
    add_header Cache-Control public;
  }

  error_page 502 /502.html;
}

7.重启是配置生效。


### 重启gitlab使配置生效 ###
gitlab-ctl econfigure

### 重启nginx使配置生效 ###
service nginx restart

查看状态

gitlab-ctl status

其他指令

gitlab-ctl start
gitlab-ctl stop
gitlab-ctl restart
gitlab-ctl help

# ps -ef |grep nginx
root      1905     1  0 14:48 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
www       1906  1905  0 14:48 ?        00:00:00 nginx: worker process
www       1907  1905  0 14:48 ?        00:00:00 nginx: worker process
root     13734  2883  0 15:13 pts/0    00:00:00 grep nginx
# ps -ef |grep unicorn
root      1018  1008  0 14:48 ?        00:00:00 runsv unicorn
root      1044  1018  0 14:48 ?        00:00:00 svlogd -tt /var/log/gitlab/unicorn
git      13360  1018  0 15:12 ?        00:00:00 /bin/bash /opt/gitlab/embedded/bin/gitlab-unicorn-wrapper
git      13381     1 29 15:12 ?        00:00:17 unicorn master -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git      13461 13381  0 15:12 ?        00:00:00 unicorn worker[0] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git      13464 13381  0 15:12 ?        00:00:00 unicorn worker[1] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git      13467 13381  0 15:12 ?        00:00:00 unicorn worker[2] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
root     13753  2883  0 15:13 pts/0    00:00:00 grep unicorn

停止gitlab

gitlab-ctl stop
gitlab-ctl reconfigure
gitlab-ctl restart

修改unicorn,给nginx用户权限。

unicorn['port'] = 1024
web_server['external_users'] = ['www','gitlab-www','root','git']
sudo chmod -R o+x /var/opt/gitlab/gitlab-rails
sudo chmod -R o+x /var/opt/gitlab/gitlab-workhorse
sudo usermod -aG git www
sudo usermod -aG gitlab-www www

查看错误日志

tail -n 10 /var/log/gitlab/gitlab_error.log 

MLGB的502!
我甚至把服务器都重启了!稀里糊涂就可以了,操!

原文地址:https://www.cnblogs.com/jiqing9006/p/9915523.html

时间: 2024-11-08 21:03:08

Centos6.5 安装gitlab 并使用自带的nginx的相关文章

CentOS6.5 安装gitlab以及gitolite迁移gitlab

CentOS6.5 安装gitlab以及gitolite迁移gitlab gitlab 的安装使用以及数据结构 安装 环境: CentOS6.5 基于 nignx + unicorn 搭建的应用环境, 如果想要换成passenger,可以参考网上的文档 ruby环境是基于rbenv搭建的 1: install vim yum install -y vim 2: install git > 1.7.10 install git $ rpm -i 'http://pkgs.repoforge.org

CentOS6.4 安装gitlab

一.环境 系统:CentOS6.4最小化安装 IP:192.168.3.44 二.增加yum源 增加epel源 [[email protected] ~]#  rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm wa

CentOS6.5安装GitLab全过程

GitLab,是一个使用 Ruby on Rails 开发的开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在团队内部使用. 官方只提供了Debian/Ubuntu系统下的安装说明文档,如果需要在centos下安装,可以参考这篇:https://github.com/gitlabhq/gitlab-recipes/tree/master/install/centos,笔者依照这篇文章的说明,成功的在centos系统上安装了gitlab,分享一下自己的安装过程和碰到的问题

CentOS6.7安装GitLab

1 建议安装epel源 2 建议从国内清华大学yum源安装 repo文件: [gitlab-ce] name=gitlab-ce baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/ repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packages.gitlab.com/gpg.key 3 安装GitLab yum install gitlab-ce 4 启动GitL

CentOS6.5安装gitlab

GitLab,是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目. 它拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释.可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库.团队成员可以利用内置的简单聊天程序(Wall)进行交流.它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找. 开源项目地址:https://github.com/gitlabhq/g

centos6.7 安装gitlab

其实整个步骤都很简单,但是由于程序比较臃肿,对系统有一定要求,内存最好2G以上,我的服务器因因为内存不够,直接报错 unicorn反复启动,直接导致gitlab sock 链接错误,现在直接给出 搭建过程 yum install curl openssh-server postfix cronie service postfix start chkconfig postfix on lokkit -s http -s ssh curl -sS https://packages.gitlab.co

git\CentOS6.5中gitlab安装教程

一.Git 起源: Git是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件. Git 与常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版本库的方式,不必服务器端软件支持. Git 与 SVN 区别 GIT不仅仅是个版本控制系统,它也是个内容管理系统(CMS),工作管理系统等. 如果你是一个具有使用SVN背景的人,你需要做一定的思想转换,

ubuntu 安装 gitlab最新版(下载慢问题)

Debian/Ubuntu 用户 首先信任 GitLab 的 GPG 公钥: curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null 再选择你的 Debian/Ubuntu 版本,文本框中内容写进 /etc/apt/sources.list.d/gitlab-ce.list Debian7(Wheezy) echo "deb http://mirrors.li

centos6.5安装部署git服务器(gitlab)

环境准备 python版本2.6 git版本 1.8.4.1 ruby版本ruby-2.0.0-p353 gitlab-shell版本 v1.8.0 gitlab版本6.4.3 因centos6系列的python版本是2.6的,已经支持,所以不必升级python版本. 在centos5下面需要升级python版本>2.5 安装epel的yum源 1 yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-