更新:bitnami-gitlab 7.8版本后界面发生变化

邮件问题:

cd /data/server/gitlab/apps/gitlab/htdocs/config
vim environments/production.rb config.action_mailer.smtp_settings = {
:address => "smtp.163.com",
:port => 25,
:domain => "163.com",
:authentication => "login",
:user_name => "zab_alert",
:password => "ynxxxxxxxxxxx",
:enable_starttls_auto => true
} cp initializers/smtp_settings.rb.sample initializers/smtp_settings.rb vim initializers/smtp_settings.rb
ActionMailer::Base.smtp_settings = {
address: "smtp.163.com",
port: 25,
user_name: "zab_alert",
password: "ydnsgtbwbbdwygin",
domain: "163.com",
authentication: :login,
enable_starttls_auto: true,
openssl_verify_mode: 'none'
} vim gitlab.yml email_from: zab_alert@163.com

  

更新: 用官方rpm包装很方便

rpm下载地址: https://www.gitlab.com/downloads/

教程地址:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md

http://www.cw1314.com/index.php/archives/73/    smtp手动设置发送邮件

http://www.tuicool.com/articles/AzeEru                  https

-----------------------------------------发送邮件,头像问题,url-------------------------------------------------------------

vim /etc/gitlab/gitlab.rb

external_url = 'http://172.16.2.122'
gitlab_rails['gravatar_plain_url'] = 'http://gravatar.duoshuo.com/avatar/%{hash}?s=%{size}&d=identicon'
gitlab_rails['gitlab_shell_ssh_port'] = 2001
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "gitlab"
gitlab_rails['smtp_password'] = "blinksoul2015"
gitlab_rails['smtp_domain'] = "blinksoul.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = 'gitlab@blinksoul.com'

-------------------------------------企业邮箱提示的356端口无法使用-----------------------------------------------------------------

-------------------------------------ssh端口------------------------------------------------

vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

ssh_port: 2001

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

安装:

sudo yum install openssh-server
sudo yum install postfix # sendmail or exim is also OK
sudo rpm -i gitlab-x.y.z.rpm
sudo gitlab-ctl reconfigure

维护:

# Start all GitLab components
sudo gitlab-ctl start # Stop all GitLab components
sudo gitlab-ctl stop # Restart all GitLab components
sudo gitlab-ctl restart
It is also possible to start, stop or restart individual components. sudo gitlab-ctl restart unicorn

环境

Requirements
软件 版本
CentOS 6.6
Python 2.6
Ruby 2.1.5
Git 1.7.10+
Redis 2.0+
MySQL  
GitLab 7-8-stable
GitLab Shell v2.6.0
yum源

为了提高软件安装速度,将yum源设置为阿里云开源镜像

$ cd /etc/yum.repos.d
$ wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
必要软件包
$ yum -y install libicu-devel patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker

安装Git

// 查看当前git版本
$ git --version // 如果小于1.7.10则先卸载
$ yum remove git // 下载最新的git并安装
$ wget -O git-src.zip https://github.com/git/git/archive/master.zip
$ unzip git-src.zip
$ cd git-src
$ make prefix=/usr/local all
$ make prefix=/usr/local install
$ ln -fs /usr/local/bin/git* /usr/bin/

安装Ruby环境

$ mkdir /tmp/ruby && cd /tmp/ruby
$ curl --progress ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.1.5.tar.gz | tar xz
$ cd ruby-2.1.5
$ ./configure --disable-install-rdoc
$ make && make install $ ln -s /usr/local/bin/ruby /usr/bin/ruby
$ ln -s /usr/local/bin/gem /usr/bin/gem
$ ln -s /usr/local/bin/bundle /usr/bin/bundle // 设置ruby gem源为淘宝
$ gem source -r https://rubygems.org/
$ gem source -a http://ruby.taobao.org/ $ gem install bundler --no-ri --no-rdoc

安装MySQL及初始化GitLab库

$ yum install mysql mysql-devel mysql-server -y
$ /etc/init.d/mysqld start
$ chkconfig mysqld on // 登录mysql创建gitab的帐号和数据库
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; //测试是否可以用git帐号登录数据库
sudo -u git -H mysql -u gitlab -p -D gitlabhq_production

