[gitlab]プライベートgithub倉庫の構築

11386 ワード

自分の机械は178 Mメモリの后ろの机械だけが本当に走ることができなくて、MySQLの必要なGemsをインストールすることをやり遂げて、この中でいくつか注意しなければなりません:1.mysqldはcentosのディレクトリ/etc/init.d/mysqld startはオープンサービス2である.本文はsudoコマンドを用いてgitアカウントという名前でgitlab 3を作成する.rubyの使用源をタオバオの4に変更する必要があります.あなたのマシンメモリは1 G以上が望ましいですが、私のは512 mだけbundleコマンドを実行するメモリが不足しています.
 
GitlabはRuby on Railsで開発されたオープンソースプロジェクト管理プログラムで、WEBインタフェースを通じて公開またはプライベートプロジェクトにアクセスできます.Githubと同様の機能があり、ソースコードを参照したり、欠陥やコメントを管理したりすることができます.
Debian/UbuntuとCentosの下で構成GitLabを構築する方法について説明します.
インストール依存
Debian/Ubuntuの下:
sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate 

pythonをインストールします(2.5以上のバージョンが必要です).
sudo apt-get install -y python python-docutils

gitのインストール(1.7.10以上のバージョンが必要です):
sudo apt-get install -y git-core

Centosの下の公式倉庫のソフトウェアは比較的古いので、epelソースを先に追加を推薦して、それからインストールして依存します:
sudo yum install git patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel git python python-docutils

Ruby 2.0のインストール
Ruby 2をインストールする必要がある.0,ソフトウェアウェアハウスのRuby 1.8はサポートされていません:
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
sudo make install

Bundler Gemのインストール:
sudo gem install bundler --no-ri --no-rdoc

gitlab-shellの構成
gitユーザーの作成:
sudo adduser --system --create-home --comment 'GitLab' git  

gitlab-shellの構成
su - git -c "git clone https://github.com/gitlabhq/gitlab-shell.git"  
su - git -c "cd gitlab-shell && git checkout v1.3.0"  
su - git -c "cp gitlab-shell/config.yml.example gitlab-shell/config.yml"  
sed -i "s/localhost/gitlab.51yip.com/g" /home/git/gitlab-shell/config.yml  
su - git -c "gitlab-shell/bin/install"  
chmod 600 /home/git/.ssh/authorized_keys  
chmod 700 /home/git/.ssh

データベース#データベース#
GitLabはMySQLとPostgreSQLデータベースをサポートします.以下、MySQLを例に、インストール方法を説明します.
Debian/Ubuntuでは、次のコマンドを使用してインストールします.
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev 

Centosでは、次のコマンドを使用します.
sudo yum install mysql-server sudo chkconfig mysqld on 

MySQLの設定:
sudo echo "CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';" | mysql -u root 
sudo echo "UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='root'; FLUSH PRIVILEGES;" | mysql -u root 

注意、あなたのパスワードで123456を置き換えます.
インストール構成gitlab
su - git -c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab"  
su - git -c "cd gitlab;git checkout 5-1-stable"  
su git -c "cp config/gitlab.yml.example config/gitlab.yml"  
su git -c "mkdir /home/git/gitlab-satellites"  
su git -c "mkdir public/uploads"  
su git -c "mkdir -p tmp/sockets/"  
su git -c "mkdir -p tmp/pids/"  
sed -i "s/ host: localhost/ host: gitlab.segmentfault.com/g" config/gitlab.yml  
sed -i "s/from: gitlab@localhost/from: gitlab@gitlab.segmentfault.com/g" config/gitlab.yml  
su git -c "cp config/puma.rb.example config/puma.rb"  
su git -c 'git config --global user.name "GitLab"'  
su git -c 'git config --global user.email "gitlab@gitlab.segmentfault.com"'

注意gitlab.segmentfault.comをあなた自身の内容に置き換えます.
データベース接続の構成:
sudo su git -c "cp config/database.yml.mysql config/database.yml"
sudo sed -i "s/secure password/mysql root  /g" config/database.yml

MySQLのインストールに必要なGems
sudo -u git -H bundle install --deployment --without development test postgres aws 

初期化:
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
sudo update-rc.d gitlab defaults 21

適切に構成されているかどうかを確認します.
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

GitLabを再起動:
sudo service gitlab start

Nginxの設定
Debian/Ubuntuの下:
sudo apt-get install -y nginx

CentOS:
sudo yum install nginx

プロファイルサンプルのダウンロード:
sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
/etc/nginx/sites-available/gitlabを修正し、YOUR_SERVER_FQDNを自分のものに変更することに特に注意します.
nginxを再起動するには:
sudo service nginx restart

はい、GitLabにログインできます.デフォルトのインストール後のユーザー名:[email protected]、パスワード5iveL!feです.