Installing gitlab on linux

Содержание
  1. Установка веб-инструмента GitLab на Linux Ubuntu Server
  2. Подготовка сервера
  3. 1. Обновление списков пакетов
  4. 2. Время
  5. 3. Настройка брандмауэра
  6. Установка GitLab
  7. 1. Необходимые компоненты
  8. 2. Установка GitLab
  9. 3. Конфигурируем веб-адрес
  10. Вход в веб-интерфейс
  11. Настройка GitLab
  12. Русский интерфейс
  13. Создание репозитория и подключение к нему
  14. Install self-managed GitLab
  15. Official Linux package
  16. Ubuntu
  17. 1. Install and configure the necessary dependencies
  18. 2. Add the GitLab package repository and install the package
  19. 3. Browse to the hostname and login
  20. 4. Set up your communication preferences
  21. 5. Recommended next steps
  22. 1. Install and configure the necessary dependencies
  23. 2. Add the GitLab package repository and install the package
  24. 3. Browse to the hostname and login
  25. 4. Set up your communication preferences
  26. 5. Recommended next steps
  27. Debian
  28. 1. Install and configure the necessary dependencies
  29. 2. Add the GitLab package repository and install the package
  30. 3. Browse to the hostname and login
  31. 4. Set up your communication preferences
  32. 5. Recommended next steps
  33. 1. Install and configure the necessary dependencies
  34. 2. Add the GitLab package repository and install the package
  35. 3. Browse to the hostname and login
  36. 4. Set up your communication preferences
  37. 5. Recommended next steps
  38. CentOS 8
  39. 1. Install and configure the necessary dependencies
  40. 2. Add the GitLab package repository and install the package
  41. 3. Browse to the hostname and login
  42. 4. Set up your communication preferences
  43. 5. Recommended next steps
  44. 1. Install and configure the necessary dependencies
  45. 2. Add the GitLab package repository and install the package
  46. 3. Browse to the hostname and login
  47. 4. Set up your communication preferences
  48. 5. Recommended next steps
  49. CentOS 7
  50. 1. Install and configure the necessary dependencies
  51. 2. Add the GitLab package repository and install the package
  52. 3. Browse to the hostname and login
  53. 4. Set up your communication preferences
  54. 5. Recommended next steps
  55. 1. Install and configure the necessary dependencies
  56. 2. Add the GitLab package repository and install the package
  57. 3. Browse to the hostname and login
  58. 4. Set up your communication preferences
  59. 5. Recommended next steps

Установка веб-инструмента GitLab на Linux Ubuntu Server

Рассмотрим процесс установки и настройки веб-инструмента жизненного цикла DevOps на Linux Ubuntu Server на примере версий 18.04 и 20.04. За основу взята официальная инструкция с сайта GitLab. В нашей инструкции приведен пример установки как платной. так и бесплатной версий программы.

Подготовка сервера

В качестве предварительный настроек, мы обновим список пакетов в репозиториях, настроим правильное время и откроем порты в брандмауэре.

1. Обновление списков пакетов

При желании обновить установленные пакеты, также можно выполнить:

2. Время

Установим часовой пояс:

timedatectl set-timezone Europe/Moscow

* данная команда задаст настройки для московского времени. Все файлы с временными зонами находятся в каталоге /usr/share/zoneinfo.

Для автоматической синхронизации времени ставим пакет:

apt-get install chrony

И разрешаем автозапуск сервиса:

systemctl enable chrony

3. Настройка брандмауэра

По умолчанию, в Ubuntu брандмауэр настроен на то, чтобы принимать любые пакеты. Но если у нас он настроен на блокировку, нужно добавить порты 80 и 443.

iptables -A INPUT -p tcp —dport 80 -j ACCEPT

iptables -A INPUT -p tcp —dport 443 -j ACCEPT

И чтобы сохранить правила, устанавливаем iptables-persistent:

apt-get install iptables-persistent

. и выполняем команду:

Установка GitLab

Установку выполним в два шага — установка необходимых компонентов и, собственно, установка GitLab.

1. Необходимые компоненты

apt-get install curl openssh-server ca-certificates

Для отправки уведомлений, установим также postfix:

apt-get install postfix

