From 536aa3a1f4b96abc4ca34489bf2cbe503afcded7 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 30 Jan 2020 15:09:15 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- doc/install/installation.md | 126 ++++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'doc/install/installation.md') diff --git a/doc/install/installation.md b/doc/install/installation.md index 5cd8f98b2f3..7f8d808628f 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -91,7 +91,7 @@ The GitLab installation consists of setting up the following components: `sudo` is not installed on Debian by default. Make sure your system is up-to-date and install it. -```sh +```shell # run as root! apt-get update -y apt-get upgrade -y @@ -101,7 +101,7 @@ apt-get install sudo -y NOTE: **Note:** During this installation, some files will need to be edited manually. If you are familiar with vim, set it as default editor with the commands below. If you are not familiar with vim, skip this and keep using the default editor. -```sh +```shell # Install vim and set as default editor sudo apt-get install -y vim sudo update-alternatives --set editor /usr/bin/vim.basic @@ -109,7 +109,7 @@ sudo update-alternatives --set editor /usr/bin/vim.basic Install the required packages (needed to compile Ruby and native extensions to Ruby gems): -```sh +```shell 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 \ @@ -121,7 +121,7 @@ you can [install re2 manually](https://github.com/google/re2/wiki/Install). If you want to use Kerberos for user authentication, install `libkrb5-dev`: -```sh +```shell sudo apt-get install libkrb5-dev ``` @@ -130,7 +130,7 @@ If you don't know what Kerberos is, you can assume you don't need it. Make sure you have the right version of Git installed: -```sh +```shell # Install Git sudo apt-get install -y git-core @@ -141,7 +141,7 @@ git --version Starting with GitLab 12.0, Git is required to be compiled with `libpcre2`. Find out if that's the case: -```sh +```shell ldd /usr/local/bin/git | grep pcre2 ``` @@ -153,7 +153,7 @@ libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x00007f08461c3000) Is the system packaged Git too old, or not compiled with pcre2? Remove it and compile from source: -```sh +```shell # Remove packaged Git sudo apt-get remove git-core @@ -186,13 +186,13 @@ sudo make prefix=/usr/local install For the [Custom Favicon](../user/admin_area/appearance.md#favicon) to work, GraphicsMagick needs to be installed. -```sh +```shell sudo apt-get install -y graphicsmagick ``` **Note:** In order to receive mail notifications, make sure to install a mail server. By default, Debian is shipped with exim4 but this [has problems](https://gitlab.com/gitlab-org/gitlab-foss/issues/12754) while Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with: -```sh +```shell sudo apt-get install -y postfix ``` @@ -216,13 +216,13 @@ instructions are designed to install Ruby from the official source code. Remove the old Ruby 1.8 if present: -```sh +```shell sudo apt-get remove ruby1.8 ``` Download Ruby and compile it: -```sh +```shell mkdir /tmp/ruby && cd /tmp/ruby curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.gz echo '1416ce288fb8bfeae07a12b608540318c9cace71 ruby-2.6.5.tar.gz' | shasum -c - && tar xzf ruby-2.6.5.tar.gz @@ -235,7 +235,7 @@ sudo make install Then install the Bundler gem (a version below 2.x): -```sh +```shell sudo gem install bundler --no-document --version '< 2' ``` @@ -246,7 +246,7 @@ GitLab we need a Go compiler. The instructions below assume you use 64-bit Linux. You can find downloads for other platforms at the [Go download page](https://golang.org/dl). -```sh +```shell # Remove former Go installation folder sudo rm -rf /usr/local/go @@ -270,7 +270,7 @@ In many distros, the versions provided by the official package repositories are out of date, so we'll need to install through the following commands: -```sh +```shell # install node v12.x curl --location https://deb.nodesource.com/setup_12.x | sudo bash - sudo apt-get install -y nodejs @@ -287,7 +287,7 @@ Visit the official websites for [node](https://nodejs.org/en/download/package-ma Create a `git` user for GitLab: -```sh +```shell sudo adduser --disabled-login --gecos 'GitLab' git ``` @@ -299,37 +299,37 @@ use of extensions and concurrent index removal, you need at least PostgreSQL 9.2 1. Install the database packages: - ```sh + ```shell sudo apt-get install -y postgresql postgresql-client libpq-dev postgresql-contrib ``` 1. Create a database user for GitLab: - ```sh + ```shell sudo -u postgres psql -d template1 -c "CREATE USER git CREATEDB;" ``` 1. Create the `pg_trgm` extension (required for GitLab 8.6+): - ```sh + ```shell sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" ``` 1. Create the GitLab production database and grant all privileges on the database: - ```sh + ```shell sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;" ``` 1. Try connecting to the new database with the new user: - ```sh + ```shell sudo -u git -H psql -d gitlabhq_production ``` 1. Check if the `pg_trgm` extension is enabled: - ```sh + ```shell SELECT true AS enabled FROM pg_available_extensions WHERE name = 'pg_trgm' @@ -347,7 +347,7 @@ use of extensions and concurrent index removal, you need at least PostgreSQL 9.2 1. Quit the database session: - ```sh + ```shell gitlabhq_production> \q ``` @@ -358,13 +358,13 @@ GitLab requires at least Redis 2.8. If you are using Debian 8 or Ubuntu 14.04 and up, you can simply install Redis 2.8 with: -```sh +```shell sudo apt-get install redis-server ``` Once done, you can configure Redis: -```sh +```shell # Configure redis to use sockets sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig @@ -396,14 +396,14 @@ sudo usermod -aG redis git ## 8. GitLab -```sh +```shell # We'll install GitLab into the home directory of the user "git" cd /home/git ``` ### Clone the Source -```sh +```shell # Clone GitLab repository sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-foss.git -b X-Y-stable gitlab ``` @@ -417,7 +417,7 @@ You can change `X-Y-stable` to `master` if you want the *bleeding edge* version, ### Configure It -```sh +```shell # Go to GitLab installation folder cd /home/git/gitlab @@ -503,7 +503,7 @@ If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional ste ### Configure GitLab DB Settings -```sh +```shell sudo -u git cp config/database.yml.postgresql config/database.yml # Remove host, username, and password lines from config/database.yml. @@ -539,7 +539,7 @@ Make sure you have `bundle` (run `bundle -v`): - `>= 1.5.2`, because some [issues](https://devcenter.heroku.com/changelog-items/411) were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. - `< 2.x`. -```sh +```shell sudo -u git -H bundle install --deployment --without development test mysql aws kerberos ``` @@ -550,7 +550,7 @@ If you want to use Kerberos for user authentication, omit `kerberos` in the `--w GitLab Shell is an SSH access and repository management software developed specially for GitLab. -```sh +```shell # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production SKIP_STORAGE_VALIDATION=true @@ -578,13 +578,13 @@ GitLab-Workhorse uses [GNU Make](https://www.gnu.org/software/make/). The following command-line will install GitLab-Workhorse in `/home/git/gitlab-workhorse` which is the recommended location. -```sh +```shell sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production ``` You can specify a different Git repository by providing it as an extra parameter: -```sh +```shell sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse,https://example.com/gitlab-workhorse.git]" RAILS_ENV=production ``` @@ -594,13 +594,13 @@ GitLab-Elasticsearch-Indexer uses [GNU Make](https://www.gnu.org/software/make/) following command-line will install GitLab-Elasticsearch-Indexer in `/home/git/gitlab-elasticsearch-indexer` which is the recommended location. -```sh +```shell sudo -u git -H bundle exec rake "gitlab:indexer:install[/home/git/gitlab-elasticsearch-indexer]" RAILS_ENV=production ``` You can specify a different Git repository by providing it as an extra parameter: -```sh +```shell 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 ``` @@ -611,7 +611,7 @@ You will then need to update `gitlab.yml`'s `production -> elasticsearch -> inde GitLab Pages uses [GNU Make](https://www.gnu.org/software/make/). This step is optional and only needed if you wish to host static sites from within GitLab. The following commands will install GitLab Pages in `/home/git/gitlab-pages`. For additional setup steps, consult the [administration guide](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/administration/pages/source.md) for your version of GitLab as the GitLab Pages daemon can be run several different ways. -```sh +```shell cd /home/git sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-pages.git cd gitlab-pages @@ -621,7 +621,7 @@ sudo -u git -H make ### Install Gitaly -```sh +```shell # 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 @@ -629,13 +629,13 @@ sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/gi You can specify a different Git repository by providing it as an extra parameter: -```sh +```shell sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/git/repositories,https://example.com/gitaly.git]" RAILS_ENV=production ``` Next, make sure that Gitaly is configured: -```sh +```shell # Restrict Gitaly socket access sudo chmod 0700 /home/git/gitlab/tmp/sockets/private sudo chown git /home/git/gitlab/tmp/sockets/private @@ -652,7 +652,7 @@ For more information about configuring Gitaly see Gitaly must be running for the next section. -```sh +```shell gitlab_path=/home/git/gitlab gitaly_path=/home/git/gitaly @@ -662,7 +662,7 @@ sudo -u git -H sh -c "$gitlab_path/bin/daemon_with_pidfile $gitlab_path/tmp/pids ### Initialize Database and Activate Advanced Features -```sh +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # Type 'yes' to create the database tables. @@ -676,7 +676,7 @@ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes NOTE: **Note:** You can set the Administrator/root password and e-mail by supplying them in environmental variables, `GITLAB_ROOT_PASSWORD` and `GITLAB_ROOT_EMAIL` respectively, as seen below. If you don't set the password (and it is set to the default one), wait to expose GitLab to the public internet until the installation is done and you've logged into the server the first time. During the first login, you'll be forced to change the default password. An Enterprise Edition license may also be installed at this time by supplying a full path in the `GITLAB_LICENSE_FILE` environment variable. -```sh +```shell 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" ``` @@ -690,13 +690,13 @@ Otherwise, your secrets are exposed if one of your backups is compromised. Download the init script (will be `/etc/init.d/gitlab`): -```sh +```shell sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ``` And if you are installing with a non-default folder or user copy and edit the defaults file: -```sh +```shell sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab ``` @@ -704,13 +704,13 @@ If you installed GitLab in another directory or as a user other than the default Make GitLab start on boot: -```sh +```shell sudo update-rc.d gitlab defaults 21 ``` ### Set up Logrotate -```sh +```shell sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab ``` @@ -718,32 +718,32 @@ sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab Check if GitLab and its environment are configured correctly: -```sh +```shell sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production ``` ### Compile GetText PO files -```sh +```shell sudo -u git -H bundle exec rake gettext:compile RAILS_ENV=production ``` ### Compile Assets -```sh +```shell 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 ``` If `rake` fails with `JavaScript heap out of memory` error, try to run it with `NODE_OPTIONS` set as follows. -```sh +```shell 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 -```sh +```shell sudo service gitlab start # or sudo /etc/init.d/gitlab restart @@ -756,7 +756,7 @@ NGINX is the officially supported web server for GitLab. If you cannot or do not ### Installation -```sh +```shell sudo apt-get install -y nginx ``` @@ -764,14 +764,14 @@ sudo apt-get install -y nginx Copy the example site config: -```sh +```shell sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab ``` Make sure to edit the config file to match your setup. Also, ensure that you match your paths to GitLab, especially if installing for a user other than the `git` user: -```sh +```shell # Change YOUR_SERVER_FQDN to the fully-qualified # domain name of your host serving GitLab. # @@ -794,7 +794,7 @@ to use. Read all about the needed configuration at the Validate your `gitlab` or `gitlab-ssl` NGINX config file with the following command: -```sh +```shell sudo nginx -t ``` @@ -807,7 +807,7 @@ nginx: configuration file /etc/nginx/nginx.conf test failed` ### Restart -```sh +```shell sudo service nginx restart ``` @@ -817,7 +817,7 @@ sudo service nginx restart To make sure you didn't miss anything run a more thorough check with: -```sh +```shell sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production ``` @@ -867,7 +867,7 @@ Using a self-signed certificate is discouraged but if you must use it, follow th 1. Generate a self-signed SSL certificate: - ```sh + ```shell 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 @@ -956,7 +956,7 @@ To use GitLab with Puma: 1. Finish GitLab setup so you have it up and running. 1. Copy the supplied example Puma config file into place: - ```sh + ```shell cd /home/git/gitlab # Copy config file for the web server @@ -985,7 +985,7 @@ version of this gem. First, you must find the exact version of `google-protobuf` that your GitLab installation requires: -```sh +```shell cd /home/git/gitlab # Only one of the following two commands will print something. It @@ -997,7 +997,7 @@ bundle check | grep google-protobuf Below, `3.2.0` is used as an example. Replace it with the version number you found above: -```sh +```shell cd /home/git/gitlab sudo -u git -H gem install google-protobuf --version 3.2.0 --platform ruby ``` @@ -1005,7 +1005,7 @@ sudo -u git -H gem install google-protobuf --version 3.2.0 --platform ruby Finally, you can test whether `google-protobuf` loads correctly. The following should print 'OK'. -```sh +```shell sudo -u git -H bundle exec ruby -rgoogle/protobuf -e 'puts :OK' ``` @@ -1014,13 +1014,13 @@ tools of your OS. On Debian/Ubuntu: -```sh +```shell sudo apt-get install build-essential libgmp-dev ``` On RedHat/CentOS: -```sh +```shell sudo yum groupinstall 'Development Tools' ``` -- cgit v1.2.3