来自 计算机网络 2019-10-09 13:39 的文章
当前位置: 六合联盟网 > 计算机网络 > 正文

一键安装GitLab7在RHEL6

参考最先的小说:http://www.linuxidc.com/Linux/2014-08/105137.htm

1 关于gitlab7

好歹gitlab是个好东西,不过极难安装和安插。bitnami(

率先,bitmami的一部分本子有题目,不能成功在rhel6.4上打响安装。因而,小编找到了一个较新的能够使用的版本7.8.1(响应式页面):

ftp://pepstack.com/pub/tarball/bitnami-gitlab-7.8.1-0-linux-x64-installer.run

(笔者的ftp不会直接提供,请想要的火速下载)

那正是说,最后安装好的功用就是(点击可访问,第二遍访谈恐怕会一点也不慢,需求较新本子的firefox或chrome,IE未测验):

2 要求描述

好了,先把必要陈诉一下,倘诺读者的须要与自身不相同,小编无法。假诺笔者有一台web主机(笔者那边是pepstack.com),笔者在主机后边创立虚构机(vm-gitlab),在vm-gitlab上设置gitlab7,然后经过安顿web主机上的ngnix,能够透过上边包车型大巴url访谈到笔者的gitlab:

开创设想机vm-gitlab的长河不细说了,假如你选择实体机也是一致的。vm-gitlab安装的是rhel6.4版本。确定保障在vm内部能够访谈外界主机和internet(如ping www.baidu.com)。

3 安装gitlab

ssh 到vm-gitlab:

# ssh root@vm-gitlab

下载一键式安装包:

# wget ftp://pepstack.com/pub/tarball/bitnami-gitlab-7.8.1-0-linux-x64-installer.run

安装:

# chmod a+x bitnami-gitlab-7.8.1-0-linux-x64-installer.run

# ./bitnami-gitlab-7.8.1-0-linux-x64-installer.run

设置进度中会提醒:


Welcome to the Bitnami Gitlab Stack Setup Wizard.


Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.

GitLab : Y (Cannot be edited)

GitLab CI [Y/n] :Y

Is the selection above correct? [Y/n]: Y


Installation folder

Please, choose a folder to install Bitnami Gitlab Stack

Select a folder [/opt/gitlab-7.8.1-0]:


Create Admin account

Bitnami Gitlab Stack admin user creation

Email Address [user@example.com]: cheungmine@qq.com

Login [user]: master (此处是你登入gitlab用的客商名)

Password : (输入你登入gitlab时要用的密码)

Please confirm your password :  (输入你登入gitlab时要用的密码)

Hostname that will be used to create internal URLs. If this value is incorrect,
you may be unable to access your Gitlab installation from other computers. It is
advisable to use a Domain instead of an IP address for compatibility with
different browsers.

Domain [127.0.0.1]:

Do you want to configure mail support? [y/N]: Y


Configure SMTP Settings

This is required so your application can send notifications via email.

Default email provider:

[1] GMail
[2] Custom
Please choose an option [1] : 2


Configure SMTP Settings

This data is stored in the application configuration files and may be visible to
others. For this reason, it is recommended that you do not use your personal
account credentials.

Username []: cheungmine@qq.com

Password : (输入你的QQ密码)
Re-enter : (输入你的QQ密码)
SMTP Host []: smtp.qq.com

SMTP Port []: 25

Secure connection

[1] None
[2] SSL
[3] TLS
Please choose an option [3] :


Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.

Do you want to continue? [Y/n]: Y


Please wait while Setup installs Bitnami Gitlab Stack on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################


Setup has finished installing Bitnami Gitlab Stack on your computer.

Info: To access the Bitnami Gitlab Stack, go to
from your browser.
Press [Enter] to continue:

4 配置gitlab
配备进一步要当心。下边多少个布局文件要用到:

/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/environments/production.rb
/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/initializers/smtp_settings.rb
/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/gitlab.yml
/opt/gitlab-7.8.1-0/apps/gitlab/conf/httpd-app.conf
/opt/gitlab-7.8.1-0/apps/gitlab/gitlab-shell/config.yml

下边逐个表达:

4.1 production.rb

......
  # config.action_mailer.delivery_method = :sendmail
  # Defaults to:
  # # config.action_mailer.sendmail_settings = {
  # #  location: '/usr/sbin/sendmail',
  # #  arguments: '-i -t'
  # # }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address => "smtp.qq.com",
    :port => "25",
    :domain => "qq.com",
    :authentication => :plain,
    :user_name => "cheungmine@qq.com",
    :password => "********",
    :enable_starttls_auto => true
  }

  config.eager_load = true
  config.assets.js_compressor = :uglifier

  config.allow_concurrency = false
......

4.2 smtp_settings.rb
# cp smtp_settings.rb.sample smtp_settings.rb

# To enable smtp email delivery for your GitLab instance do the following:
# 1. Rename smtp_settings.rb.sample to smtp_settings.rb
# 2. Edit settings inside this file
# 3. Restart GitLab instance
#
if Rails.env.production?
  Gitlab::Application.config.action_mailer.delivery_method = :smtp

  ActionMailer::Base.smtp_settings = {
    address: "smtp.qq.com",
    port: 25,
    user_name: "cheungmine@qq.com",
    password: "********",
    domain: "qq.com",
    authentication: :login,
    enable_starttls_auto: true,
    openssl_verify_mode: 'none'
  }
end

4.3 gitlab.yml

