gitlab代碼管理工具的安裝

前言
最近由於項目須要,多人協做,實在不想用svn了,以前也一直在github.com,可是仍是想搭建私有的git。爲何呢,git私有倉庫太貴了,7美圓一個月,還只能增長一位成員。越到後面越貴,因此決定本身來搭建。感謝老闆給了1臺阿里ECS,單獨來作git。我一個小前端,本身搭建gitlab坑仍是蠻多的。


正文
1、配置
先來看下載地址https://bitnami.com/stack/gitlab,爲何選擇bitnami的呢,由於它把一些gitlab須要的組件一塊兒打包了。由於我是裝的GitLab8.9.6,因此對應是下面這些組件。
組件:
- GitLab 8.9.6
- Apache 2.4.23
- ImageMagick 6.7.5
- PostgreSQL 9.5.3
- Git 2.7.4
- Ruby 2.1.9
- Rails 4.2.5.1
- RubyGems 1.8.12

咱們看下對服務器的要求(這裏要求內存2G,大哥們看清楚,一開始想省錢,沒注意,結果死活裝不上去,最後換成2核4G的ECS)
- Intel x86 or compatible processor
- Minimum of 2048 MB RAM
- Minimum of 150 MB hard drive space
- TCP/IP protocol support
- Compatible operantig systems:
- An x86 Linux operating system.


2、安裝
#若是你是ubuntu那種有界面的,就下一步就行了。
#若是是centos這種沒有界面的,進到下載好的根目錄,執行下面的。這是給對應的權限,在運行前必定要執行一下。
chmod 755 bitnami-gitlab-8.9.6-0-linux.run
#我用的 chmod -x bitnami-gitlab-8.9.6-0-linux.run
#而後開始
./bitnami-gitlab-8.9.6-0-linux-x64-installer.run

#一、前面幾個選擇Y,而後及時選擇安裝路徑「Select a folder [/opt/gitlab-8.9.6-0]」,回車就自動裝這個裏面了。
#二、接着填寫建立管理者的郵件地址,管理者的登陸名,管理者2次密碼。
#三、Domain [127.0.0.1]: 選擇對外的域名或則IP,我填的是域名,挺好用的。
#四、而後設置Configure SMTP Settings,對應的發郵件配置,蠻重要的,牽扯到你是管理員第一次須要改密碼,以及其餘用戶找回密碼。我選擇的是騰訊企業郵箱。這裏注意,你填寫郵件的帳號密碼,是用來發郵件的,密碼是明文寫在配置文件裏的,最好悠着點。

#安裝完成後,必定要來手動郵箱配置,這是一個大坑,由於它安裝過程結束,並無修改gitlab.yml這個文件。騰訊企業郵箱配置修改。
vi /opt/gitlab-8.9.6-0/apps/gitlab/htdocs/config/environments/production.rb

config.action_mailer.smtp_settings = {
    :address => "smtp.exmail.qq.com",
    :port => "25",
    :domain => "smtp.qq.com",
    :authentication => :plain,
    :user_name => "你發郵件的帳號",
    :password => "你發郵件的密碼",
    :enable_starttls_auto => true
  }

#反正我是用了25端口,465這個端口我沒成功,有點坑爹。

vi /opt/gitlab-8.9.6-0/apps/gitlab/htdocs/config/gitlab.yml

## Email settings
# Uncomment and set to false if you need to disable email sending from GitLab (default: true)
# email_enabled: true
# Email address used in the "From" field in mails sent by GitLab
email_from: 你發郵件的帳號
email_display_name: GitLab
email_reply_to: noreply@example.com

#這2個文件的「你發郵件的帳號」必定要同樣。很是重要。

3、啓動
#跑到/opt/gitlab-8.9.6-0 目錄下。
./ctlscript.sh (start|stop|restart)

#單獨控制其餘,能夠開啓、中止、重啓。
 ./ctlscript.sh (start|stop|restart) postgres
./ctlscript.sh (start|stop|restart) redis
./ctlscript.sh (start|stop|restart) apache
./ctlscript.sh (start|stop|restart) sidekiq

#start - start the service(s)
#stop - stop the service(s)
#restart - restart or start the service(s)前端


#若是沒什麼問題,你就能夠去你剛纔配置的域名處訪問了(注意:我訪問服務器上的配置的與域名訪問不了,會要求你購買域名,直接經過ip地址訪問便可:http://serverip 因爲默認綁定的是80端口,因此這邊端口號不用寫),注意你的服務器是否關閉防火牆,linux

vi /etc/sysconfig/iptables 打開80防火牆配置git

service iptables restart 重啓防火牆
。我用的是CentOS 7.2,默認安裝firewall做爲防火牆,關閉防火牆命令。和CentOS 6的命令不同喲,也是一個坑。
systemctl stop firewalld.service #中止firewallgithub


4、卸載
/opt/gitlab-8.9.6-0/uninstallredis

相關文章
相關標籤/搜索