diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /doc/install/installation.md | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'doc/install/installation.md')
-rw-r--r-- | doc/install/installation.md | 191 |
1 files changed, 160 insertions, 31 deletions
diff --git a/doc/install/installation.md b/doc/install/installation.md index 7c8718a7005..cd00593a99b 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -2,7 +2,6 @@ stage: Enablement group: Distribution info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments -type: howto --- # Installation from source **(FREE SELF)** @@ -424,6 +423,49 @@ 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 +# Add git to the redis group +sudo usermod -aG redis git +``` + +### Supervise Redis with systemd + +If your distribution uses systemd init and the output of the following command is `notify`, +you do not need to make any changes: + +```shell +systemctl show --value --property=Type redis-server.service +``` + +If the output is **not** `notify`, run: + +```shell +# Configure Redis to not daemonize, but be supervised by systemd instead and disable the pidfile +sudo sed -i \ + -e 's/^daemonize yes$/daemonize no/' \ + -e 's/^supervised no$/supervised systemd/' \ + -e 's/^pidfile/# pidfile/' /etc/redis/redis.conf +sudo chown redis:redis /etc/redis/redis.conf + +# Make the same changes to the systemd unit file +sudo mkdir -p /etc/systemd/system/redis-server.service.d +sudo tee /etc/systemd/system/redis-server.service.d/10fix_type.conf <<EOF +[Service] +Type=notify +PIDFile= +EOF + +# Reload the redis service +sudo systemctl daemon-reload + +# Activate the changes to redis.conf +sudo systemctl restart redis-server.service +``` + +### Leave Redis unsupervised + +If your system uses SysV init, run these commands: + +```shell # Create the directory which contains the socket sudo mkdir -p /var/run/redis sudo chown redis:redis /var/run/redis @@ -436,9 +478,6 @@ 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 @@ -688,48 +727,79 @@ sudo -u git -H editor config.toml For more information about configuring Gitaly see [the Gitaly documentation](../administration/gitaly/index.md). -### Start Gitaly +### Install the service -Gitaly must be running for the next section. +GitLab has always supported SysV init scripts, which are widely supported and portable, but now systemd is the standard for service supervision and is used by all major Linux distributions. You should use native systemd services if you can to benefit from automatic restarts, better sandboxing and resource control. -```shell -gitlab_path=/home/git/gitlab -gitaly_path=/home/git/gitaly +#### Install systemd units -sudo -u git -H sh -c "$gitlab_path/bin/daemon_with_pidfile $gitlab_path/tmp/pids/gitaly.pid \ - $gitaly_path/_build/bin/gitaly $gitaly_path/config.toml >> $gitlab_path/log/gitaly.log 2>&1 &" -``` +Use these steps if you use systemd as init. Otherwise, follow the [SysV init script steps](#install-sysv-init-script). -### Initialize Database and Activate Advanced Features +Copy the services and run `systemctl daemon-reload` so that systemd picks them up: ```shell cd /home/git/gitlab -sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production -# Type 'yes' to create the database tables. +sudo mkdir -p /usr/local/lib/systemd/system +sudo cp lib/support/systemd/* /usr/local/lib/systemd/system/ +sudo systemctl daemon-reload +``` -# or you can skip the question by adding force=yes -sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes +The units provided by GitLab make very little assumptions about where you are running Redis and PostgreSQL. -# When done, you see 'Administrator account created:' -``` +If you installed GitLab in another directory or as a user other than the default, you need to change these values in the units as well. -You can set the Administrator/root password and email 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. +For example, if you're running Redis and PostgreSQL on the same machine as GitLab, you should: + +- Edit the Puma service: + + ```shell + sudo systemctl edit gitlab-puma.service + ``` + + In the editor that opens, add the following and save the file: + + ```plaintext + [Unit] + Wants=redis-server.service postgresql.service + After=redis-server.service postgresql.service + ``` + +- Edit the Sidekiq service: + + ```shell + sudo systemctl edit gitlab-sidekiq.service + ``` + + Add the following and save the file: + + ```plaintext + [Unit] + Wants=redis-server.service postgresql.service + After=redis-server.service postgresql.service + ``` + +`systemctl edit` installs drop-in configuration files at `/etc/systemd/system/<name of the unit>.d/override.conf`, so your local configuration is not overwritten when updating the unit files later. To split up your drop-in configuration files, you can add the above snippets to `.conf` files under `/etc/systemd/system/<name of the unit>.d/`. + +If you manually made changes to the unit files or added drop-in configuration files (without using `systemctl edit`), run the following command for them to take effect: ```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" +sudo systemctl daemon-reload ``` -### Secure secrets.yml +Make GitLab start on boot: -The `secrets.yml` file stores encryption keys for sessions and secure variables. -Backup `secrets.yml` someplace safe, but don't store it in the same place as your database backups. -Otherwise, your secrets are exposed if one of your backups is compromised. +```shell +sudo systemctl enable gitlab.target +``` + +#### Install SysV init script -### Install Init Script +Use these steps if you use the SysV init script. If you use systemd, follow the [systemd unit steps](#install-systemd-units). Download the init script (is `/etc/init.d/gitlab`): ```shell +cd /home/git/gitlab sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ``` @@ -745,6 +815,9 @@ Make GitLab start on boot: ```shell sudo update-rc.d gitlab defaults 21 +# or if running this on a machine running systemd +sudo systemctl daemon-reload +sudo systemctl enable gitlab.service ``` ### Set up Logrotate @@ -753,6 +826,51 @@ sudo update-rc.d gitlab defaults 21 sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab ``` +### Start Gitaly + +Gitaly must be running for the next section. + +- To start Gitaly using systemd: + + ```shell + sudo systemctl start gitlab-gitaly.service + ``` + +- To manually start Gitaly for SysV: + + ```shell + 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/_build/bin/gitaly $gitaly_path/config.toml >> $gitlab_path/log/gitaly.log 2>&1 &" + ``` + +### Initialize Database and Activate Advanced Features + +```shell +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:' +``` + +You can set the Administrator/root password and email 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. + +```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" +``` + +### Secure secrets.yml + +The `secrets.yml` file stores encryption keys for sessions and secure variables. +Backup `secrets.yml` someplace safe, but don't store it in the same place as your database backups. +Otherwise, your secrets are exposed if one of your backups is compromised. + ### Check Application Status Check if GitLab and its environment are configured correctly: @@ -783,9 +901,11 @@ sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ ### Start Your GitLab Instance ```shell +# For systems running systemd +sudo systemctl start gitlab.target + +# For systems running SysV init sudo service gitlab start -# or -sudo /etc/init.d/gitlab restart ``` ## 9. NGINX @@ -838,7 +958,9 @@ Validate your `gitlab` or `gitlab-ssl` NGINX configuration file with the followi sudo nginx -t ``` -You should receive `syntax is okay` and `test is successful` messages. If you receive errors check your `gitlab` or `gitlab-ssl` NGINX configuration file for typos, etc. as indicated in the error message given. +You should receive `syntax is okay` and `test is successful` messages. If you +receive error messages, check your `gitlab` or `gitlab-ssl` NGINX configuration +file for typos, as indicated in the provided error message. Verify that the installed version is greater than 1.12.1: @@ -856,6 +978,10 @@ nginx: configuration file /etc/nginx/nginx.conf test failed ### Restart ```shell +# For systems running systemd +sudo systemctl restart nginx.service + +# For systems running SysV init sudo service nginx restart ``` @@ -888,7 +1014,10 @@ earlier and login. After login, you can change the username if you wish. **Enjoy!** -You can use `sudo service gitlab start` and `sudo service gitlab stop` to start and stop GitLab. +To start and stop GitLab when using: + +- systemd units: use `sudo systemctl start gitlab.target` or `sudo systemctl stop gitlab.target`. +- The SysV init script: use `sudo service gitlab start` or `sudo service gitlab stop`. ## Advanced Setup Tips @@ -1026,7 +1155,7 @@ misconfigured GitLab Workhorse instance. Double-check that you've [installed Go](#3-go), [installed GitLab Workhorse](#install-gitlab-workhorse), and correctly [configured NGINX](#site-configuration). -### `google-protobuf` "LoadError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found" +### `google-protobuf` "LoadError: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.14' not found" This can happen on some platforms for some versions of the `google-protobuf` gem. The workaround is to install a source-only |