Gitlab服务器搭建
先把环境说一下吧,win10是主机,通过vmware安装ubuntu14.04 64位操作系统,服务器就搭在ubuntu中
1、终端运行sudo apt-get install curl openssh-server ca-certificates postfix安装postfix
2、本来是可以通过命令行安装的,但是网速太慢,你懂得,所以干脆把安装包下下来安装好了。到清华的镜像去下载http://mirror.tuna.tsinghua.edu.cn/gitlab-ce/,进去可以看到一个目录,/gitlab-ce/ubuntu/pool/trusty/main/g/gitlab-ce/,下载最新版就好了,下载之后通过命令dpkg -i gitlab-ce-xxx.deb安装就好了,安装完成之后有如下提示
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
3、gitlab的注册是需要邮箱验证的,所以还需要配置一下smtp才可能让别人来注册,编辑文件/var/opt/gitlab/gitlab-rails/etc/gitlab.yml,修改如下几个字段就好了
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"
4、终端中运行sudo gitlab-ctl reconfigure,运行结束之后,就可以通过http://xxxxx访问到gitlab的主页了,注册一下看下邮箱验证功能是否有效,理论上是没有问题的。但是有个问题是验证邮箱里面的url居然是http://xxxxx的,这个是ubuntu本地的域名,如果是在windows下我们是没办法打开激活界面的,所以还是需要在配置一下ip地址和端口号
5、配置端口号,默认的端口号是80,所以要修改下端口号,首先终端运行ifconfig,我们可以看到ip是192.168.x.x,虚拟机的ip地址是固定的。
/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
6、好了,现在通过虚拟机和主机输入http://192.168.x.x:xxxx/都可以访问到github了,再注册一下,可以正常激活了
2016.01.14
------End------
posted on 2016-01-14 15:47 openflight123 阅读(463) 评论(0) 编辑 收藏 举报