GitLab:安装

  • 2017-12-01
  • 29
  • 0
  • 0

前置条件


系统

支持的Unix发行版

  • Ubuntu
  • Debian
  • CentOS
  • openSUSE
  • Red Hat Enterprise Linux (please use the CentOS packages and instructions)
  • Scientific Linux (please use the CentOS packages and instructions)
  • Oracle Linux (please use the CentOS packages and instructions)

For the installations options please see the installation page on the GitLab website.

不支持的Unix发行版

  • Arch Linux
  • Fedora
  • FreeBSD
  • Gentoo
  • macOS

On the above unsupported distributions is still possible to install GitLab yourself. Please see the installation from source guide and the installation guides for more information.

非Unix系统,如windows

GitLab是为Unix操作系统开发的。GitLab不会在windows上运行,而且我们在不久的将来也没有支持它的计划。请考虑使用虚拟机运行GitLab。

Ruby versions 

GitLab requires Ruby (MRI) 2.3. Support for Ruby versions below 2.3 (2.1, 2.2) will stop with GitLab 8.13.

You will have to use the standard MRI implementation of Ruby. We love JRuby and Rubinius but GitLab needs several Gems that have native extensions.

硬件

存储

所需的硬盘空间很大程度上取决于您想存储在GitLab中的大小。但是作为一个经验法则,您应该至少拥有尽可能多的空闲空间,因为您的repos组合都会占用。如果您想要灵活地开发您的硬盘空间,未来考虑安装它使用lvm,这样您可以添加更多硬盘驱动器当您需要它们。除了本地硬盘驱动器之外,您还可以挂载支持网络文件系统(Nfs)协议的卷。该卷可能位于文件服务器、网络附加存储(NAS)设备、存储区网络(SAN)或在amazon web services(AWS)弹性块存储(EBS)卷上。如果您有足够的ram内存和最近的CPU,那么速度主要受限于硬盘的搜索时间。有一个机械硬盘(7200 rpm以上)或固态硬盘(Ssd)将提高中的的响应能力。

CPU 

  • 1 core supports up to 100 users but the application can be a bit slower due to having all workers and background jobs running on the same core
  • 2 cores is the recommended number of cores and supports up to 500 users
  • 4 cores supports up to 2,000 users
  • 8 cores supports up to 5,000 users
  • 16 cores supports up to 10,000 users
  • 32 cores supports up to 20,000 users
  • 64 cores supports up to 40,000 users
  • More users? Run it on multiple application servers

内存

You need at least 4GB of addressable memory (RAM + swap) to install and use GitLab! The operating system and any other running applications will also be using memory so keep in mind that you need at least 4GB available before running GitLab. With less memory GitLab will give strange errors during the reconfigure run and 500 errors during usage.

  • 1GB RAM + 3GB of swap is the absolute minimum but we strongly advise against this amount of memory. See the unicorn worker section below for more advice.
  • 2GB RAM + 2GB swap supports up to 100 users but it will be very slow
  • 4GB RAM is the recommended memory size for all installations and supports up to 100 users
  • 8GB RAM supports up to 1,000 users
  • 16GB RAM supports up to 2,000 users
  • 32GB RAM supports up to 4,000 users
  • 64GB RAM supports up to 8,000 users
  • 128GB RAM supports up to 16,000 users
  • 256GB RAM supports up to 32,000 users
  • More users? Run it on multiple application servers

We recommend having at least 2GB of swap on your server, even if you currently have enough available RAM. Having swap will help reduce the chance of errors occurring if your available memory changes. We also recommend configuring the kernel’s swappiness setting to a low value like 10 to make the most of your RAM while still having the swap available when needed.

Notice: The 25 workers of Sidekiq will show up as separate processes in your process overview (such as top or htop) but they share the same RAM allocation since Sidekiq is a multithreaded application. Please see the section below about Unicorn workers for information about how many you need of those.

数据库

The server running the database should have at least 5-10 GB of storage available, though the exact requirements depend on the size of the GitLab installation (e.g. the number of users, projects, etc).

We currently support the following databases:

  • PostgreSQL (highly recommended)
  • MySQL/MariaDB (strongly discouraged, not all GitLab features are supported, no support for MySQL/MariaDB GTID)

We highly recommend the use of PostgreSQL instead of MySQL/MariaDB as not all features of GitLab work with MySQL/MariaDB:

  1. MySQL support for subgroups was dropped with GitLab 9.3. See issue #30472 for more information.
  2. Geo does not support MySQL.
  3. Zero downtime migrations do not work with MySQL
  4. Database load balancing is supported only for PostgreSQL.
  5. GitLab optimizes the loading of dashboard events using PostgreSQL LATERAL JOINs.
  6. In general, SQL optimized for PostgreSQL may run much slower in MySQL due to differences in query planners. For example, subqueries that work well in PostgreSQL may not be performant in MySQL
  7. We expect this list to grow over time.

Existing users using GitLab with MySQL/MariaDB are advised to migrate to PostgreSQL instead.

PostgreSQL Requirements 

As of GitLab 10.0, PostgreSQL 9.6 or newer is required, and earlier versions are not supported. We highly recommend users to use PostgreSQL 9.6 as this is the PostgreSQL version used for development and testing.

Users using PostgreSQL must ensure the pg_trgm extension is loaded into every GitLab database. This extension can be enabled (using a PostgreSQL super user) by running the following query for every database:

CREATE EXTENSION pg_trgm;

On some systems you may need to install an additional package (e.g. postgresql-contrib) for this extension to become available.

Additional requirements for GitLab Geo

If you are using GitLab Geo, the tracking database also requires the postgres_fdw extension.

CREATE EXTENSION postgres_fdw;

Unicorn Workers 

It’s possible to increase the amount of unicorn workers and this will usually help to reduce the response time of the applications and increase the ability to handle parallel requests.

For most instances we recommend using: CPU cores + 1 = unicorn workers. So for a machine with 2 cores, 3 unicorn workers is ideal.

For all machines that have 2GB and up we recommend a minimum of three unicorn workers. If you have a 1GB machine we recommend to configure only two Unicorn workers to prevent excessive swapping.

To change the Unicorn workers when you have the Omnibus package (which defaults to the recommendation above) please see the Unicorn settings in the Omnibus GitLab documentation.

Redis and Sidekiq 

Redis stores all user sessions and the background task queue. The storage requirements for Redis are minimal, about 25kB per user. Sidekiq processes the background jobs with a multithreaded process. This process starts with the entire Rails stack (200MB+) but it can grow over time due to memory leaks. On a very active server (10,000 active users) the Sidekiq process can use 1GB+ of memory.

Prometheus and its exporters 

As of Omnibus GitLab 9.0, Prometheus and its related exporters are enabled by default, to enable easy and in depth monitoring of GitLab. Approximately 200MB of memory will be consumed by these processes, with default settings.

If you would like to disable Prometheus and it’s exporters or read more information about it, check the Prometheus documentation.

GitLab Runner 

We strongly advise against installing GitLab Runner on the same machine you plan to install GitLab on. Depending on how you decide to configure GitLab Runner and what tools you use to exercise your application in the CI environment, GitLab Runner can consume significant amount of available memory.

Memory consumption calculations, that are available above, will not be valid if you decide to run GitLab Runner and the GitLab Rails application on the same machine.

It is also not safe to install everything on a single machine, because of the security reasons – especially when you plan to use shell executor with GitLab Runner.

We recommend using a separate machine for each GitLab Runner, if you plan to use the CI features.

支持的浏览器 

We support the current and the previous major release of Firefox, Chrome/Chromium, Safari and Microsoft browsers (Microsoft Edge and Internet Explorer 11).

Each time a new browser version is released, we begin supporting that version and stop supporting the third most recent version.

Note: We do not support running GitLab with JavaScript disabled in the browser and have no plans of supporting that in the future because we have features such as Issue Boards which require JavaScript extensively.

 

安装


CentOS7上安装

1. 安装和配置依赖项

On CentOS 7 (and RedHat/Oracle/Scientific Linux 7), the commands below will also open HTTP and SSH access in the system firewall.

sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

接下来,安装Postfix发送通知电子邮件。如果您想使用另一个解决方案发送电子邮件,请跳过此步骤并在安装完电子邮件后配置外部SMTP服务器。

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

注意:在Postfix安装期间,可能出现配置选项。选择“internet站点”并按enter键。使用服务器的外部dns为“邮件名称”并按enter键。如果出现额外的选项,请继续按enter以接受默认值。

 

2.添加GitLab仓库

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

接下来安装GitLab。
Change `http://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. HTTPS requires additional configuration after installation.

sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee

3.登录

在第一次访问时,您将被重定向到密码重设页面。修改管理员的初始密码后,将返回登录界面。

See our documentation for detailed instructions on installing and configuration.

 

4.设置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.

评论

还没有任何评论,你来说两句吧