<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Installation from source > 原文:[https://docs.gitlab.com/ee/install/installation.html](https://docs.gitlab.com/ee/install/installation.html) * [Consider the Omnibus package installation](#consider-the-omnibus-package-installation) * [Select a version to install](#select-a-version-to-install) * [GitLab directory structure](#gitlab-directory-structure) * [Overview](#overview) * [1\. Packages and dependencies](#1-packages-and-dependencies) * [2\. Ruby](#2-ruby) * [3\. Go](#3-go) * [4\. Node](#4-node) * [5\. System users](#5-system-users) * [6\. Database](#6-database) * [7\. Redis](#7-redis) * [8\. GitLab](#8-gitlab) * [Clone the Source](#clone-the-source) * [Configure It](#configure-it) * [Configure GitLab DB Settings](#configure-gitlab-db-settings) * [Install Gems](#install-gems) * [Install GitLab Shell](#install-gitlab-shell) * [Install GitLab Workhorse](#install-gitlab-workhorse) * [Install GitLab-Elasticsearch-indexer on Enterprise Edition](#install-gitlab-elasticsearch-indexer-on-enterprise-edition) * [Install GitLab Pages](#install-gitlab-pages) * [Install Gitaly](#install-gitaly) * [Start Gitaly](#start-gitaly) * [Initialize Database and Activate Advanced Features](#initialize-database-and-activate-advanced-features) * [Secure secrets.yml](#secure-secretsyml) * [Install Init Script](#install-init-script) * [Set up Logrotate](#set-up-logrotate) * [Check Application Status](#check-application-status) * [Compile GetText PO files](#compile-gettext-po-files) * [Compile Assets](#compile-assets) * [Start Your GitLab Instance](#start-your-gitlab-instance) * [9\. NGINX](#9-nginx) * [Installation](#installation) * [Site Configuration](#site-configuration) * [Test Configuration](#test-configuration) * [Restart](#restart) * [Post-install](#post-install) * [Double-check Application Status](#double-check-application-status) * [Initial Login](#initial-login) * [Advanced Setup Tips](#advanced-setup-tips) * [Relative URL support](#relative-url-support) * [Using HTTPS](#using-https) * [Enable Reply by email](#enable-reply-by-email) * [LDAP Authentication](#ldap-authentication) * [Using Custom OmniAuth Providers](#using-custom-omniauth-providers) * [Build your projects](#build-your-projects) * [Adding your Trusted Proxies](#adding-your-trusted-proxies) * [Custom Redis Connection](#custom-redis-connection) * [Custom SSH Connection](#custom-ssh-connection) * [Additional Markup Styles](#additional-markup-styles) * [Using Unicorn](#using-unicorn) * [Using Sidekiq instead of Sidekiq Cluster](#using-sidekiq-instead-of-sidekiq-cluster) * [Troubleshooting](#troubleshooting) * [“You appear to have cloned an empty repository.”](#you-appear-to-have-cloned-an-empty-repository) * [`google-protobuf` “LoadError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14’ not found”](#google-protobuf-loaderror-libx86_64-linux-gnulibcso6-version-glibc_214-not-found) # Installation from source[](#installation-from-source "Permalink") 這是使用源文件設置生產 GitLab 服務器的官方安裝指南. 要設置**開發安裝**或許多其他安裝選項,請參見[主要安裝頁面](README.html) . 它是為**Debian / Ubuntu**操作系統創建并經過測試的. 有關硬件和操作系統[要求](requirements.html) ,請閱讀 requirements.md. 如果要在 RHEL / CentOS 上安裝,我們建議使用[Omnibus 軟件包](https://about.gitlab.com/install/) . 本指南之所以冗長,是因為它涵蓋了許多情況,并且包括您需要的所有命令,這是[實際上可以立即使用的少數安裝腳本之一](https://twitter.com/robinvdvleuten/status/424163226532986880) . 已知以下步驟有效. **偏離**本指南**時請多加注意** . 確保您沒有違反任何有關 GitLab 對其環境的假設. 例如,許多人遇到權限問題,因為他們更改了目錄的位置或以錯誤的用戶身份運行服務. 如果您在本指南中發現錯誤/錯誤, **請**按照[提供幫助的指南](https://gitlab.com/gitlab-org/gitlab/blob/master/CONTRIBUTING.md) **提交合并請求** . ## Consider the Omnibus package installation[](#consider-the-omnibus-package-installation "Permalink") 由于從源頭進行安裝需要大量工作并且容易出錯,因此我們強烈建議您快速,可靠地[安裝 Omnibus 軟件包](https://about.gitlab.com/install/) (deb / rpm). Omnibus 軟件包更可靠的原因之一是它使用 runit 來重新啟動任何 GitLab 進程,以防萬一崩潰. 在頻繁使用的 GitLab 實例上,Sidekiq 后臺工作程序的內存使用量會隨著時間增長. Omnibus 軟件包通過[使 Sidekiq](../administration/operations/sidekiq_memory_killer.html)在使用過多內存的情況下[正常終止來](../administration/operations/sidekiq_memory_killer.html)解決此問題. 在此終止后,runit 將檢測到 Sidekiq 沒有運行并啟動它. 由于從源頭進行的安裝不使用 runit 進行過程監視,因此 Sidekiq 無法終止,并且其內存使用量會隨著時間的推移而增長. ## Select a version to install[](#select-a-version-to-install "Permalink") 確保從您要安裝的 GitLab 的分支(版本)中查看[此安裝指南](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/install/installation.md) (例如`11-7-stable` ). 您可以在 GitLab 左上角的版本下拉菜單中選擇分支(位于菜單欄下方). 如果不清楚最高數目的穩定分支,請查看[GitLab 博客](https://about.gitlab.com/blog/)以獲取版本信息. ## GitLab directory structure[](#gitlab-directory-structure "Permalink") 這是主要的目錄結構,您將按照此頁面的說明進行操作: ``` |-- home | |-- git | |-- .ssh | |-- gitlab | |-- gitlab-shell | |-- repositories ``` * `/home/git/.ssh`包含 OpenSSH 設置. 具體來說,由 GitLab Shell 管理的`authorized_keys`文件. * `/home/git/gitlab` -GitLab 核心軟件. * `/home/git/gitlab-shell` -GitLab 的核心附加組件. 維護 SSH 克隆和其他功能. * `/home/git/repositories`按名稱空間組織的所有項目的裸存儲庫. 這是為所有項目維護推/拉的 Git 存儲庫的地方. **該區域包含項目的關鍵數據.** **[保持備份](../raketasks/backup_restore.html) .** **注意:**可以在 GitLab 的`config/gitlab.yml`和 GitLab Shell 的`config.yml`中`config/gitlab.yml`存儲庫的默認位置. 有關更深入的概述,請參閱[GitLab 體系結構文檔](../development/architecture.html) . ## Overview[](#overview "Permalink") GitLab 安裝包括設置以下組件: 1. [Packages and dependencies](#1-packages-and-dependencies). 2. [Ruby](#2-ruby). 3. [Go](#3-go). 4. [Node](#4-node). 5. [System users](#5-system-users). 6. [Database](#6-database). 7. [Redis](#7-redis). 8. [GitLab](#8-gitlab). 9. [NGINX](#9-nginx). ## 1\. Packages and dependencies[](#1-packages-and-dependencies "Permalink") 默認情況下,Debian 上未安裝`sudo` . 確保您的系統是最新的并安裝. ``` # run as root! apt-get update -y apt-get upgrade -y apt-get install sudo -y ``` **注意:**在此安裝過程中,將需要手動編輯某些文件. 如果您熟悉 vim,請使用以下命令將其設置為默認編輯器. 如果您不熟悉 vim,請跳過此步驟并繼續使用默認編輯器. ``` # Install vim and set as default editor sudo apt-get install -y vim sudo update-alternatives --set editor /usr/bin/vim.basic ``` 安裝所需的軟件包(需要編譯 Ruby 和 Ruby gem 的本機擴展): ``` sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libre2-dev \ libreadline-dev libncurses5-dev libffi-dev curl openssh-server checkinstall libxml2-dev \ libxslt-dev libcurl4-openssl-dev libicu-dev logrotate rsync python-docutils pkg-config cmake \ runit ``` Ubuntu 14.04(Trusty `libre2-dev` )沒有可用的`libre2-dev`軟件包,但您可以[手動安裝 re2](https://github.com/google/re2/wiki/Install) . 如果要使用 Kerberos 進行用戶身份驗證,請安裝`libkrb5-dev` : ``` sudo apt-get install libkrb5-dev ``` **注意:**如果您不知道 Kerberos 是什么,則可以假定您不需要它. 確保您安裝了正確的 Git 版本: ``` # Install Git sudo apt-get install -y git-core # Make sure Git is version 2.27.0 or higher (minimal supported version is 2.25.0) git --version ``` 從 GitLab 12.0 開始,需要使用`libpcre2`編譯 Git. 找出是否是這種情況: ``` ldd $(command -v git) | grep pcre2 ``` 輸出應包含`libpcre2-8.so.0` . 系統打包的 Git 是否過舊,或者未使用 pcre2 編譯? 去掉它: ``` sudo apt-get remove git-core ``` 在 Ubuntu 上, [從其官方 PPA](https://git-scm.com/download/linux)安裝 Git: ``` # run as root! add-apt-repository ppa:git-core/ppa apt update apt install git # repeat libpcre2 check as above ``` 在 Debian 上,使用以下編譯說明: ``` # Install dependencies sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential # Download and compile pcre2 from source curl --silent --show-error --location https://ftp.pcre.org/pub/pcre/pcre2-10.33.tar.gz --output pcre2.tar.gz tar -xzf pcre2.tar.gz cd pcre2-10.33 chmod +x configure ./configure --prefix=/usr --enable-jit make sudo make install # Download and compile from source cd /tmp curl --remote-name --location --progress https://www.kernel.org/pub/software/scm/git/git-2.27.0.tar.gz echo '77ded85cbe42b1ffdc2578b460a1ef5d23bcbc6683eabcafbb0d394dffe2e787 git-2.27.0.tar.gz' | shasum -a256 -c - && tar -xzf git-2.27.0.tar.gz cd git-2.27.0/ ./configure --with-libpcre make prefix=/usr/local all # Install into /usr/local/bin sudo make prefix=/usr/local install # When editing config/gitlab.yml later, change the git -> bin_path to /usr/local/bin/git ``` 為了使[自定義圖標](../user/admin_area/appearance.html#favicon)能夠正常工作,需要安裝 GraphicsMagick. ``` sudo apt-get install -y graphicsmagick ``` **注意:**為了接收郵件通知,請確保安裝郵件服務器. 默認情況下,Debian 隨 exim4 一起提供,但這[會帶來問題,](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/12754)而 Ubuntu 則沒有. 推薦的郵件服務器是 postfix,您可以使用以下命令進行安裝: ``` sudo apt-get install -y postfix ``` 然后選擇" Internet Site",然后按 Enter 確認主機名. [GitLab Workhorse](https://gitlab.com/gitlab-org/gitlab-workhorse#dependencies)需要使用`exiftool`才能從上傳的圖像中刪除 EXIF 數據. ``` sudo apt-get install -y libimage-exiftool-perl ``` ## 2\. Ruby[](#2-ruby "Permalink") 運行 GitLab 需要使用 Ruby 解釋器. **注意:**當前支持的 Ruby(MRI)版本是 2.6.x. GitLab 12.2 放棄了對 Ruby 2.5.x 的支持. 在生產環境[中將](https://github.com/rbenv/rbenv) Ruby 版本管理器(如[RVM](https://rvm.io/) , [rbenv](https://github.com/rbenv/rbenv)或[chruby)](https://github.com/postmodern/chruby)與 GitLab [一起](https://github.com/postmodern/chruby)使用通常會導致難以診斷問題. 不支持版本管理器,我們強烈建議所有人按照以下說明使用系統 Ruby. Linux 發行版通常提供較舊版本的 Ruby,因此這些說明旨在從官方源代碼安裝 Ruby. 刪除舊的 Ruby 1.8(如果存在): ``` sudo apt-get remove ruby1.8 ``` 下載 Ruby 并進行編譯: ``` mkdir /tmp/ruby && cd /tmp/ruby curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.gz echo '2d78048e293817f38d4ede4ebc7873013e97bb0b ruby-2.6.6.tar.gz' | shasum -c - && tar xzf ruby-2.6.6.tar.gz cd ruby-2.6.6 ./configure --disable-install-rdoc make sudo make install ``` 然后安裝 Bundler gem(低于 2.x 的版本): ``` sudo gem install bundler --no-document --version '< 2' ``` ## 3\. Go[](#3-go "Permalink") 從 GitLab 8.0 開始,GitLab 有幾個用 Go 編寫的守護程序. 要安裝 GitLab,我們需要一個 Go 編譯器. 以下說明假定您使用 64 位 Linux. 您可以在[Go 下載頁面上](https://s0golang0org.icopy.site/dl)找到其他平臺的[下載](https://s0golang0org.icopy.site/dl) . ``` # Remove former Go installation folder sudo rm -rf /usr/local/go curl --remote-name --progress https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz echo '512103d7ad296467814a6e3f635631bd35574cab3369a97a323c9a585ccaa569 go1.13.5.linux-amd64.tar.gz' | shasum -a256 -c - && \ sudo tar -C /usr/local -xzf go1.13.5.linux-amd64.tar.gz sudo ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/local/bin/ rm go1.13.5.linux-amd64.tar.gz ``` ## 4\. Node[](#4-node "Permalink") 從 GitLab 8.17 開始,GitLab 需要使用 Node 來編譯 JavaScript 資產,并使用 Yarn 來管理 JavaScript 依賴項. 當前的最低要求是: * `node` > = v10.13.0\. (我們建議使用節點 12.x,因為它速度更快) * `yarn` > = v1.10.0. 在許多發行版中,官方軟件包存儲庫提供的版本已經過時,因此我們需要通過以下命令進行安裝: ``` # install node v12.x curl --location https://deb.nodesource.com/setup_12.x | sudo bash - sudo apt-get install -y nodejs curl --silent --show-error https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update sudo apt-get install yarn ``` 如果您對這些步驟有任何疑問,請訪問[node](https://s0nodejs0org.icopy.site/en/download/package-manager/)和[yarn](https://classic.yarnpkg.com/en/docs/install/)的官方網站. ## 5\. System users[](#5-system-users "Permalink") 為 GitLab 創建一個`git`用戶: ``` sudo adduser --disabled-login --gecos 'GitLab' git ``` ## 6\. Database[](#6-database "Permalink") **注意:**從 GitLab 12.1 開始,僅支持 PostgreSQL. 從 GitLab 13.0 開始,我們需要 PostgreSQL 11+. 1. 安裝數據庫軟件包: ``` sudo apt-get install -y postgresql postgresql-client libpq-dev postgresql-contrib ``` 2. 啟動 PostgreSQL 服務并確認該服務正在運行: ``` sudo service postgresql start sudo service postgresql status ``` 3. 為 GitLab 創建數據庫用戶: ``` sudo -u postgres psql -d template1 -c "CREATE USER git CREATEDB;" ``` 4. 創建`pg_trgm`擴展(GitLab 8.6+必需): ``` sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" ``` 5. 創建 GitLab 生產數據庫并授予該數據庫的所有特權: ``` sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;" ``` 6. 嘗試使用新用戶連接到新數據庫: ``` sudo -u git -H psql -d gitlabhq_production ``` 7. 檢查是否啟用了`pg_trgm`擴展名: ``` SELECT true AS enabled FROM pg_available_extensions WHERE name = 'pg_trgm' AND installed_version IS NOT NULL; ``` 如果啟用了擴展名,將產生以下輸出: ``` enabled --------- t (1 row) ``` 8. 退出數據庫會話: ``` gitlabhq_production> \q ``` ## 7\. Redis[](#7-redis "Permalink") GitLab 至少需要 Redis 5.0. 如果您使用的是 Debian 10 或 Ubuntu 20.04 及更高版本,則可以使用以下命令安裝 Redis 5.0: ``` sudo apt-get install redis-server ``` 完成后,您可以配置 Redis: ``` # Configure redis to use sockets sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig # Disable Redis listening on TCP by setting 'port' to 0 sudo sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf # Enable Redis socket for default Debian / Ubuntu path echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf # Grant permission to the socket to all members of the redis group echo 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.conf # Create the directory which contains the socket sudo mkdir -p /var/run/redis sudo chown redis:redis /var/run/redis sudo chmod 755 /var/run/redis # Persist the directory which contains the socket, if applicable if [ -d /etc/tmpfiles.d ]; then echo 'd /var/run/redis 0755 redis redis 10d -' | sudo tee -a /etc/tmpfiles.d/redis.conf fi # Activate the changes to redis.conf sudo service redis-server restart # Add git to the redis group sudo usermod -aG redis git ``` ## 8\. GitLab[](#8-gitlab "Permalink") ``` # We'll install GitLab into the home directory of the user "git" cd /home/git ``` ### Clone the Source[](#clone-the-source "Permalink") 克隆社區版: ``` # Clone GitLab repository sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-foss.git -b X-Y-stable gitlab ``` 克隆企業版: ``` # Clone GitLab repository sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ee.git -b X-Y-stable gitlab ``` 確保用與要安裝的版本匹配的穩定分支替換`XY-stable` . 例如,如果要安裝 11.8,則可以使用分支名稱`11-8-stable` . **注意:**您可以更改`XY-stable` ,以`master` ,如果你想最*前沿*的版本,但從來沒有安裝`master`在生產服務器上! ### Configure It[](#configure-it "Permalink") ``` # Go to GitLab installation folder cd /home/git/gitlab # Copy the example GitLab config sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml # Update GitLab config file, follow the directions at top of the file sudo -u git -H editor config/gitlab.yml # Copy the example secrets file sudo -u git -H cp config/secrets.yml.example config/secrets.yml sudo -u git -H chmod 0600 config/secrets.yml # Make sure GitLab can write to the log/ and tmp/ directories sudo chown -R git log/ sudo chown -R git tmp/ sudo chmod -R u+rwX,go-w log/ sudo chmod -R u+rwX tmp/ # Make sure GitLab can write to the tmp/pids/ and tmp/sockets/ directories sudo chmod -R u+rwX tmp/pids/ sudo chmod -R u+rwX tmp/sockets/ # Create the public/uploads/ directory sudo -u git -H mkdir -p public/uploads/ # Make sure only the GitLab user has access to the public/uploads/ directory # now that files in public/uploads are served by gitlab-workhorse sudo chmod 0700 public/uploads # Change the permissions of the directory where CI job logs are stored sudo chmod -R u+rwX builds/ # Change the permissions of the directory where CI artifacts are stored sudo chmod -R u+rwX shared/artifacts/ # Change the permissions of the directory where GitLab Pages are stored sudo chmod -R ug+rwX shared/pages/ # Copy the example Puma config sudo -u git -H cp config/puma.rb.example config/puma.rb # Refer to https://github.com/puma/puma#configuration for more information. # You should scale Puma workers and threads based on the number of CPU # cores you have available. You can get that number via the `nproc` command. sudo -u git -H editor config/puma.rb # Copy the example Rack attack config sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb # Configure Git global settings for git user # 'autocrlf' is needed for the web editor sudo -u git -H git config --global core.autocrlf input # Disable 'git gc --auto' because GitLab already runs 'git gc' when needed sudo -u git -H git config --global gc.auto 0 # Enable packfile bitmaps sudo -u git -H git config --global repack.writeBitmaps true # Enable push options sudo -u git -H git config --global receive.advertisePushOptions true # Enable fsyncObjectFiles to reduce risk of repository corruption if the server crashes sudo -u git -H git config --global core.fsyncObjectFiles true # Configure Redis connection settings sudo -u git -H cp config/resque.yml.example config/resque.yml # Change the Redis socket path if you are not using the default Debian / Ubuntu configuration sudo -u git -H editor config/resque.yml ``` **注意:**請確保同時編輯`gitlab.yml`和`puma.rb`以匹配您的設置. 如果要使用 Unicorn Web 服務器,請參閱" [使用 Unicorn"](#using-unicorn)以了解其他步驟.**注意:**如果要使用 HTTPS,請參閱" [使用 HTTPS"](#using-https)以了解其他步驟. ### Configure GitLab DB Settings[](#configure-gitlab-db-settings "Permalink") ``` sudo -u git cp config/database.yml.postgresql config/database.yml # Remove host, username, and password lines from config/database.yml. # Once modified, the `production` settings will be as follows: # # production: # adapter: postgresql # encoding: unicode # database: gitlabhq_production # pool: 10 # sudo -u git -H editor config/database.yml # Remote PostgreSQL only: # Update username/password in config/database.yml. # You only need to adapt the production settings (first part). # If you followed the database guide then please do as follows: # Change 'secure password' with the value you have given to $password # You can keep the double quotes around the password sudo -u git -H editor config/database.yml # Make config/database.yml readable to git only sudo -u git -H chmod o-rwx config/database.yml ``` ### Install Gems[](#install-gems "Permalink") **注意:**從 Bundler 1.5.2 開始,您可以調用`bundle install -jN` (其中`N`是您的處理器內核數)并享受并行 gem 的安裝,其完成時間有可衡量的差異(快 60%). 使用`nproc`檢查您的內核數. 有關更多信息,請參見這篇[文章](https://thoughtbot.com/blog/parallel-gem-installing-using-bundler) . 確保您有`bundle` (運行`bundle -v` ): * `>= 1.5.2` ,因為某些[問題](https://devcenter.heroku.com/changelog-items/411)已在 1.5.2 中[修復](https://github.com/rubygems/bundler/pull/2817) . * `< 2.x`. ``` sudo -u git -H bundle install --deployment --without development test mysql aws kerberos ``` **注意:**如果要使用 Kerberos 進行用戶身份驗證,請在上面的`--without`選項中省略`kerberos` . ### Install GitLab Shell[](#install-gitlab-shell "Permalink") GitLab Shell 是專門為 GitLab 開發的 SSH 訪問和存儲庫管理軟件. ``` # Run the installation task for gitlab-shell: sudo -u git -H bundle exec rake gitlab:shell:install RAILS_ENV=production # By default, the gitlab-shell config is generated from your main GitLab config. # You can review (and modify) the gitlab-shell config as follows: sudo -u git -H editor /home/git/gitlab-shell/config.yml ``` **注意:**如果要使用 HTTPS,請參閱" [使用 HTTPS"](#using-https)以了解其他步驟.**注意:**確保您的主機名可以通過正確的 DNS 記錄或`/etc/hosts`的其他行(" 127.0.0.1 主機名")在計算機上解析. 例如,如果您在反向代理后面設置了 GitLab,則可能有必要. 如果無法解析主機名,則最終安裝檢查將失敗,并具有`Check GitLab API access: FAILED. code: 401` `Check GitLab API access: FAILED. code: 401`和推送提交將通過`[remote rejected] master -> master (hook declined)` . ### Install GitLab Workhorse[](#install-gitlab-workhorse "Permalink") GitLab-Workhorse 使用[GNU Make](https://www.gnu.org/software/make/) . 以下命令行將在建議的位置`/home/git/gitlab-workhorse`安裝 GitLab-Workhorse. ``` sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production ``` 您可以通過提供其他參數來指定其他 Git 存儲庫: ``` sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse,https://example.com/gitlab-workhorse.git]" RAILS_ENV=production ``` ### Install GitLab-Elasticsearch-indexer on Enterprise Edition[](#install-gitlab-elasticsearch-indexer-on-enterprise-edition "Permalink") GitLab-Elasticsearch-Indexer 使用[GNU Make](https://www.gnu.org/software/make/) . 以下命令行將在推薦位置`/home/git/gitlab-elasticsearch-indexer`中安裝 GitLab-Elasticsearch-Indexer. ``` sudo -u git -H bundle exec rake "gitlab:indexer:install[/home/git/gitlab-elasticsearch-indexer]" RAILS_ENV=production ``` 您可以通過提供其他參數來指定其他 Git 存儲庫: ``` sudo -u git -H bundle exec rake "gitlab:indexer:install[/home/git/gitlab-elasticsearch-indexer,https://example.com/gitlab-elasticsearch-indexer.git]" RAILS_ENV=production ``` 首先將源代碼提取到第一個參數指定的路徑. 然后,將在其`bin`目錄下構建一個二進制文件. 然后,您將需要更新`gitlab.yml`的`production -> elasticsearch -> indexer_path`設置以指向該二進制文件. **注意:** Elasticsearch 是 GitLab 企業版的一項功能,不包含在 GitLab 社區版中. ### Install GitLab Pages[](#install-gitlab-pages "Permalink") GitLab Pages 使用[GNU Make](https://www.gnu.org/software/make/) . 此步驟是可選的,僅當您希望在 GitLab 中托管靜態站點時才需要. 以下命令將在`/home/git/gitlab-pages`安裝 GitLab `/home/git/gitlab-pages` . 有關其他設置步驟,請查閱適用于您的 GitLab 版本的[管理指南](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/administration/pages/source.md) ,因為 GitLab Pages 守護程序可以通過幾種不同的方式運行. ``` cd /home/git sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-pages.git cd gitlab-pages sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_PAGES_VERSION) sudo -u git -H make ``` ### Install Gitaly[](#install-gitaly "Permalink") ``` # Fetch Gitaly source with Git and compile with Go cd /home/git/gitlab sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/git/repositories]" RAILS_ENV=production ``` 您可以通過提供其他參數來指定其他 Git 存儲庫: ``` sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/git/repositories,https://example.com/gitaly.git]" RAILS_ENV=production ``` 接下來,確保已配置 Gitaly: ``` # Restrict Gitaly socket access sudo chmod 0700 /home/git/gitlab/tmp/sockets/private sudo chown git /home/git/gitlab/tmp/sockets/private # If you are using non-default settings you need to update config.toml cd /home/git/gitaly sudo -u git -H editor config.toml ``` For more information about configuring Gitaly see [the Gitaly documentation](../administration/gitaly/index.html). ### Start Gitaly[](#start-gitaly "Permalink") Gitaly 必須在下一節中運行. ``` gitlab_path=/home/git/gitlab gitaly_path=/home/git/gitaly sudo -u git -H sh -c "$gitlab_path/bin/daemon_with_pidfile $gitlab_path/tmp/pids/gitaly.pid \ $gitaly_path/gitaly $gitaly_path/config.toml >> $gitlab_path/log/gitaly.log 2>&1 &" ``` ### Initialize Database and Activate Advanced Features[](#initialize-database-and-activate-advanced-features "Permalink") ``` cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # Type 'yes' to create the database tables. # or you can skip the question by adding force=yes sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes # When done, you see 'Administrator account created:' ``` **注意:**您可以通過分別在環境變量`GITLAB_ROOT_PASSWORD`和`GITLAB_ROOT_EMAIL`提供管理員/ root 密碼和電子郵件來設置它們,如下所示. 如果您未設置密碼(并且密碼已設置為默認密碼),請等待 GitLab 暴露在公共互聯網上,直到安裝完成并且您已首次登錄服務器. 首次登錄時,將被迫更改默認密碼. 通過在`GITLAB_LICENSE_FILE`環境變量中提供完整路徑,此時也可以安裝 Enterprise Edition 許可證. ``` sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail GITLAB_LICENSE_FILE="/path/to/license" ``` ### Secure secrets.yml[](#secure-secretsyml "Permalink") `secrets.yml`文件存儲會話和安全變量的加密密鑰. 備份`secrets.yml`安全保存,但是請不要將其與數據庫備份存儲在同一位置. 否則,如果其中一個備份遭到破壞,您的秘密就會暴露出來. ### Install Init Script[](#install-init-script "Permalink") 下載初始化腳本(將為`/etc/init.d/gitlab` ): ``` sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ``` 而且,如果要使用非默認文件夾或用戶安裝,請復制并編輯默認文件: ``` sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab ``` 如果將 GitLab 安裝在其他目錄中或以默認用戶以外的用戶身份安裝,則應在`/etc/default/gitlab`更改這些設置. 不要編輯`/etc/init.d/gitlab`因為它將在升級時更改. 使 GitLab 在啟動時啟動: ``` sudo update-rc.d gitlab defaults 21 ``` ### Set up Logrotate[](#set-up-logrotate "Permalink") ``` sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab ``` ### Check Application Status[](#check-application-status "Permalink") 檢查 GitLab 及其環境是否配置正確: ``` sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production ``` ### Compile GetText PO files[](#compile-gettext-po-files "Permalink") ``` sudo -u git -H bundle exec rake gettext:compile RAILS_ENV=production ``` ### Compile Assets[](#compile-assets "Permalink") ``` sudo -u git -H yarn install --production --pure-lockfile sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production ``` 如果`rake`因`JavaScript heap out of memory`不足錯誤而失敗,請嘗試按如下所示設置`NODE_OPTIONS`來運行它. ``` sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096" ``` ### Start Your GitLab Instance[](#start-your-gitlab-instance "Permalink") ``` sudo service gitlab start # or sudo /etc/init.d/gitlab restart ``` ## 9\. NGINX[](#9-nginx "Permalink") **注意:** NGINX 是 GitLab 官方支持的 Web 服務器. 如果您不能或不想將 NGINX 用作 Web 服務器,請參閱[GitLab 配方](https://gitlab.com/gitlab-org/gitlab-recipes/) . ### Installation[](#installation "Permalink") ``` sudo apt-get install -y nginx ``` ### Site Configuration[](#site-configuration "Permalink") 復制示例站點配置: ``` sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab ``` 確保編輯配置文件以匹配您的設置. 另外,請確保您與 GitLab 的路徑匹配,尤其是在為`git`用戶以外的用戶安裝時: ``` # Change YOUR_SERVER_FQDN to the fully-qualified # domain name of your host serving GitLab. # # Remember to match your paths to GitLab, especially # if installing for a user other than 'git'. # # If using Ubuntu default nginx install: # either remove the default_server from the listen line # or else sudo rm -f /etc/nginx/sites-enabled/default sudo editor /etc/nginx/sites-available/gitlab ``` 如果您打算啟用 GitLab 頁面,則需要使用一個單獨的 NGINX 配置. 在[GitLab 頁面管理指南中](../administration/pages/index.html)閱讀有關所需配置的所有信息. **注意:**如果要使用 HTTPS,請將`gitlab` NGINX 配置替換為`gitlab-ssl` . 有關 HTTPS 配置的詳細信息,請參見[使用 HTTPS](#using-https) . ### Test Configuration[](#test-configuration "Permalink") 使用以下命令驗證`gitlab`或`gitlab-ssl` NGINX 配置文件: ``` sudo nginx -t ``` 您應該會收到`syntax is okay`并且`test is successful`消息. 如果收到錯誤,請按照給出的錯誤消息中的說明檢查`gitlab`或`gitlab-ssl` NGINX 配置文件是否有錯別字等. **注意:**通過運行`nginx -v`驗證安裝的版本是否大于 1.12.1\. 如果它較低,您可能會收到以下錯誤: `nginx: [emerg] unknown "start$temp=[filtered]$rest" variable nginx: configuration file /etc/nginx/nginx.conf test failed` ### Restart[](#restart "Permalink") ``` sudo service nginx restart ``` ## Post-install[](#post-install "Permalink") ### Double-check Application Status[](#double-check-application-status "Permalink") 為了確保您不會錯過任何東西,請使用以下命令進行更徹底的檢查: ``` sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production ``` 如果所有項目均為綠色,則恭喜您成功安裝了 GitLab! 向`gitlab:check`提供`SANITIZE=true`環境變量,以從 check 命令的輸出中省略項目名稱. ### Initial Login[](#initial-login "Permalink") 在您的 Web 瀏覽器中訪問 YOUR_SERVER 進行首次 GitLab 登錄. 如果[在設置過程中](#initialize-database-and-activate-advanced-features)未[提供 root 密碼,](#initialize-database-and-activate-advanced-features)則將重定向到密碼重置屏幕,以提供初始管理員帳戶的密碼. 輸入所需的密碼,您將被重定向回登錄屏幕. 默認帳戶的用戶名是**root** . 提供您先前創建的密碼并登錄. 登錄后,您可以根據需要更改用戶名. **Enjoy!** You can use `sudo service gitlab start` and `sudo service gitlab stop` to start and stop GitLab. ## Advanced Setup Tips[](#advanced-setup-tips "Permalink") ### Relative URL support[](#relative-url-support "Permalink") 有關如何使用相對 URL 配置 GitLab 的更多信息,請參見[相對 URL 文檔](relative_url.html) . ### Using HTTPS[](#using-https "Permalink") 要將 GitLab 與 HTTPS 一起使用: 1. In `gitlab.yml`: 1. 將第 1 節中的`port`選項設置為`443` . 2. 將第 1 節中的`https`選項設置為`true` . 2. 在 GitLab Shell 的`config.yml`中: 1. 將`gitlab_url`選項設置為 GitLab 的 HTTPS 端點(例如`https://git.example.com` ). 2. 使用`ca_file`或`ca_path`選項設置證書. 3. 使用`gitlab-ssl` NGINX 示例配置,而不是`gitlab`配置. 1. 更新`YOUR_SERVER_FQDN` . 2. 更新`ssl_certificate`和`ssl_certificate_key` . 3. 查看配置文件,并考慮應用其他安全性和性能增強功能. 不鼓勵使用自簽名證書,但如果必須使用它,請遵循正常說明. 然后: 1. 生成自簽名 SSL 證書: ``` mkdir -p /etc/nginx/ssl/ cd /etc/nginx/ssl/ sudo openssl req -newkey rsa:2048 -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key sudo chmod o-r gitlab.key ``` 2. 在 GitLab Shell 的`config.yml` ,將`self_signed_cert`設置為`true` . ### Enable Reply by email[](#enable-reply-by-email "Permalink") 有關如何進行此設置的更多信息,請參見["通過電子郵件答復"文檔](../administration/reply_by_email.html) . ### LDAP Authentication[](#ldap-authentication "Permalink") 您可以在`config/gitlab.yml`配置 LDAP 身份驗證. 編輯此文件后,重新啟動 GitLab. ### Using Custom OmniAuth Providers[](#using-custom-omniauth-providers "Permalink") 請參閱[OmniAuth 集成文檔](../integration/omniauth.html) . ### Build your projects[](#build-your-projects "Permalink") GitLab 可以構建您的項目. 要啟用該功能,您需要 GitLab Runners 為您執行此操作. 請參閱[GitLab Runner 部分](https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/#gitlab-runner)進行安裝. ### Adding your Trusted Proxies[](#adding-your-trusted-proxies "Permalink") 如果要在單獨的計算機上使用反向代理,則可能要將代理添加到"受信任的代理"列表中. 否則,用戶將顯示為從代理的 IP 地址登錄. 您可以通過自定義第 1 節中的`trusted_proxies`選項在`config/gitlab.yml`添加受信任的代理.保存文件并[重新配置 GitLab,](../administration/restart_gitlab.html)以使更改生效. ### Custom Redis Connection[](#custom-redis-connection "Permalink") 如果您想通過非標準端口或其他主機連接到 Redis 服務器,則可以通過`config/resque.yml`文件配置其連接字符串. ``` # example production: url: redis://redis.example.tld:6379 ``` 如果要通過套接字連接 Redis 服務器,請使用" unix:" URL 方案以及`config/resque.yml`文件中 Redis 套接字文件的路徑. ``` # example production: url: unix:/path/to/redis/socket ``` 另外,您可以在`config/resque.yml`文件中使用環境變量: ``` # example production: url: <%= ENV.fetch('GITLAB_REDIS_URL') %> ``` ### Custom SSH Connection[](#custom-ssh-connection "Permalink") 如果您在非標準端口上運行 SSH,則必須更改 GitLab 用戶的 SSH 配置. ``` # Add to /home/git/.ssh/config host localhost # Give your setup a name (here: override localhost) user git # Your remote git user port 2222 # Your port number hostname 127.0.0.1; # Your server name or IP ``` 您還需要在`config\gitlab.yml`文件中更改相應的選項(例如`ssh_user` , `ssh_host` , `admin_uri` ). ### Additional Markup Styles[](#additional-markup-styles "Permalink") 除了始終支持的 Markdown 樣式外,GitLab 還可以顯示其他富文本文件. 但是您可能必須安裝依賴項才能這樣做. 有關更多信息,請參見[`github-markup` gem 自述文件](https://github.com/gitlabhq/markup#markups) . ### Using Unicorn[](#using-unicorn "Permalink") 從 GitLab 12.9 開始, [Puma](https://github.com/puma/puma)已取代 Unicorn 成為默認源安裝 Web 服務器. 如果要切換回獨角獸,請按照下列步驟操作: 1. 完成 GitLab 設置,以使其啟動并運行. 2. 將提供的示例 Unicorn 配置文件復制到位: ``` cd /home/git/gitlab # Copy config file for the web server sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb ``` 3. 編輯系統`init.d`腳本并設置`USE_WEB_SERVER="unicorn"` . 如果您有`/etc/default/gitlab` ,那么您應該對其進行編輯. 4. Restart GitLab. ### Using Sidekiq instead of Sidekiq Cluster[](#using-sidekiq-instead-of-sidekiq-cluster "Permalink") 從 GitLab 12.10 開始,Source 安裝使用`bin/sidekiq-cluster`來管理 Sidekiq 進程. 在 14.0 之前,仍支持直接使用 Sidekiq. 因此,如果您遇到問題,請: 1. 編輯系統`init.d`腳本以刪除`SIDEKIQ_WORKERS`標志. 如果您有`/etc/default/gitlab` ,那么您應該對其進行編輯. 2. 重新啟動 GitLab. 3. [創建一個](https://gitlab.com/gitlab-org/gitlab/-/issues/-/new)描述問題的問題. ## Troubleshooting[](#troubleshooting "Permalink") ### “You appear to have cloned an empty repository.”[](#you-appear-to-have-cloned-an-empty-repository "Permalink") 如果在嘗試克隆由 GitLab 托管的存儲庫時看到此消息,則可能是由于 NGINX 或 Apache 配置過時,或者缺少或配置了錯誤的 GitLab Workhorse 實例. 仔細檢查您是否已[安裝 Go](#3-go) , [已安裝 GitLab Workhorse](#install-gitlab-workhorse)并已正確[配置 NGINX](#site-configuration) . ### `google-protobuf` “LoadError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14’ not found”[](#google-protobuf-loaderror-libx86_64-linux-gnulibcso6-version-glibc_214-not-found "Permalink") 對于某些版本的`google-protobuf` gem,這可能會在某些平臺上發生. 解決方法是安裝此 gem 的僅源版本. 首先,您必須找到 GitLab 安裝所需的`google-protobuf`確切版本: ``` cd /home/git/gitlab # Only one of the following two commands will print something. It # will look like: * google-protobuf (3.2.0) bundle list | grep google-protobuf bundle check | grep google-protobuf ``` 下面以`3.2.0`為例. 將其替換為您在上面找到的版本號: ``` cd /home/git/gitlab sudo -u git -H gem install google-protobuf --version 3.2.0 --platform ruby ``` 最后,您可以測試`google-protobuf`是否正確加載. 以下應打印"確定". ``` sudo -u git -H bundle exec ruby -rgoogle/protobuf -e 'puts :OK' ``` 如果`gem install`命令失敗,則可能需要安裝操作系統的開發人員工具. 在 Debian / Ubuntu 上: ``` sudo apt-get install build-essential libgmp-dev ``` 在 RedHat / CentOS 上: ``` sudo yum groupinstall 'Development Tools' ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看