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

相关文章
相关标签/搜索