[git@Git gitlab]$ sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init/sysvinit/centos/gitlab-unicorn -P /etc/init.d/ 
[git@Git gitlab]$ sudo mv /etc/init.d/gitlab-unicorn /etc/init.d/gitlab 
[git@Git gitlab]$ sudo chmod +x /etc/init.d/gitlab 
[git@Git gitlab]$ sudo chkconfig --add gitlab 
[git@Git gitlab]$ sudo chkconfig gitlab on 
[git@Git gitlab]$ sudo /etc/init.d/gitlab start
12)复制配置文件[这里使用nginx做为WEB服务]
[git@Git gitlab]$ cp lib/support/nginx/gitlab /usr/local/nginx/conf/conf.d/ 
[git@Git gitlab]$ cd /usr/local/nginx/conf/conf.d/ 
[git@Git gitlab]$ sudo chown -R git:git . 
[git@Git conf.d]$ cp gitlab gitlab.conf 
[git@Git conf.d]$ vi gitlab.conf 
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 git.test.com;    # 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; 
  client_max_body_size 5m; 
  access_log  logs/gitlab_access.log; 
  error_log  logs/gitlab_error.log; 
  location / { 
    try_files $uri $uri/index.html $uri.html @gitlab; 
  } 
  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 ; 
  } 
} 
[git@Git conf.d]$ sudo service nginx restart
13)拉取GitLab静态文件
[git@Git conf.d]$ cd /home/git/gitlab 
[git@Git gitlab]$ bundle exec rake assets:precompile RAILS_ENV=production 
[git@Git gitlab]$ sudo service gitlab restart
14)访问测试
初始管理员帐号和密码为: 
admin@local.host 
5iveL!fe
1)访问 如果配置正常会显示如下页面:

2)输入默认的登陆账号和密码,会提示你修改默认密码:

3)密码修改后,会重新跳回到登陆界面:

4)重新输入登陆账号和新密码,登陆成功后显示如下:

在 Ubuntu 12.04 上安装 GitLab

