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','root']
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!

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

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

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

    CentOS6.5 安装gitlab以及gitolite迁移gitlab gitlab 的安装使用以及数据结构 安装 环境: CentOS6.5 基于 nignx + unicorn 搭建的应用环境, ...

  2. centos6/7安装gitlab

    CentOS/RHEL 6/7安装gitlab新建 /etc/yum.repos.d/gitlab-ce.repo,内容为你的CentOS/RHEL版本:centos6 [gitlab-ce] nam ...

  3. centos6.8 安装gitlab记录

    sudo yum install -y curl policycoreutils-python openssh-server cronie sudo lokkit -s http -s ssh sud ...

  4. centos6.4安装GitLab

    参考文章: http://www.pickysysadmin.ca/2013/03/25/how-to-install-gitlab-5-0-on-centos-6/ yum安装redis的方法: h ...

  5. CentOS6.4安装JDK,卸载自带的OpenJDK

    1.查看OpenJDK的安装包 $ rpm -qa |grep java java-1.6.0-openjdk-1.6.0.0-1.62.1.11.11.90.el6_4.x86_64 java-1. ...

  6. git\CentOS6.5中gitlab安装教程

    一.Git 起源: Git是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本 ...

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

    Debian/Ubuntu 用户 首先信任 GitLab 的 GPG 公钥: curl https://packages.gitlab.com/gpg.key 2> /dev/null | su ...

  8. Gitlab完美安装【CentOS6.5安装gitlab-6.9.2】

    摘要: 拆腾了几天,终于在今天找到了快速安装Gitlab的方法.CentOS6.5安装gitlab-6.9.2 参考网址:https://gitlab.com/gitlab-org/omnibus-g ...

  9. centos6 安装GitLab

    环境 Requirements 软件 版本CentOS 6.6Python 2.6Ruby 2.1.5Git 1.7.10+Redis 2.0+MySQL GitLab 7-8-stableGitLa ...

随机推荐

  1. angular做的简单购物车

    虽然本人也是刚刚才开始学习angular.js,并不是非常会,但是这并不能阻止我对angular的喜爱.因为它太省代码了,比如说一个比较简单的购物车,就是只有商品名称,单价,数量,小计,总计和删除功能 ...

  2. 剑指Offer——用两个栈实现队列

    题目描述: 用两个栈来实现一个队列,完成队列的Push和Pop操作. 队列中的元素为int类型. 分析: 代码: class Solution { public: void push(int node ...

  3. java 集合类复习(未完结)

    JAVA常用数据结构及原理分析(面试总结) https://blog.csdn.net/qq_29631809/article/details/72599708 java 中几种常用数据结构   ht ...

  4. Linux(1)- 服务器核心知识、Linux入门、VMware与centeos安装、远程连接linux、linux基本命令使用

    一.服务器核心知识 1.电脑和电脑的硬件组成 现在的人们几乎无时无刻不在使用着电脑!不管是桌上型电脑(桌机).笔记型电脑(笔电).平板电脑,还是智慧型手机等等,这些东西都算是电脑.虽然接触这么多,但是 ...

  5. 利用EasySQLMAIL实现自动数据提取和邮件发送功能 (1)

    转自:http://blog.sina.com.cn/s/blog_1549483b70102wioy.html 最近几个月每天都在发通报.过程很繁琐,动作很机械,整个人就是一部机器,执行SQL,填E ...

  6. ViewPager学习及使用(一)

    一:基础篇 1.ViewPager的简介和作用ViewPager是android扩展包v4包中的类,这个类可以让用户左右切换当前的view1)ViewPager类直接继承了ViewGroup类,所有它 ...

  7. 学员管理系统(简单的Django设计)

    学员管理系统(简单的Django设计) 学员管理系统 项目规划阶段 项目背景 近年来老男孩教育的入学学员数量稳步快速增长,传统的excel统计管理学员信息的方式已经无法满足日渐增长的业务需求.因此公司 ...

  8. Nhibernate工具Profiler配置

    1.使用之前需要确认Framework的Version,如果是4.0那么使用如下程序集需要在 创建ISessionFactory的项目中引用NHProfiler安装目录下的 HibernatingRh ...

  9. 第一课Linux系统安装知识(2)

    接着上节课单击Finish按钮之后,虚拟机将会启动进入安装界面. 根据提示按回车选择图形界面安装. 这里选择Skip跳过媒介检查. 选择安装语言为简体中文,键盘鼠标默认项即可. 这里安装类型选择是定制 ...

  10. cf100989b

    http://codeforces.com/gym/100989/my B. LCS (B) time limit per test 0.25 seconds memory limit per tes ...