安装Redis

$ yum -y install redis
$ /etc/init.d/redis start
$ chkconfig redis on

添加git帐号并允许sudo

$ useradd --comment 'GitLab' git
$ echo "git ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers

安装GitLab

$ /home/git
$ sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-8-stable gitlab
$ cd /home/git/gitlab
$ sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml // 编辑git路径, gitlab的host:port
$ vim config/gitlab.yml
// bin_path: /usr/local/bin/git
// host: localhost
// port: 80 // 给文件夹添加相应的权限
$ chown -R git log/
$ chown -R git tmp/
$ chmod -R u+rwX log/
$ chmod -R u+rwX tmp/ // 创建必要的文件夹,以及复制配置文件
$ sudo -u git -H mkdir /home/git/gitlab-satellites
$ sudo -u git -H mkdir tmp/pids/
$ sudo -u git -H mkdir tmp/sockets/
$ sudo chmod -R u+rwX tmp/pids/
$ sudo chmod -R u+rwX tmp/sockets/
$ sudo -u git -H mkdir public/uploads
$ sudo chmod -R u+rwX public/uploads
$ sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
$ sudo -u git -H cp config/initializers/rack_attack.rb.example
config/initializers/rack_attack.rb // 配置数据库连接信息
$ sudo -u git cp config/database.yml.mysql config/database.yml
$ sudo -u git -H vim config/database.yml
$ vim config/database.yml
// production:
// username: gitlab
// password: "gitlab"

安装GitLab-Shell

$ cd /home/git
$ sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v2.6.0
$ cd gitlab-shell/
$ sudo -u git -H cp config.yml.example config.yml // 编辑配置文件, 设置gitlab_url, redis-cli, log-level...
$ vim config.yml
// gitlab_url: "http://localhost/"
// /usr/bin/redis-cli // 安装git-shell
$ sudo -u git -H ./bin/install

安装需要ruby的gems

$ cd /home/git/gitlab
$ sudo -u git -H bundle install --deployment --without development test postgres aws

初始化数据库(创建GitLab相关表)

$ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

安装启动文件以及日志切割文件

cp lib/support/init.d/gitlab /etc/init.d/gitlab
cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab

设置git帐号信息

$ sudo -u git -H git config --global user.name "Troy Zhang"
$ sudo -u git -H git config --global user.email "troyz@synnex.com"
$ sudo -u git -H git config --global core.autocrlf input

安装Nginx

$ yum -y install nginx
$ vim /etc/nginx/nginx.conf
user root git;
worker_processes 2;
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"';
# GITLAB
# Maintainer: @randx
# App Version: 5.0 upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
} server {
listen *:80 default_server; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com;
server_tokens off; # don't show the version number, a security best practice
root /home/git/gitlab/public; # Set value of client_max_body_size to at least the value of git.max_size in gitlab.yml
client_max_body_size 5m; # individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/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 {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
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_pass http://gitlab;
}
}
}

更改权限,启动nginx

$ nginx -t
$ chown -R git:git /var/lib/nginx/
$ /etc/init.d/nginx start

检测当前环境

sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

拉取gitlab静态资源文件

$ sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production

启动gitlab

$ /etc/init.d/gitlab start

检测各个组件是否正常工作

$ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

