Ubuntu 16.04.1 安装gitlab 8.10.7-ce.0
GitLab 是一个用于仓库管理系统的开源项目。使用Git作为代码管理工具,并在此基础上搭建起来的web服务。
特点:1. Web框架使用Ruby on Rails。 2. 基于MIT代码发布协议。 3. 需要gitolite协同工作。
1.安装和配置依赖包( 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. If you wish to use Exim, please configure it as an SMTP server.
sudo apt-get install curl openssh-server ca-certificates postfix
2. 增加gitlab安装源,并安装 gitlab-ce(Add the GitLab package server and install the package)
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ceCentos快速安装脚本: `curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash` 快速安装脚本:https://packages.gitlab.com/gitlab/gitlab-ce/install 手动下载安装地址:https://packages.gitlab.com/gitlab/gitlab-ce
dpkg -i gitlab-ce-XXX.deb源是加上了,但是下载也太慢了。 [![](http://www.iganlei.cn/wp-content/uploads/2015/11/11.jpg)](http://www.iganlei.cn/wp-content/uploads/2015/11/11.jpg) 改手动下载安装: [![2](http://www.iganlei.cn/wp-content/uploads/2015/11/2.jpg)](http://www.iganlei.cn/wp-content/uploads/2015/11/2.jpg) 还是很慢,尝试换迅雷,速度也不理想,想到离线下载,还是网盘的离线功能给力:[![offline download](http://www.iganlei.cn/wp-content/uploads/2015/11/3.jpg)](http://www.iganlei.cn/wp-content/uploads/2015/11/3.jpg) `dpkg -i gitlab-ce_8.1.2-ce.0_amd64.deb` `root@ganl-virtual-machine:~# dpkg -i gitlab-ce_8.1.2-ce.0_amd64.deb Selecting previously unselected package gitlab-ce. (正在读取数据库 ... 系统当前共安装有 212515 个文件和目录。) 正在解压缩 gitlab-ce (从 gitlab-ce_8.1.2-ce.0_amd64.deb) ... 正在设置 gitlab-ce (8.1.2-ce.0) ... 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://ganl-virtual-machine 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. #### 3\. 配置和使用(Configure and start GitLab)
sudo gitlab-ctl reconfigure`Recipe: gitlab::logrotate * ruby_block[reload logrotate svlogd configuration] action create - execute the ruby block reload logrotate svlogd configuration` Running handlers: Running handlers complete Chef Client finished, 94/216 resources updated in 41.887080499 seconds gitlab Reconfigured! root@ganl-virtual-machine:~# #### 4.访问看下效果( Browse to the hostname and login) Username: root Password: 5iveL!fe [![4](http://www.iganlei.cn/wp-content/uploads/2015/11/4-300x165.jpg)](http://www.iganlei.cn/wp-content/uploads/2015/11/4.jpg) 算是装好了,过程比较简单。 [![5](http://www.iganlei.cn/wp-content/uploads/2015/11/5-300x135.jpg)](http://www.iganlei.cn/wp-content/uploads/2015/11/5.jpg) **邮箱配置:** https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md vi /etc/gitlab/gitlab.rb
gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.exmail.qq.com" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "xxxx@xx.com" gitlab_rails['smtp_password'] = "password" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_ssl'] = true gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = false gitlab_rails['gitlab_email_from'] = 'xxxx@xx.com' gitlab_rails['gitlab_email_reply_to'] = 'xxxx@xx.com'
gitlab_rails[‘gitlab_email_from’] = ‘xxxx@xx.com’
gitlab_rails[‘gitlab_email_reply_to’] = ‘xxxx@xx.com’
需要设置,不然会报错,腾讯邮箱发不出去:
Net::SMTPSyntaxError: 501 mail from address must be same as authorization user
当ip变化或者换成域名,需要修改gitlab地址,也是编辑 /etc/gitlab/gitlab.rb
external_url ‘http://code.xxx.com‘
更换gravatar头像地址,国内:
gitlab_rails[‘gravatar_plain_url’] = ‘http://gravatar.duoshuo.com/avatar/%{hash}?s=%{size}&d=identicon‘
修改完,需要执行gitlab-ctl reconfigure
gitlab-ctl tail 可以看动态日志
网上多数修改gitlab.yml,config.yml应该都是针对gitlab7以前的版本,>=7 :vi /etc/gitlab/gitlab.rb;gitlab-ctl reconfigure