При запросе типа конфигурации, выбираем Internet Site (если уведомления должны отправляться наружу) или Local only (уведомления в пределах сервера):

* при получении других запросов во время установки postfix можно ответить по умолчанию, нажимая Enter.

2. Установка GitLab

а) для платной версии:

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash

б) для бесплатной:

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

После установки репозитория, устанавливаем сам GitLab.

а) платную версию:

apt-get install gitlab-ee

б) бесплатную:

apt-get install gitlab-ce

Если установка прошла успешно, мы должны увидеть:

It looks like GitLab has not been configured yet; skipping the upgrade script.

_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/

Thank you for installing GitLab!

3. Конфигурируем веб-адрес

Для запуска и корректной работы портала мы должны задать external_url. Для этого открываем файл:

Нам нужно только изменить параметр external_url:

* данная настройка говорит, что наш веб-инструмент будет отвечать на запросы, которые пришли на узел gitlab.dmosk.ru — это значит, что данное имя должно быть зарегистрирована в DNS или прописано в локальный файл hosts.

Данная операция займет какое-то время.

Вход в веб-интерфейс

Открываем браузер и вводим наш адрес, который мы указали в настройках в опции external_url — в данном примере, http://gitlab.dmosk.ru. Мы должны увидеть страницу авторизации, на которой нас запросят сменить пароль для администратора. Вводим его дважды:

После система попросит ввести логин и пароль — вводим логин root и пароль, который только-что придумали.

Настройка GitLab

Приведем некоторые примеры настроек, которые могут оказаться полезными.

Русский интерфейс

По умолчанию, портал устанавливается с интерфейсом на английском. Для смены языка, кликаем по иконке в правом верхнем углу и выбираем Settings:

В меню слева нажимаем по Preferences:

В подразделе Localization выбираем нужный нам язык и первый день недели:

Сохранияем настройки и перезапускаем страницу для применения нового языка.

Создание репозитория и подключение к нему

Попробуем создать проект и подключиться к нему из Linux. Также для теста мы создадим файл и закинем его в наш репозиторий.

В веб-интерфейсе GitLab создаем новый проект:

Задаем имя проекта, оставляем или редактируем URL, выбираем уровень доступа. После кликаем по кнопке Создать проект:

* в данном примере мы создаем проект с названием Test, url до него будет http://gitlab.dmosk.ru/root/test. Уровень доступа мы задаем «Приватный» — доступ к репозиторию будет только у авторизованного пользователя.

Для примера попробуем подключиться с компьютера Linux к нашему репозиторию и закинуть на него тестовый файл.

Для начала установим git на компьютер с Linux:

а) Если используем CentOS / Red Hat:

yum install git-core

б) Если используем Ubuntu / Debian:

Источник

Install self-managed GitLab

You can download, install and maintain your own GitLab instance.

Want us to host your instance, no installation required? Try GitLab SaaS today

Want to try GitLab Ultimate for 30 days? Get your free trial

Recommended Installation Method

Official Linux package

This is the recommended method for getting started. The Linux packages are mature, scalable, and are used today on GitLab.com. If you need additional flexibility and resilience, we recommend deploying GitLab as described in the reference architecture documentation.

Читайте также:  Формат shs чем открыть windows

Linux installation is quicker to install, easier to upgrade and contains features to enhance reliability not found in other methods. Install via a single package (also known as Omnibus) that bundles all the different services and tools required to run GitLab. At least 4 GB of RAM is recommended.

Ubuntu

18.04 LTS, 20.04 LTS

For Ubuntu 20.04, arm64 packages are also available.

1. Install and configure the necessary dependencies

Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.

During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package

Add the GitLab package repository.

Next, install the GitLab package. Make sure you have correctly set up your DNS, and change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

For https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http:// (without s ).

If you would like to specify a custom password for the initial administrator user ( root ), check the documentation. If a password is not specified, a random password will be automatically generated.

3. Browse to the hostname and login

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password . Use this password with username root to login.

4. Set up your communication preferences

Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.

Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.

Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.

After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.

For Ubuntu 20.04, arm64 packages are also available.

1. Install and configure the necessary dependencies

Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.

During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package

Add the GitLab package repository.

Next, install the GitLab package. Make sure you have correctly set up your DNS, and change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

For https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http:// (without s ).

