基本介紹
GitLab是一個自托管的Git項目倉庫,可以自己搭建個人代碼管理的倉庫,功能與github類似。
安裝
操作系統:CentOS6.5
gitlab官網下載安裝地址:https://about.gitlab.com/downloads/#centos6
1.安裝依賴的包
yum install curl openssh-server openssh-clients postfix cronie
service postfix start
chkconfig postfix on
lokkit -s http -s ssh
2.使用gitlab官網的腳本安裝
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash yum install gitlab-ce
或者使用gitlab的rpm安裝gitlab
curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/6/gitlab-ce-XXX.rpm/download rpm -i gitlab-ce-XXX.rpm
如果一切順利,gitlab將安裝完成!
3.這里我先修改下配置文件(將訪問地址改為主機的ip地址),默認為主機名訪問(http://hostname 默認的訪問地址)
修改結果如下:
[root@locahost~]# grep -n "^[a-Z]" /etc/gitlab/gitlab.rb11:external_url 'http://10.10.100.38'
4.配置并啟動gitlab
gitlab-ctl reconfigure
5.安裝完畢后,使用Web登錄
打開瀏覽器輸入http://10.10.100.38 ? #10.10.100.38為我的gitlab主機ip地址.
第一次登錄要求設置root密碼
登錄成功之后,是這樣的
?至此,gitlab的安裝訪問正常...
安裝完gitlab后的運維操作:
初次配置服務
sudo gitlab-ctl reconfigure
啟動服務
sudo gitlab-ctl start
停止服務
sudo gitlab-ctl stop
重啟服務
sudo gitlab-ctl restart
檢查服務狀態
sudo gitlab-ctl status
一般服務狀態顯示信息
顯示格式:
狀態 : 進程名稱:(進程ID)運行時間(秒);進程的日志服務進程和運行時間
[root@localhost~]# gitlab-ctl status
run: gitlab-workhorse: (pid 14584) 3325s; down: log: 0s, normally up, want up
run: logrotate: (pid 14593) 3324s; run: log: (pid 31243) 612s
run: nginx: (pid 14602) 3323s; down: log: 0s, normally up, want up
run: postgresql: (pid 11749) 3741s, want down; down: log: 3721s, normally up, want up
run: redis: (pid 14613) 3322s; down: log: 0s, normally up, want up
run: sidekiq: (pid 8677) 4118s, got TERM; down: log: 0s, normally up, want up
run: unicorn: (pid 14619) 3322s; run: log: (pid 7844) 4153s
狀態 | 說明 |
run | 運行狀態 |
down | 服務停止 |
?
?
檢查服務的日志信息
# 檢查redis的日志
sudo gitlab-ctl tail redis# 檢查postgresql的日志
sudo gitlab-ctl tail postgresql# 檢查gitlab-workhorse的日志
sudo gitlab-ctl tail gitlab-workhorse# 檢查logrotate的日志
sudo gitlab-ctl tail logrotate# 檢查nginx的日志
sudo gitlab-ctl tail nginx# 檢查sidekiq的日志
sudo gitlab-ctl tail sidekiq# 檢查unicorn的日志
sudo gitlab-ctl tail unicorn
gitlab管理員密碼忘記,怎么重置密碼
Gitlab 修改root用戶密碼
使用rails工具打開終端
sudo gitlab-rails console production
查詢用戶的email,用戶名,密碼等信息,id:1 表示root賬號
user = User.where(id: 1).first
重新設置密碼
user.password = '新密碼'
user.password_confirmation = '新密碼'
保存密碼
user.save!
完整的操作ruby腳本
user = User.where(id: 1).first
user.password = '新密碼'
user.password_confirmation = '新密碼'
user.save!
然后使用重置過的密碼重新登錄。
Git 圖形界面操作工具
- SourceTree?https://www.sourcetreeapp.com/
- TortoiseGit?https://code.google.com/p/tortoisegit/wiki/Download?tm=2
?
?
參考文檔:
http://www.cnblogs.com/stevendes/p/6218928.html
http://www.cnblogs.com/yangliheng/p/5760185.html
https://about.gitlab.com/downloads/#centos6
http://www.tuicool.com/articles/mEbAZbE