工欲善其事,必先利其器。此文講述的是gitlab的安裝歷程。需要有一定的英文閱讀能力者。
安裝環境:
ubuntu:Ubuntu 17.04
官方推薦需要的硬件條件:
Storage:a fast drive (7200 RPM and up) or a solid state drive (SSD)CPU:2 cores is the recommended number of cores and supports up to 500 users
Memory:4GB RAM is the recommended memory size for all installations and supports up to 100 users
官方推薦ubuntu的安裝也是極其的簡潔明瞭簡潔:
1. Install and configure the necessary dependencies
sudo apt-get install -y curl openssh-server ca-certificates
開放http以及ssh端口供其訪問。
2. Add the GitLab package server and install the package
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
用apt-get的方式安裝gitlab源碼包。
3. Configure and start GitLab
sudo gitlab-ctl reconfigure
配置gitlab的配置,並且啓動gitlab。
至此安裝結束,本文也完結,但是安裝就如此順利嗎?答案當然不是,若是就不會有本篇文章呢!此處有兩個疑惑:
1.apt-get方式安裝不成功,怎麼辦?
2.第三步驟說configure,如何配置?例如我想修改訪問的端口,怎麼做到。
一.apt-get方式安裝不成功,怎麼辦?
OK,言簡意賅,apt-get安裝不成功,ubuntu的機器可以使用手動安裝源碼包的方式,官方文檔英文說明如下:
If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using:
dpkg -i gitlab-ce-XXX.deb
點擊select and download the package manually找到適合自己系統的安裝文件,下載的系統磁盤中,在進行:
dpkg -i gitlab-ce-XXX.deb
安裝即可!
二.第三步驟說configure,如何配置?例如我想修改訪問的端口,怎麼做到。
此處講解配置兩個方面的問題(gitlab比較龐重,涉及方面之多):
2.1配置訪問路徑
點擊Setting up a domain name/URL
,此處有官方文檔詳細的配置說明,小弟在此處也是也此文檔爲說明,在安裝結束之後,在此配置文件中/etc/gitlab/gitlab.rb
修改如下:
external_url "http://gitlab.example.com"
例如本人設置的如下:
external_url 'http://10.200.80.255'
設置完成之後:
重置配置
sudo gitlab-ctl reconfigure
重啓gitlab服務
sudo gitlab-ctl restart
此時,在瀏覽器彙總輸入http://10.800.80.255默認端口是80,就能訪問到gitlab的首頁了,初始化會讓你設置管理員密碼。此時使用:
root+你設置的密碼就能訪問。
2.2配置訪問端口
有的時候默認的80端口被佔用了,需要你更改端口,官網中說道:
Setting the NGINX listen port:
By default NGINX will listen on the port specified in external_url or implicitly use the right port (80 for HTTP, 443 for HTTPS). If you are running GitLab behind a reverse proxy, you may want to override the listen port to something else. For example, to use
port 8081:
nginx['listen_port'] = 8081
同理,在配置文件中
/etc/gitlab/gitlab.rb
修改如下:
nginx['listen_port'] = 8081
在此重置配置文件,重啓gitlab服務器,此時通過external_url:listen_port就能夠訪問到gitlab的首頁那!