If you would like to specify a custom password for the initial administrator user ( root ), check the documentation. If a password is not specified, a random password will be automatically generated.

3. Browse to the hostname and login

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password . Use this password with username root to login.

4. Set up your communication preferences

Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.

Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.

Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.

After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.

Debian

For Debian 10, arm64 packages are also available.

1. Install and configure the necessary dependencies

Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.

During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package

Add the GitLab package repository.

Next, install the GitLab package. Make sure you have correctly set up your DNS, and change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

For https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http:// (without s ).

If you would like to specify a custom password for the initial administrator user ( root ), check the documentation. If a password is not specified, a random password will be automatically generated.

3. Browse to the hostname and login

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password . Use this password with username root to login.

4. Set up your communication preferences

Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.

Читайте также:  Не сохраняется размер окна windows 10

Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.

Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.

After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.

For Debian 10, arm64 packages are also available.

1. Install and configure the necessary dependencies

Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.

During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package

Add the GitLab package repository.

Next, install the GitLab package. Make sure you have correctly set up your DNS, and change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

For https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http:// (without s ).

If you would like to specify a custom password for the initial administrator user ( root ), check the documentation. If a password is not specified, a random password will be automatically generated.

3. Browse to the hostname and login

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password . Use this password with username root to login.

4. Set up your communication preferences

Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.

Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.

Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.

After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.

CentOS 8

and RHEL, Oracle, Scientific

For CentOS and RedHat 8, arm64 packages are also available.

1. Install and configure the necessary dependencies

On CentOS 8, the commands below will also open HTTP, HTTPS and SSH access in the system firewall. This is an optional step, and you can skip it if you intend to access GitLab only from your local network.

Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.

During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package

Add the GitLab package repository.

Next, install the GitLab package. Make sure you have correctly set up your DNS, and change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

For https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http:// (without s ).

If you would like to specify a custom password for the initial administrator user ( root ), check the documentation. If a password is not specified, a random password will be automatically generated.

3. Browse to the hostname and login

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password . Use this password with username root to login.

4. Set up your communication preferences

Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.

Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.

Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.

After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.

For CentOS and RedHat 8, arm64 packages are also available.

1. Install and configure the necessary dependencies

On CentOS 8 (and RedHat 8), the commands below will also open HTTP, HTTPS and SSH access in the system firewall. This is an optional step, and you can skip it if you intend to access GitLab only from your local network.

Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.

During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package

Add the GitLab package repository.

Next, install the GitLab package. Make sure you have correctly set up your DNS, and change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

Читайте также:  Установка windows с usb ssd

For https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http:// (without s ).

If you would like to specify a custom password for the initial administrator user ( root ), check the documentation. If a password is not specified, a random password will be automatically generated.

3. Browse to the hostname and login

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password . Use this password with username root to login.

4. Set up your communication preferences

Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.

Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.

Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.

After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.

CentOS 7

and RHEL, Oracle, Scientific

1. Install and configure the necessary dependencies

On CentOS 7, the commands below will also open HTTP, HTTPS and SSH access in the system firewall. This is an optional step, and you can skip it if you intend to access GitLab only from your local network.

Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.

During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package

Add the GitLab package repository.

Next, install the GitLab package. Make sure you have correctly set up your DNS, and change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

For https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http:// (without s ).

If you would like to specify a custom password for the initial administrator user ( root ), check the documentation. If a password is not specified, a random password will be automatically generated.

3. Browse to the hostname and login

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password . Use this password with username root to login.

4. Set up your communication preferences

Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.

Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.

Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.

After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.

1. Install and configure the necessary dependencies

On CentOS 7 (and RedHat/Oracle/Scientific Linux 7), the commands below will also open HTTP, HTTPS and SSH access in the system firewall. This is an optional step, and you can skip it if you intend to access GitLab only from your local network.

Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.

During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.

2. Add the GitLab package repository and install the package

Add the GitLab package repository.

Next, install the GitLab package. Make sure you have correctly set up your DNS, and change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

For https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http:// (without s ).

If you would like to specify a custom password for the initial administrator user ( root ), check the documentation. If a password is not specified, a random password will be automatically generated.

3. Browse to the hostname and login

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password . Use this password with username root to login.

4. Set up your communication preferences

Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.

Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.

Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.

After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.

Источник

Оцените статью