這幾天折騰搭建git服務器,選擇了比較流行的gitlab,一開始就直奔一鍵安裝腳本去了,連gitlab主頁都沒去看看。用的gitlab-installer,centos6.5,各類錯誤,各類依賴關係,還有各類沒法鏈接,兩天了都沒成功。無奈手動配置,沒有接觸過ruby on rails,照着網上的文檔抄,忍受着龜速的epel源,花了幾個小時,終於配置成功。把一個項目託管上去,終於鬆口氣,想着下班回去在配一遍,總結下過程。然而,下班回來一搜gitlab,隨手打開gitlab主頁,我決定暫時放棄這個想法。html
由於我發現,居!然!有!官!方!的!rpm!安!裝!包!git
Contents [hide]github
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下載,速度稍好,順便用百度網盤離線下載了一份。centos
配置開放用戶註冊
默認是不容許註冊的,若是須要開放註冊,能夠編輯 /etc/gitlab/gitlab.rb,查找signup_enabled ,值改成true,並取消註釋,以後從新配置gitlab。ruby
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官網的硬件需求。app
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.less
- 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.ssh
把虛擬機內存調到1G,果真好了,頁面打開很流暢。curl
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的虛擬機,打開同樣很流暢,看來手動配置仍是有意義的