Total Pageviews

Friday, 2 September 2016


  1. Install and configure the necessary dependencies
If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server and configure it as an SMTP server.
On Centos 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.
sudo yum install curl openssh-server openssh-clients postfix cronie
sudo service postfix start
sudo chkconfig postfix on
sudo lokkit -s http -s ssh
  1. Add the GitLab package server and install the package
curl -sS | sudo bash
sudo yum install gitlab-ce
If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using
curl -LJO
rpm -i gitlab-ce-XXX.rpm
  1. Configure and start GitLab
sudo gitlab-ctl reconfigure
  1. Browse to the hostname and login
On your first visit, you'll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you'll be redirected back to the login screen.
The default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish.



# 打开`/etc/gitlab/gitlab.rb`,
# 将`external_url = ''`修改为自己的IP地址:``,
# 然后执行下面的命令,对GitLab进行编译。
sudo gitlab-ctl reconfigure


Username: root 
Password: 5iveL!fe


原因:gravatar被墙 解决办法: 编辑 /etc/gitlab/gitlab.rb,将
# gitlab_rails['gravatar_plain_url'] = '{hash}?s=%{size}&d=identicon'
gitlab_rails['gravatar_plain_url'] = '{hash}?s=%{size}&d=identicon'
sudo gitlab-ctl reconfigure 
sudo gitlab-rake cache:clear RAILS_ENV=production


解决 80 端口被占用
upstream gitlab {
     server ;
server {
    listen       80;
    location / {
        proxy_pass   http://gitlab;    #在这里设置一个代理,和upstream的名字一样
        proxy_redirect             off;
        proxy_set_header           Host $host;
        proxy_set_header           X-Real-IP $remote_addr;
        proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
        client_max_body_size       10m; #允许客户端请求的最大单文件字节数
        client_body_buffer_size    128k; #缓冲区代理缓冲用户端请求的最大字节数
        proxy_connect_timeout      300; #nginx跟后端服务器连接超时时间(代理连接超时)
        proxy_send_timeout         300; #后端服务器数据回传时间(代理发送超时)
        proxy_read_timeout         300; #连接成功后,后端服务器响应时间(代理接收超时)
        proxy_buffer_size          4k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小
        proxy_buffers              4 32k; #proxy_buffers缓冲区,网页平均在32k以下的话,这样设置
        proxy_busy_buffers_size    64k; #高负荷下缓冲大小(proxy_buffers*2)
        proxy_temp_file_write_size 64k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传
# 检查配置
/usr/local/nginx-1.5.1/sbin/nginx -tc conf/nginx.conf

# nginx 重新加载配置
/usr/local/nginx-1.5.1/sbin/nginx -s reload