前言
Git作為後起之秀,在版本控制領域占據了頭把交椅。Github作為托管式的代碼倉庫,從代碼安全性和網絡傳輸等各個方面考慮,對于個人和公司來講,具有一定的局限性。Gitlab提供的不同版本的安裝包,可以實作私有的Git伺服器搭建。
版本
Gitlab提供了Community Edition、Enterprise Edition Starter、Enterprise Edition Premium等不同版本的安裝包。由于免費的關系,我們使用Community Edition版本進行學習。該版本有bitnami和GitLab CE Omnibus package兩種安裝包。
Gitlab官網下載下傳位址:
https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-8.15.3-ce.0.el7.x86_64.rpm
bitnami下載下傳位址:
https://bitnami.com/stack/gitlab/installer
由于天朝的原因,從gitlab.com中下載下傳rpm檔案比較慢。
附上清華鏡像位址:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/
環境
CentOS7.2(VMware10)(CentOS-7-x86_64-DVD-1611.iso)
Gitlab8.15(gitlab-ce-8.15.3-ce.0.el7.x86_64.rpm)
Git2.11(git-2.11.0.tar.gz)
官方教程
-
Install and configure the necessary dependencies
If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server and configure it as an SMTP server.
On Centos 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.
sudo yum install curl policycoreutils openssh-server openssh-clients sudo systemctl enable sshd sudo systemctl start sshd sudo yum install postfix sudo systemctl enable postfix sudo systemctl start postfix sudo firewall-cmd --permanent --add-service=http sudo systemctl reload firewalld
- Add the GitLab package server and install the package
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 usingcurl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash sudo yum install gitlab-ce
curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-XXX.rpm/download rpm -i gitlab-ce-XXX.rpm
- Configure and start GitLab
sudo gitlab-ctl reconfigure
如果以上提示缺少semanage子產品
請運作下面的指令安裝selinux
sudo yum install libsemanage-static libsemanage-devel
遺留問題
1. 漢化問題
對于管理者來說,使用英文界面略有困難。
2. 郵件配置問題
注冊、找回密碼、送出代碼等各種需要發郵件的情況下,不能發送郵件。
3.使用SSH公私鑰進行認證時,config檔案配置問題
使用ssh-keygen -t rsa -C "[email protected]"生成公私鑰,并将私鑰儲存在~/.ssh目錄,同時在gitlab管理頁面将自己的公鑰添加進去。
SSH keys允許自己的機器和gitlab伺服器之間建立安全連接配接。
配置config檔案,内容如下:
host gitlab_name
user git
hostname gitlab_server_host
port 22
identityfile ~/.ssh/name
在Eclipse中使用git進行clone項目時,可以使用以下位址:
// 協定預設為http,需要使用使用者名、密碼進行身份認證
http://192.168.111.129/root/demo.git
// 協定預設為空,使用公私鑰進行身份認證。可修改協定為SSH,修改協定後,連接配接位址自動變為:ssh://[email protected]/root/demo.git
[email protected]:root/demo.git
可通過config檔案指定多個gitlab伺服器位址及其對應的公私鑰,進行身份認證。
// 協定預設為空,使用公私鑰進行身份認證。可修改協定為SSH,修改協定後,連接配接位址自動變為:ssh://gitlab_vm/root/demo.git
gitlab_vm:root/demo.git
作者:
Candyメ奶糖出處:
http://www.cnblogs.com/Candies/本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接配接,否則保留追究法律責任的權利。
博文來源廣泛,如原作者認為我侵犯知識産權,請盡快給我發郵件
[email protected]聯系,我将以第一時間删除相關内容。