linux gitlab nginx 安装 配置的更多相关文章

  1. VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三)

    首先启动Nginx 1. 相关浏览 两个 Tomcat 配置:  VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二) Nginx 安装配置启动: VMware Linu ...

  2. VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二)

    准备工作 相关浏览: VMware Linux 下 Nginx 安装配置 (一) 1. 选在 /usr/local/ 下创建 softs 文件夹,通过 ftp 命令 把 apache-tomcat-7 ...

  3. linux下Nginx 安装配置

    Nginx 安装 一.首先要安装 PCRE PCRE 作用是让 Ngnix 支持 Rewrite 功能. 1.下载 PCRE 安装包,下载地址: http://downloads.sourceforg ...

  4. Linux CentOS Nginx安装配置

    Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器. ...

  5. VMware Linux 下 Nginx 安装配置 (一)

    资源准备 1. pcre-8.34.tar.gz: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 2. zlib-1.2.8.tar.g ...

  6. Linux中Nginx安装与配置详解

    转载自:http://www.linuxidc.com/Linux/2016-08/134110.htm Linux中Nginx安装与配置详解(CentOS-6.5:nginx-1.5.0). 1 N ...

  7. Linux下PHP安装配置MongoDB数据库连接扩展

    Web服务器: IP地址:192.168.21.127 PHP安装路径:/usr/local/php 实现目的: 安装PHP的MongoDB数据库扩展,通过PHP程序连接MongoDB数据库 具体操作 ...

  8. Nginx安装配置PHP(FastCGI)环境的教程

    这篇是Nginx安装配置PHP(FastCGI)环境的教程.Nginx不支持对外部程序的直接调用或者解析,所有的外部程序(包括PHP)必须通过FastCGI接口来调用. 一.什么是 FastCGI F ...

  9. Nginx安装配置与HelloWorld

    <深入理解Nginx>阅读与实践(一):Nginx安装配置与HelloWorld 最近在读陶辉的<深入理解Nginx:模块开发与架构解析>,一是想跟着大牛练练阅读和编写开源代码 ...

随机推荐

  1. Nginx 笔记与总结(3)配置虚拟主机

    Nginx 重启的另外一种方式,相当于 kill -HUP `cat /usr/local/nginx/logs/nginx.pid`: /usr/local/nginx/sbin/nginx -s ...

  2. 实现ScrollView中包含ListView,动态设置ListView的高度

    ScrollView 中包含 ListView 的问题 : ScrollView和ListView会冲突,会导致ListView显示不全 <?xml version="1.0" ...

  3. typecho流程原理和插件机制浅析(第一弹)

    typecho流程原理和插件机制浅析(第一弹) 兜兜 393 2014年03月28日 发布 推荐 5 推荐 收藏 24 收藏,3.5k 浏览 虽然新版本0.9在多次跳票后终于发布了,在漫长的等待里始终 ...

  4. [转]常用 Git 命令清单

    作者: 阮一峰 我每天使用 Git ,但是很多命令记不住. 一般来说,日常使用只要记住下图6个命令,就可以了.但是熟练使用,恐怕要记住60-100个命令. 下面是我整理的常用 Git 命令清单.几个专 ...

  5. TVP5150摄像头

    工作中看同事摄像头配置的时候有2种格式PAL.NTSC.如果摄像头的格式配置不对的话会出现重影.黑白没颜色.闪屏等等. TVP5150  PAL.NTSC配置.http://bbs.csdn.net/ ...

  6. HttpStatusCodeResult

    HttpStatusCodeResult:让mvc回传特定的http状态代码与消息给客户端,对于一些特殊的http响应,可利用httpStatusCodeResult帮助我们响应适当的状态代码: 1X ...

  7. Linux+postfix+extmail+dovecot打造基于web页面的邮件系统

    原文地址:http://blog.csdn.net/deansrk/article/details/6717720 最终效果图: 准备阶段:需要手动下载的软件包: postfix-2.6.5.tar. ...

  8. 【转】设计模式 ( 十七) 状态模式State(对象行为型)

    设计模式 ( 十七) 状态模式State(对象行为型) 1.概述 在软件开发过程中,应用程序可能会根据不同的情况作出不同的处理.最直接的解决方案是将这些所有可能发生的情况全都考虑到.然后使用if... ...

  9. 面向对象与面向过程 $this的注意事项和魔术方法set和get

    一.面向对象与面向过程的区别: 二者都是一种思想,面向对象是相对于面向过程而言的.面向过程,强调的是功能行为.面向对象,将功能封装进对象,强调具备了功能的对象.面向对象更加强调运用人类在日常的思维逻辑 ...

  10. jenkins password reset,and git integration

      0. SSH to server 1. Edit /opt/bitnami/apps/jenkins/jenkins_home/config.xml 2. set userSecurity to ...