搭建gitlab

環境Ubuntu 12.04


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 orconfigure a custom SMTP server. If you wish to use Exim, please 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 apt-get install curl openssh-server ca-certificates postfix



2. 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-ce

If you are not comfortable installing the repository through a piped script, you can find the entire script here.



3. Configure and start GitLab

sudo gitlab-ctl reconfigure


4. Browse to the hostname and login

Username: root 
Password: 5iveL!fe

到此可以使用root賬戶登錄,新建項目。



下面配置一下郵件:

 vim /etc/gitlab/gitlab.rb 
 
 gitlab_rails['gitlab_email_from'] = '[email protected]'
 gitlab_rails['smtp_enable'] = true
 gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
 gitlab_rails['smtp_port'] = 456
 gitlab_rails['smtp_user_name'] = "[email protected]"
 gitlab_rails['smtp_password'] = "password"
 gitlab_rails['smtp_domain'] = "smtp.qq.com"
 gitlab_rails['smtp_authentication'] = "login"
 gitlab_rails['smtp_enable_starttls_auto'] = true


配置完郵件以後就可以註冊用戶了。


如果想要把之前使用的gitolite的項目導入到gitlab使用以下方式(注意:之前的倉庫是沒有.git後綴的,但是gitlab是有.git後綴的,我們要手動把倉庫名字改成帶.git的格式)

cp /tmp/repositories/* /var/opt/gitlab/git-data/repositories/root/*
cd /var/opt/gitlab/git-data/repositories/root/
mv example example.git
chown -R git:git /var/opt/gitlab/git-data/repositories/root/*

#執行以下命令導入
gitlab-rake gitlab:import:repos

出現如下圖說明導入完成,登錄gitlab去查看吧。

Processing root/client.git

 * Created goose_client (root/client.git)

Done!



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章