# # # # # # # # # # # # # # # # # #
# GitLab application config file  #
# # # # # # # # # # # # # # # # # #
#
# How to use:
# 1. Copy file as gitlab.yml
# 2. Update gitlab -> host with your fully qualified domain name
# 3. Update gitlab -> email_from
# 4. If you installed Git from source, change git -> bin_path to /usr/local/bin/git
# 5. Review this configuration file for other settings you may want to adjust

production: &base
  #
  # 1. GitLab app settings
  # ==========================

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: pepstack.com
    port: 80                # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
    https: false            # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details

    # Uncommment this line below if your ssh host is different from HTTP/HTTPS one
    # (you'd obviously need to replace ssh.host_example.com with your own host).
    # Otherwise, ssh host will be set to the `host:` value above
    # ssh_host: ssh.host_example.com

    # WARNING: See config/application.rb under "Relative url support" for the list of
    # other files that need to be changed for relative url support
    relative_url_root: /gitlab

    # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
    # user: git

    ## Date & Time settings
    # Uncomment and customize if you want to change the default time zone of GitLab application.
    # To see all available zones, run `bundle exec rake time:zones:all RAILS_ENV=production`
    # time_zone: 'UTC'

    ## Email settings
    # Uncomment and set to false if you need to disable email sending from GitLab (default: true)
    # email_enabled: true
    # Email address used in the "From" field in mails sent by GitLab
    email_from: cheungmine@qq.com
    support_email: cheungmine@qq.com

    # Email server smtp settings are in config/initializers/smtp_settings.rb.sample

    # default_can_create_group: false  # default: true
    # username_changing_enabled: false # default: true - User can change her username/namespace
    ## Default theme
    ##  BASIC  = 1
    ##  MARS  = 2
    ##  MODERN = 3
    ##  GRAY  = 4
    ##  COLOR  = 5
    # default_theme: 2 # default: 2
......

地点文件改换之处在于:

host: pepstack.com
relative_url_root: /gitlab
email_from: cheungmine@qq.com
support_email: cheungmine@qq.com

下边包车型大巴布署是因为要把gitlab置于nginx后边使用:

4.4 httpd-app.conf

<Directory "/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/public">
    Options -MultiViews
    AllowOverride All
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>

    SetEnv RAILS_RELATIVE_URL_ROOT "/gitlab"

    PassengerEnabled on
    PassengerAppRoot "/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/"
    <IfModule pagespeed_module>
        ModPagespeedDisallow "*"
    </IfModule>
    PassengerUser git
    PassengerGroup git
    SetEnv MAGIC "/opt/gitlab-7.8.1-0/ruby/lib/ruby/gems/2.0.0/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src/file-5.08/magic/magic.mgc"
    SetEnv PATH "/opt/gitlab-7.8.1-0/python/bin:${PATH}"

</Directory>
PassengerPreStart

分裂之处在于:

SetEnv RAILS_RELATIVE_URL_ROOT "/gitlab"
PassengerPreStart

4.5 config.yml

...
gitlab_url:
...

诸如此比大家访谈gitlab就是鲁人持竿上面包车型客车位置:

5 主机nginx配置

上边的安插都以在vm-gitlab上进行的,注意展开80:http端口。下边要给主机nginx扩张安排,配置文件:

/etc/nginx/conf.d/redmine.conf

剧情如下(我还要还提供了redmine服务):

# 指向内网redmine的web服务(192.168.122.21:80)
#
upstream redmine {
    server 192.168.122.21:80;
}

upstream gitlab {
    server 192.168.122.20:80;
}

server {
    server_name pepstack.com;

    # /var/log/nginx 本地目录必得存在
    access_log  /var/log/nginx/redmine_access.log;
    error_log  /var/log/nginx/redmine_error.log;

    location /redmine {
        try_files $uri @red;      # @red 名字是私行的
    }

    location /gitlab {
        try_files $uri @git;
    }

    location @red {
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real_IP        $remote_addr;
        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;

        proxy_read_timeout    300;
        proxy_connect_timeout  300;
        proxy_redirect        off;

        proxy_pass ;  # 指向 upstream redmine
    }

    location @git {
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real_IP        $remote_addr;
        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;

        proxy_read_timeout    300;
        proxy_connect_timeout  300;
        proxy_redirect        off;

        proxy_pass ;  # 指向 upstream gitlab
    }
}

即注释掉:include /etc/nginx/sites-enabled/*;

6 运营服务

居功至伟告成,在主机运行nginx:

$ sudo nginx -s reload

在vm-gitlab启动gitlab:

# cd /opt/gitlab-7.8.1-0/

# ./ctlscript.sh restart

图片 1

CentOS源码安装GitLab汉化版  http://www.linuxidc.com/Linux/2015-10/124648.htm

在 Ubuntu 12.04 上安装 GitLab http://www.linuxidc.com/Linux/2012-12/75249.htm

GitLab 5.3 晋级注意事项 http://www.linuxidc.com/Linux/2013-06/86473.htm

在 CentOS 上安顿 GitLab (自托管的Git项目仓库) http://www.linuxidc.com/Linux/2013-06/85754.htm

在RHEL6/CentOS6/ScientificLinux6上安装GitLab 6.0.2 http://www.linuxidc.com/Linux/2014-03/97831.htm

CentOS 6.5安装GitLab教程及相关主题素材消除 http://www.linuxidc.com/Linux/2014-05/101526.htm

GitLab 的详实介绍:请点这里
GitLab 的下载地址:请点这里

正文长久更新链接地址:http://www.linuxidc.com/Linux/2015-11/124919.htm

图片 2

本文由六合联盟网发布于计算机网络,转载请注明出处:一键安装GitLab7在RHEL6

关键词: