GitLab 中文文档

安装GitLab的需求

操作系统

受支持的Unix衍生版

安装配置请参与 GitLab中文网的安装介绍页面.

不受支持的Unix衍生版

上面这些不受支持的Unix衍生版也可以自己手动编译安装GitLab。 请查阅源码安装手册GitLab安装手册

非Unix操作系统(Windows)

GitLab是专为Unix操作系统开发的。 GitLab 不可 运行在Windows操作系统上,而且我们近期也没有考虑支持Windows。 你可以在Linux虚拟机上或者Docker上来安装GitLab。

Ruby版本

GitLab 需要Ruby (MRI) 2.3,自GitLab 8.13开始不再支持 2.3以下版本。

我们建议使用标准的MRI解释器来运行Ruby。 虽然大部分Ruby开发者喜欢JRubyRubinius。 但是GitLab需要原生的Gems。

硬件需求

存储

存储空间的大小主要取决于你将存储的Git仓库的大小。但根据 rule of thumb(经验法则) 你应该考虑多留一些空间用来存储Git仓库的备份。

如果你想使用弹性的存储空间,你可以考虑在分配分区的时候使用LVM架构,这样可以在后期需要的清空下添加硬盘在增加存储空间。

除此之外你还可以挂在一个支持NFS的分卷,比如NAS、 SAN、AWS、EBS。

如果你的服务器有足够大的内存和CPU处理性能,GitLab的响应速度主要受限于硬盘的寻道时间。 使用更快的硬盘(7200转)或者SSD硬盘会很大程度的提升GitLab的响应速度。

CPU

Memory

安装使用GitLab需要至少4GB可用内存(RAM + Swap)! 由于操作系统和其他正在运行的应用也会使用内存, 所以安装GitLab前一定要注意当前服务器至少有4GB的可用内存. 少于4GB内存会导致在reconfigure的时候出现各种诡异的问题, 而且在使用过程中也经常会出现500错误.

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.

Database

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:

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. GitLab Geo does not support MySQL.
  3. Zero downtime migrations do not work with MySQL
  4. GitLab optimizes the loading of dashboard events using PostgreSQL LATERAL JOINs.
  5. 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
  6. We expect this list to grow over time.

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

As of GitLab 10.0, PostgreSQL 9.6 or newer (but less than 10) 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;

某些系统启用此扩展可能需要安装PostgreSQL的依赖 (比如postgresql-contrib) 。

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存储每个客户端的sessions和后台任务队列。 Redis需求的存储空间很小, 大约每个用户25kB。 Sidekiq使用多线程处理后台任务。 这个进程启动的时候会使用整个Rails堆栈(200MB+),但是它会在内存泄漏的情况下增加。 一个用户非常活跃的服务器上(10,000个活跃用户)Sidekiq进程会占用1GB+的内存。

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.

Supported web browsers

GitLab前端页面支持Firefox,Safari,Chome等最新稳定版及历史稳定版,同时也支持Microsoft Edge和Microsoft IE11。

当浏览器有新版本发布后,GitLab将只会支持最新版及之前3个历史版本的支持。