这几天折腾搭建git服务器,选择了比较流行的gitlab,一开始就直奔一键安装脚本去了,连gitlab主页都没去看看。用的gitlab-installer,centos6.5,各种错误,各种依赖关系,还有各种无法连接,两天了都没成功。无奈手动配置,没有接触过ruby on rails,照着网上的文档抄,忍受着龟速的epel源,花了几个小时,终于配置成功。把一个项目托管上去,终于松口气,想着下班回去在配一遍,总结下过程。然而,下班回来一搜gitlab,随手打开gitlab主页,我决定暂时放弃这个想法。
因为我发现,居!然!有!官!方!的!rpm!安!装!包!
Contents [hide]
- 1 omnibus方式部署gitlab
- 2 配置开放用户注册
- 3 遇到的问题
- 3.1 内存不足
- 3.2 Memory
- 4 参考资料
omnibus方式部署gitlab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
Download the Omnibus package and install everything
curl -O https://downloads-packages.s3.amazonaws.com/centos-6.6/gitlab-7.6.2_omnibus.5.3.0.ci.1-1.el6.x86_64.rpm
sudo yum install openssh-server
sudo yum install postfix
sudo yum install cronie
sudo service postfix start
sudo chkconfig postfix on
sudo rpm -i gitlab-7.6.2_omnibus.5.3.0.ci.1-1.el6.x86_64.rpm
Configure and start GitLab
sudo gitlab-ctl reconfigure
sudo lokkit -s http -s ssh
Browse to the hostname and login
Username: root
Password: 5iveL!fe
|
步骤很简单,主要就是下载速度太慢,好在有个美国的vps,先下载到vps上,然后从vps下载,速度稍好,顺便用百度网盘离线下载了一份。
配置开放用户注册
默认是不允许注册的,如果需要开放注册,可以编辑 /etc/gitlab/gitlab.rb,查找signup_enabled ,值改为true,并取消注释,之后重新配置gitlab。
1
|
sudo gitlab-ctl reconfigure
|
遇到的问题
内存不足
512M的虚拟机,打开gitlab页面巨卡,简直无法忍受,查看内存使用情况:
1
2
3
4
5
|
[root@localhost ~]# free -m
total used free shared buffers cached
Mem: 482 476 6 0 0 13
-/+ buffers/cache: 462 20
Swap: 1023 260 763
|
查看gitlab官网的硬件需求。
MEMORY
You need at least 2GB of addressable memory (RAM + swap) to install and use GitLab! With less memory GitLab will give strange errors during the reconfigure run and 500 errors during usage.
- 512MB RAM + 1.5GB of swap is the absolute minimum but we strongly advise against this amount of memory. See the unicorn worker section below for more advise.
- 1GB RAM + 1GB swap supports up to 100 users
- 2GB RAM is the recommended memory size and supports up to 500 users
- 4GB RAM supports up to 2,000 users
- 8GB RAM supports up to 5,000 users
- 16GB RAM supports up to 10,000 users
- 32GB RAM supports up to 20,000 users
- 64GB RAM supports up to 40,000 users
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.
把虚拟机内存调到1G,果然好了,页面打开很流畅。
1
2
3
4
5
|
[root@localhost gitlab]# free -m
total used free shared buffers cached
Mem: 988 906 82 0 23 114
-/+ buffers/cache: 768 220
Swap: 1023 0 1023
|
但是之前手动配置的也是512的虚拟机,打开一样很流畅,看来手动配置还是有意义的