成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

centos6.2安裝gitlab6.4

selfimpr / 3369人閱讀

摘要:環(huán)境準(zhǔn)備版本版本版本版本版本因系列的版本是的,已經(jīng)支持,所以不必升級(jí)版本。

環(huán)境準(zhǔn)備

python版本2.6
git版本 1.8.4.1
ruby版本ruby-2.0.0-p353
gitlab-shell版本 v1.8.0
gitlab版本6.4.3

因centos6系列的python版本是2.6的,已經(jīng)支持,所以不必升級(jí)python版本。
在centos5下面需要升級(jí)python版本>2.5

安裝epel的yum源

yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

安裝必要的軟件包

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

因?yàn)間it需要1.8版本以上,所以需要重新編譯安裝
移除當(dāng)前git

yum remove git

下載1.8.4.1的git并安裝

curl --progress https://git-core.googlecode.com/files/git-1.8.4.1.tar.gz | tar xz
cd git-1.8.4.1/
make prefix=/usr/local all
make prefix=/usr/local install
ln -fs /usr/local/bin/git* /usr/bin/
安裝ruby環(huán)境
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz
cd ruby-2.0.0-p353/
./configure --disable-install-rdoc
make && make install
gem install bundler --no-ri --no-rdoc
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
添加git帳號(hào)并允許sudo
useradd --comment "GitLab" git
echo "git ALL=(ALL)       NOPASSWD: ALL" >>/etc/sudoers
安裝git-shell
cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.8.0
cd gitlab-shell/
sudo -u git -H cp config.yml.example config.yml
vim config.yml
修改gitlab_url為gitlab的域名
gitlab_url: "http://localhost/"
修改為
gitlab_url: "http://git.linuxyan.com/"
#安裝git-shell
sudo -u git -H ./bin/install
安裝mysql以及建立gitlab數(shù)據(jù)庫
yum install mysql mysql-devel mysql-server -y
/etc/init.d/mysqld start
chkconfig mysqld on
登錄mysql創(chuàng)建gitab的帳號(hào)和數(shù)據(jù)庫
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";

測(cè)試是否可以用git帳號(hào)登錄數(shù)據(jù)庫

sudo -u git -H mysql -u gitlab -p -D gitlabhq_production
安裝redis
yum -y install redis

/etc/init.d/redis start

chkconfig redis on
安裝gitlab
cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-4-stable gitlab
cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

vim config/gitlab.yml
修改host為剛才git-shell里面設(shè)置的域名
## GitLab settings
gitlab:
## Web server settings
  host: git.linuxyan.com
  port: 80
  https: false

修改git的path
git:
  bin_path: /usr/local/bin/git

給文件夾添加相應(yīng)的權(quán)限
chown -R git log/
chown -R git tmp/
chmod -R u+rwX  log/
chmod -R u+rwX  tmp/
創(chuàng)建必要的文件夾,以及復(fù)制配置文件
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
設(shè)置gitlab的全局帳號(hào)
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "gitlab@localhost"
sudo -u git -H git config --global core.autocrlf input
設(shè)置數(shù)據(jù)庫鏈接地址和權(quán)限
sudo -u git cp config/database.yml.mysql config/database.yml
sudo -u git -H vim  config/database.yml
修改鏈接數(shù)據(jù)庫信息
production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: gitlabhq_production
  pool: 10
  username: gitlab
  password: "gitlab"
  # host: localhost
  # socket: /tmp/mysql.sock
安裝需要ruby的gems
cd /home/git/gitlab
sudo -u git -H bundle install --deployment --without development test postgres aws

這個(gè)安裝時(shí)間有點(diǎn)長(zhǎng),安裝過程如下圖:

安裝完成后:

初始化數(shù)據(jù)庫
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

初始化數(shù)據(jù)庫之后,會(huì)告訴你默認(rèn)的管理員用戶和密碼:

安裝啟動(dòng)文件以及日志切割文件
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
檢測(cè)當(dāng)前環(huán)境
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

如下:

安裝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;
  }
}

}
更改權(quán)限,啟動(dòng)nginx
nginx -t
chown -R git.git /var/lib/nginx/
/etc/init.d/nginx start
拉取gitlab靜態(tài)資源文件
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
啟動(dòng)gitlab
/etc/init.d/gitlab start
檢測(cè)各個(gè)組件是否正常工作
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

檢測(cè)沒有錯(cuò)誤就表示已經(jīng)安裝好了gitlab,如圖:

這個(gè)時(shí)候就可以用瀏覽器打開http://git.linuxyan.com
初始管理員帳號(hào)和密碼為:
[email protected]
5iveL!fe
登錄之后如下:

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/17342.html

相關(guān)文章

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<