GitLab公式インストールドキュメント中国語翻訳


gitlabhq+gitoliteはこれまで個人的に最も使いやすいgitセンターライブラリ管理システムだったが、そのインストール構成は一般的な複雑さではなく、半日探しても完全な中国語インストールドキュメントが見つからず、自分の下手な英語のクラスに頼って斧を打つしかなかった.
原文住所:https://github.com/gitlabhq/gitlabhq/blob/stable/doc/installation.md
殷志剛

プラットフォームの要件:


このプロジェクトはLinuxオペレーティングシステムに設計されています.
FreeBSDとMac OSシステムで動作できるかもしれませんが、システムの安定性と機能の完全性を保証することはできません.
公式サポートのLinuxリリース:
  • Ubuntu Linux
  • Debian/GNU Linux

  • 次のように動作します.
  • Fedora
  • CentOS
  • RedHat

  • これらのシステムを使用するには運が必要ですが、安定性は保証されていません.
  • MacOS X
  • FreeBSD

  • GitLabはWindowsで実行できず、サポートする計画もありません.

    ハードウェア要件:


    少なくとも1 GBのコンテンツをgitlabインスタンスに推奨します.

    このインストールガイドはDebian/Ubuntuテストに合格しました。

  • インストールには合計6ステップが必要です:
  • インストール依存パッケージ
  • Ruby
  • を取り付ける
  • インストールGitolite
  • GitLab
  • のインストールと構成
  • フロントエンドWebサーバ
  • を起動する.
  • Resque実行(バックグラウンドタスク用)
  • を開始

    重要な情報


    インストールと構成の問題をメールリストで尋ねる前に、本明細書に従ってすべての手順を完了したことを確認してください.
    Only create a GitHub Issue if you want a specific part of this installation guide updated.
    Also read the Read this before you submit an issue wiki page.
    このインストールスクリプトを使用すると、前の3つのステップを簡単にスキップできます.
    #   curl   sudo
    apt-get install curl sudo
    
    #   :)
    curl https://raw.github.com/gitlabhq/gitlab-recipes/master/install/debian_ubuntu.sh | sh
    

    4つ目のステップに直行できます
    Amazon Web ServicesでUbuntu 12.04を使用している場合は、コマンドを使用してすべてのステップをスキップできます(1-6)
    curl https://raw.github.com/gitlabhq/gitlab-recipes/master/install/debian_ubuntu_aws.sh | sh

    詳細については、このスクリプトのHOWTOセクションを参照してください.

    1.依存パッケージのインストール


    Debianのデフォルトではsudoはインストールされていません.rootを使用してインストールしてください.
    apt-get update && apt-get upgrade && apt-get install sudo

    必要なパッケージをインストールできます.
    sudo apt-get update
    sudo apt-get upgrade
    
    sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev postfix libpq-dev

    データベース#データベース#


    SQLite

    sudo apt-get install -y sqlite3 libsqlite3-dev

    MySQL

    sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
    
    # Login to MySQL
    $ mysql -u root -p
    
    # Create the GitLab production database
    mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
    
    # Create the MySQL User change $password to a real password
    mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
    
    # Grant proper permissions to the MySQL User
    mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';

    PostgreSQL

    sudo apt-get install -y postgresql-9.2 postgresql-server-dev-9.2
    
    # Connect to database server
    sudo -u postgres psql -d template1
    
    # Add a user called gitlab. Change $password to a real password
    template1=# CREATE USER gitlab WITH PASSWORD '$password';
    
    # Create the GitLab production database
    template1=# CREATE DATABASE IF NOT EXISTS gitlabhq_production;
    
    # Grant all privileges on database
    template1=# GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production to gitlab;
    
    # Quit from PostgreSQL server
    template1=# \q
    
    # Try connect to new database
    $ su - gitlab
    $ psql -d gitlabhq_production -U gitlab

    (注:上記3つのデータベースは必要に応じて1つインストールすればよい)

    2.Rubyのインストール

    wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
    tar xfvz ruby-1.9.3-p194.tar.gz
    cd ruby-1.9.3-p194
    ./configure
    make
    sudo make install

    3.Gitoliteのインストール


    Gitのユーザーを作成するには:
    sudo adduser \
      --system \
      --shell /bin/sh \
      --gecos 'git version control' \
      --group \
      --disabled-password \
      --home /home/git \
      git

    GitLabのユーザーを作成するには、次の手順に従います.
    # ubuntu/debian
    sudo adduser --disabled-login --gecos 'gitlab system' gitlab

    gitlabユーザーをgitユーザーグループに追加するには、次の手順に従います.
    sudo usermod -a -G git gitlab

    gitユーザーをgitlabユーザーグループに追加するには、次の手順に従います.
    sudo usermod -a -G gitlab git

    鍵の生成:
    sudo -H -u gitlab ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa

    GitLabのGitoliteブランチソースコードをクローンします.
    sudo -H -u git git clone -b gl-v304 https://github.com/gitlabhq/gitolite.git /home/git/gitolite

    インストール:
    cd /home/git
    sudo -u git -H mkdir bin
    sudo -u git sh -c 'echo -e "PATH=\$PATH:/home/git/bin
    export PATH" >> /home/git/.profile' sudo -u git sh -c 'gitolite/install -ln /home/git/bin' sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub sudo chmod 0444 /home/git/gitlab.pub sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gitolite setup -pk /home/git/gitlab.pub"

    アクセス権:
    sudo chmod -R g+rwX /home/git/repositories/
    sudo chown -R git:git /home/git/repositories/

    チェック:gitユーザーグループを有効にするために終了して再ログイン

    #   admin   localhost   known_hosts
    #   gitlab   gitolite
    sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin
    
    #  , 
    sudo rm -rf /tmp/gitolite-admin

    重要!gitolite-adminリポジトリをクローンできない場合は、このインストールを続行しないでください.Trouble Shooting Guideに従って、上記のすべての手順を慎重に完了したことを確認してください.

    4.GitLabソースコードをクローンし、前提条件をインストールする

    sudo gem install charlock_holmes --version '0.6.8'
    sudo pip install pygments
    sudo gem install bundler
    cd /home/gitlab
    
    # Get gitlab code. Use this for stable setup
    sudo -H -u gitlab git clone -b stable https://github.com/gitlabhq/gitlabhq.git gitlab
    
    # Skip this for stable setup.
    # Master branch (recent changes, less stable)
    sudo -H -u gitlab git clone -b master https://github.com/gitlabhq/gitlabhq.git gitlab
    
    cd gitlab
    
    # Rename config files
    sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml

    (注:本人はcharlock_holmesをインストールする時に少し面倒なことに出会って、解決方法はここを見ます)

    使用するデータベースを選択

    # SQLite
    sudo -u gitlab cp config/database.yml.sqlite config/database.yml
    
    # Mysql
    sudo -u gitlab cp config/database.yml.mysql config/database.yml
    
    # PostgreSQL
    sudo -u gitlab cp config/database.yml.postgres config/database.yml
    
    #   config/database.yml  / 

    データベースgemsのインストール

    # mysql
    sudo -u gitlab -H bundle install --without development test sqlite postgres  --deployment
    
    #   postgres
    sudo -u gitlab -H bundle install --without development test sqlite mysql --deployment
    
    #   sqlite
    sudo -u gitlab -H bundle install --without development test mysql postgres  --deployment

    データベースの初期化

    sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production

    GitLab hooksの設定

    sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive
    sudo chown git:git /home/git/.gitolite/hooks/common/post-receive

    アプリケーションのステータスの確認:

    sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production
    
    
    # OUTPUT EXAMPLE
    Starting diagnostic
    config/database.yml............exists
    config/gitlab.yml............exists
    /home/git/repositories/............exists
    /home/git/repositories/ is writable?............YES
    remote: Counting objects: 603, done.
    remote: Compressing objects: 100% (466/466), done.
    remote: Total 603 (delta 174), reused 0 (delta 0)
    Receiving objects: 100% (603/603), 53.29 KiB, done.
    Resolving deltas: 100% (174/174), done.
    Can clone gitolite-admin?............YES
    UMASK for .gitolite.rc is 0007? ............YES
    /home/git/share/gitolite/hooks/common/post-receive exists? ............YES

    もしすべての結果がYESだったら、おめでとう!次のステップを続けることができます.

    5.web serverの設定


    アプリケーションは次のコマンドで実行できます.
    #  
    sudo -u gitlab bundle exec rails s -e production
    
    #  
    sudo -u gitlab bundle exec rails s -e production -d

    デフォルトのログインユーザー名とパスワード:
    [email protected]
    5iveL!fe

    6.Resqueプロセスの実行(ワークキューの処理)

    #  
    sudo -u gitlab bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes
    
    # GitLab  
    sudo -u gitlab ./resque.sh
    #   root  ,  /home/gitlab/gitlab/tmp/pids/resque_worker.pid   root
    #   resque  

    カスタムResqueで使用するRedis接続
    Resqueを非標準ポート番号または別のサーバのRedisに接続する場合はconfig/resque.ymlファイル接続情報の変更:
    production: redis.example.com:6379

    はい、私たちはすでに正常なGitLabを持っていますが、続けてください.いくつかのことが完成しなければなりません.

    NginxとUnicorn


    1. Unicorn

    cd /home/gitlab/gitlab
    sudo -u gitlab cp config/unicorn.rb.example config/unicorn.rb
    sudo -u gitlab bundle exec unicorn_rails -c config/unicorn.rb -E production -D

    2. Nginx

    #   Nginx
    sudo apt-get install nginx
    
    #  GitLab   nginx sites
    sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab -P /etc/nginx/sites-available/
    sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
    
    #   **YOUR_SERVER_IP**   **YOUR_SERVER_FQDN**
    #   IP   GitLab  
    sudo vim /etc/nginx/sites-enabled/gitlab
    
    #   nginx:
    sudo /etc/init.d/nginx restart

    3.Initスクリプト


    /etc/init.d/gitlab initスクリプトの作成:
    sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/
    sudo chmod +x /etc/init.d/gitlab

    GitLab自動起動の設定:
    sudo update-rc.d gitlab defaults 21

    GitLabサービスを起動/再起動/停止できます.
    sudo /etc/init.d/gitlab restart

     
    実は全編の主なのはすべて各種の命令で、実は1本の命令の1本の命令の複製と貼り付けを説明しないでインストールすることができて完成して、もちろん前提はあなたが使うのがUbuntu/Debianで、後で他のシステムの実際のインストールの過程を書く時間があります.