gitlab的搭建與使用(一)


yum install curl policycoreutils openssh-server openssh-clients postfix -y

systemctl enable sshd
systemctl start sshd
systemctl enable postfix
[root@xuegod63 ~]#systemctl start postfix
[root@xuegod63 ~]# iptables -F #清空規則
[root@xuegod63 ~]# systemctl stop firewalld
[root@xuegod63 ~]# systemctl disable firewalld

[root@xuegod63 ~]#firewall-cmd --permanent --add-service=http
[root@xuegod63 ~]#systemctl reload firewalld

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm

rpm -ivh gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm

vim /etc/gitlab/gitlab.rb

改:13 external_url 'http://gitlab.example.com'
為:13 external_url 'http://192.168.100.106'


gitlab-ctl reconfigure #開始配置

gitlab-ctl status #查看狀態

netstat -antup | grep :80

注:如果后期 web 界面訪問時,總報 502,要把防火牆清空規則,

另外內存要大於 4G,然后內存不足,報 404(也不一定,我本次測試是3g內存,可以啟動程序)

free -m

http://192.168.100.106/users/sign_in

wang1990... #設置密碼 賬號為root 太簡單會報錯

http://192.168.100.106/ 登陸地址
root
wang1990...


14.2.4 管理 gitlab
關閉 gitlab: # gitlab-ctl stop
啟勱 gitlab: # gitlab-ctl start
重啟 gitlab: # gitlab-ctl restart

gitlab 主配置文件:/etc/gitlab/gitlab.rb

日志:/var/log/gitlab/
服務地址:/var/opt/gitlab/
倉庫地址:/var/opt/gitlab/git-data
重置服務:gitlab-ctl reconfigure


漢化
[root@localhost ~]# yum install git -y


git clone https://gitlab.com/xhang/gitlab.git #漢化

gitlab-ctl stop

cd /root/gitlab

git diff v10.2.3 v10.2.3-zh > ../10.2.3-zh.diff
yum -y install patch
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /root/10.2.3-zh.diff


gitlab-ctl restart

等 1 分鍾,再去訪問 web 頁面。訪問太快會顯示 502 錯誤

一、新建項目
二、創建用戶
三、重置用戶密碼(首次登錄時,用你設置的用戶,它會強制讓你更改密碼)
zsl3
guochao88!
四、初除用戶

客戶端下載git克隆文件(web頁面,可以編輯項目與代碼,但是,上傳與下載 還是需要客戶端用戶,安裝git)
# yum install git -y
# git clone zsl3@192.168.100.106:zsl/zsl-web.git #下載地址,可以從這

git clone http://192.168.100.106/zsl/zsl-web.git


Username for 'http://192.168.100.106': zsl3 #輸入 gitlab 的帳號
Password for 'http://zsl3@192.168.100.106': guochao88! #輸入密碼

ls zsl-web/ -a

 

 

 后台重置root密碼

[root@MyCloudServer ~]# gitlab-rails console production
Loading production environment (Rails 4.2.8)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0> user.password="12345678"
=> "12345678"
irb(main):003:0> user.password_confirmation="12345678"
=> "12345678"
irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: f3a3949c-5eeb-4d87-a1f5-8221ae6caeaa) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):005:0> quit

 

 克隆報錯處理 如果還是不行多半是輸入錯誤

$ git clone http://172.87.221.196/root/zsl.git
Cloning into 'zsl'...
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://172.87.221.196/root/zsl.git/'

zsl@DESKTOP-2L25L8R MINGW64 /e/gi
$ git config --system --unset credential.helper #重置連接

$ git clone http://172.87.221.196/root/zsl.git #重新克隆

記住密碼和默認分支

[branch "master"] remote = origin merge = refs/heads/master [credential] helper = store


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM