Gitlab服務器搭建

先把環境說一下吧,win10是主機,經過vmware安裝ubuntu14.04 64位操做系統,服務器就搭在ubuntu中git

一、終端運行sudo apt-get install curl openssh-server ca-certificates postfix安裝postfixgithub

二、原本是能夠經過命令行安裝的,可是網速太慢,你懂得,因此乾脆把安裝包下下來安裝好了。到清華的鏡像去下載http://mirror.tuna.tsinghua.edu.cn/gitlab-ce/,進去能夠看到一個目錄,/gitlab-ce/ubuntu/pool/trusty/main/g/gitlab-ce/,下載最新版就行了,下載以後經過命令dpkg -i gitlab-ce-xxx.deb安裝就行了,安裝完成以後有以下提示ubuntu

gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://xxxxx
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab: 
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab: 
It looks like GitLab has not been configured yet; skipping the upgrade script.

Username: root 
Password: 5iveL!fe

三、gitlab的註冊是須要郵箱驗證的,因此還須要配置一下smtp纔可能讓別人來註冊,編輯文件/var/opt/gitlab/gitlab-rails/etc/gitlab.yml,修改以下幾個字段就行了windows

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465 
gitlab_rails['smtp_user_name'] = "username@163.com"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = :login
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true

gitlab_rails['gitlab_email_from'] = "username@163.com"

 

 

四、終端中運行sudo gitlab-ctl reconfigure,運行結束以後,就能夠經過http://xxxxx訪問到gitlab的主頁了,註冊一下看下郵箱驗證功能是否有效,理論上是沒有問題的。可是有個問題是驗證郵箱裏面的url竟然是http://xxxxx的,這個是ubuntu本地的域名,若是是在windows下咱們是沒辦法打開激活界面的,因此仍是須要在配置一下ip地址和端口號服務器

五、配置端口號,默認的端口號是80,因此要修改下端口號,首先終端運行ifconfig,咱們能夠看到ip是192.168.x.x,虛擬機的ip地址是固定的。dom

/etc/gitlab/gitlab.rb  中修改   
    external_url 'http://192.168.x.x:xxxx/'
/var/opt/gitlab/gitlab-rails/etc/gitlab.yml中修改  
    host: 192.168.x.x  
    port: xx

六、好了,如今經過虛擬機和主機輸入http://192.168.x.x:xxxx/均可以訪問到github了,再註冊一下,能夠正常激活了ssh

 

2016.01.14

------End------curl

相關文章
相關標籤/搜索