[root@git1 ~]# echo "git1 127.0.0.1" >> /etc/hosts
[root@git1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm
[root@git1 ~]# yum -y localinstall gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm #(這個方法是yum本地安裝rpm包,有依賴yum會本身找,不用本身安裝依賴包)
[root@git1 ~]# gitlab-ctl reconfigure
[root@git1 ~]# gitlab-ctl status run: alertmanager: (pid 17423) 113s; run: log: (pid 17430) 112s run: gitaly: (pid 17366) 115s; run: log: (pid 17376) 115s run: gitlab-monitor: (pid 17394) 114s; run: log: (pid 17397) 114s run: gitlab-workhorse: (pid 17352) 116s; run: log: (pid 17357) 115s run: logrotate: (pid 16626) 432s; run: log: (pid 17362) 115s run: nginx: (pid 16578) 438s; run: log: (pid 17361) 115s run: node-exporter: (pid 16782) 414s; run: log: (pid 17379) 115s run: postgres-exporter: (pid 17437) 112s; run: log: (pid 17446) 112s run: postgresql: (pid 16105) 527s; run: log: (pid 17341) 116s run: prometheus: (pid 17405) 113s; run: log: (pid 17413) 113s run: redis: (pid 15958) 538s; run: log: (pid 17342) 116s run: redis-exporter: (pid 16986) 280s; run: log: (pid 17396) 114s run: sidekiq: (pid 16458) 450s; run: log: (pid 17344) 116s run: unicorn: (pid 16391) 456s; run: log: (pid 17343) 116s
[root@git1 ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION 11.2.3
而後登錄gitlabhtml
登錄之後的加密node
[root@git1 ~]# tar xf gitlab-11-2-stable-zh.tar.gz 查看補丁的版本號,須要補丁和gitlab的版本號一致 [root@git1 ~]# ls anaconda-ks.cfg gitlab-11-2-stable-zh.tar.gz Python-3.5.2.tgz apache-maven-3.5.0-bin.tar.gz gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm solo.tar.gz apache-tomcat-8.5.31.tar.gz jdk-8u171-linux-x64.tar.gz wordpress-4.9.4-zh_CN.tar.gz git-2.9.5.tar.gz jenkins-2.138.1-1.1.noarch.rpm gitlab-11-2-stable-zh nexus-3.13.0-01-unix.tar.gz [root@git1 ~]# cat gitlab-11-2-stable-zh/VERSION 11.2.3 備份英文版的 [root@git1 ~]# cp -r /opt/gitlab/embedded/service/gitlab-rails{,.bak} 而後用中文補丁覆蓋剛纔的目錄 [root@git1 ~]# /bin/cp -rf gitlab-11-2-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/ 複製完了重編譯,重啓 [root@git1 ~]# gitlab-ctl reconfigure [root@git1 ~]# gitlab-ctl restart ok: run: alertmanager: (pid 21626) 0s ok: run: gitaly: (pid 21635) 0s ok: run: gitlab-monitor: (pid 21645) 0s ok: run: gitlab-workhorse: (pid 21649) 1s ok: run: logrotate: (pid 21658) 0s ok: run: nginx: (pid 21666) 0s ok: run: node-exporter: (pid 21671) 1s ok: run: postgres-exporter: (pid 21686) 0s ok: run: postgresql: (pid 21702) 0s ok: run: prometheus: (pid 21706) 0s ok: run: redis: (pid 21717) 1s ok: run: redis-exporter: (pid 21724) 0s ok: run: sidekiq: (pid 21814) 0s ok: run: unicorn: (pid 21829) 0s
建立一個項目linux
[root@git1 ~]# vim /etc/gitlab/gitlab.rb
[root@git1 ~]# gitlab-ctl reconfigure
[root@git1 ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 28033) 0s
ok: run: gitaly: (pid 28045) 0s
ok: run: gitlab-monitor: (pid 28061) 0s
ok: run: gitlab-workhorse: (pid 28064) 0s
ok: run: logrotate: (pid 28073) 0s
ok: run: nginx: (pid 28075) 1s
ok: run: node-exporter: (pid 28084) 0s
ok: run: postgres-exporter: (pid 28089) 0s
ok: run: postgresql: (pid 28102) 0s
ok: run: prometheus: (pid 28126) 0s
ok: run: redis: (pid 28134) 1s
ok: run: redis-exporter: (pid 28221) 0s
ok: run: sidekiq: (pid 28364) 0s
ok: run: unicorn: (pid 28391) 0snginx
[root@git mycode]# git remote add test1 http://192.168.200.148:8888/root/test.git
[root@git mycode]# git push test1 master Username for 'http://192.168.200.148:8888': root Password for 'http://root@192.168.200.148:8888': Counting objects: 9, done. Compressing objects: 100% (5/5), done. Writing objects: 100% (9/9), 679 bytes | 0 bytes/s, done. Total 9 (delta 0), reused 0 (delta 0) To http://192.168.200.148:8888/root/test.git * [new branch] master -> master
[root@git mycode]# git push -u test1 v1.0 Username for 'http://192.168.200.148:8888': root Password for 'http://root@192.168.200.148:8888': Total 0 (delta 0), reused 0 (delta 0) To http://192.168.200.148:8888/root/test.git * [new tag] v1.0 -> v1.0
[root@git mycode]# git clone http://192.168.200.148:8888/root/test.git v1.0 Cloning into 'v1.0'... Username for 'http://192.168.200.148:8888': root Password for 'http://root@192.168.200.148:8888': remote: Enumerating objects: 9, done. remote: Counting objects: 100% (9/9), done. remote: Compressing objects: 100% (5/5), done. remote: Total 9 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (9/9), done. Checking connectivity... done.
[root@git mycode]# git branch dev [root@git mycode]# git checkout dev Switched to branch 'dev' [root@git mycode]# git branch * dev master [root@git mycode]# touch dix.txt [root@git mycode]# ls dix.txt exe.txt test.txt v1.0 [root@git mycode]# git add * [root@git mycode]# git commit -m "分支第一次提交" [dev 08afd32] 分支第一次提交 2 files changed, 1 insertion(+) create mode 100644 dix.txt create mode 160000 v1.0 [root@git mycode]# git push -u test1 dev Username for 'http://192.168.200.148:8888': root Password for 'http://root@192.168.200.148:8888': Counting objects: 3, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 351 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: remote: To create a merge request for dev, visit: remote: http://192.168.200.148:8888/root/test/merge_requests/new?merge_request%5Bsource_branch%5D=dev remote: To http://192.168.200.148:8888/root/test.git * [new branch] dev -> dev Branch dev set up to track remote branch dev from test1.
[root@git /]# mkdir -p /test [root@git /]# cd /test/ [root@git test]# git clone -b dev http://192.168.200.148:8888/root/test.git Cloning into 'test'... Username for 'http://192.168.200.148:8888': root Password for 'http://root@192.168.200.148:8888': remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (7/7), done. remote: Total 11 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (11/11), done. Checking connectivity... done. [root@git test]# ls test [root@git test]# cd test/ [root@git test]# ls dix.txt exe.txt test.txt v1.0
生成祕鑰對
[root@git test]# ssh-keygen -t rsa -C '491537692@qq.com' Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:7Niv6b5+dyQFTSeTwv+/AjmtsyIvN+lNFGR+Q+sln2c 491537692@qq.com The key's randomart image is: +---[RSA 2048]----+ | + ++..| | + = ++ | | o O . | | . + B .| | S .oo +E| | + .+....o| | . o ..+o .| | o B+o... .| | +&*++o....| +----[SHA256]-----+
[root@git test]# cd ~/.ssh/ [root@git .ssh]# ls id_rsa id_rsa.pub known_hosts [root@git .ssh]# cat id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDW/BG41541Ao7ZYEc1wWhIq65VbP66FE8W7RJFZ1pL9LtL9/Ey0V4g7YBJo3mExNDgaFrR+5/SPYt6BAvmDjbmiBJ3FOoKz+rgV73RBRG2WdV4TSKWDy5JVe4k09jgbXzZyfZZUSJHvbitEArjqX6X+ZJrRNWmOCFHAOE+iwwUyArYMwFFM+ckvlGxuN4ztbezLXZPlAnLzB2e84U1NVD5lGQoVmZb7FMZRXq661/+Mt9WTAx0MAW5PSUWicWycztaZnF4mkVwLTWxFug5M7DE8wCmt2S/YprQKgoFuCDI3gvK5jTXtLO4okfaNnOjI00ITjdCOaYfjIq4FdyQ7C1l 491537692@qq.com
[root@git .ssh]# cd ~ [root@git ~]# cd /test/ [root@git test]# ls [root@git test]# git clone -b dev git@192.168.200.148:root/test.git Cloning into 'test'... remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (7/7), done. remote: Total 11 (delta 0), reused 0 (delta 0) Receiving objects: 100% (11/11), done. Checking connectivity... done. [root@git test]# ls test [root@git test]# cd test/ [root@git test]# ls dix.txt exe.txt test.txt v1.0
[root@git1 ~]# systemctl start postfix [root@git1 ~]# systemctl enable postfix [root@git1 ~]# systemctl status postfix ● postfix.service - Postfix Mail Transport Agent Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2018-12-16 15:04:16 CST; 2 days ago Main PID: 1266 (master) CGroup: /system.slice/postfix.service ├─ 1266 /usr/libexec/postfix/master -w ├─ 1268 qmgr -l -t unix -u └─27691 pickup -l -t unix -u Dec 18 17:44:07 git1 postfix/pickup[27691]: 8610411BD74C: uid=997 from=<gitlab@192.168.200.148> Dec 18 17:44:07 git1 postfix/cleanup[33642]: 8610411BD74C: message-id=<5c18c1668d06d_6ecc3fa4cd9a16ac4807...ail> Dec 18 17:44:07 git1 postfix/qmgr[1268]: 8610411BD74C: from=<gitlab@192.168.200.148>, size=2746, nrcpt=1...tive) Dec 18 17:44:08 git1 postfix/smtp[33644]: connect to example.com[2606:2800:220:1:248:1893:25c8:1946]:25: ...able Dec 18 17:44:29 git1 postfix/smtp[33644]: connect to example.com[93.184.216.34]:25: Connection refused Dec 18 17:44:29 git1 postfix/smtp[33644]: 8610411BD74C: to=<admin@example.com>, relay=none, delay=22, del...sed) Dec 18 17:50:53 git1 postfix/qmgr[1268]: 8610411BD74C: from=<gitlab@192.168.200.148>, size=2746, nrcpt=1...tive) Dec 18 17:50:53 git1 postfix/smtp[34188]: connect to example.com[2606:2800:220:1:248:1893:25c8:1946]:25: ...able Dec 18 17:51:14 git1 postfix/smtp[34188]: connect to example.com[93.184.216.34]:25: Connection refused Dec 18 17:51:14 git1 postfix/smtp[34188]: 8610411BD74C: to=<admin@example.com>, relay=none, delay=427, de...sed) Hint: Some lines were ellipsized, use -l to show in
[root@git1 ~]# cp -r /etc/gitlab/gitlab.rb{,.bak}
[root@git1 ~]# vim /etc/gitlab/gitlab.rb
[root@git1 ~]# gitlab-ctl reconfigure
[root@git1 ~]# gitlab-ctl restart
[root@git1 ~]# gitlab-rails console
-------------------------------------------------------------------------------------
GitLab: 11.2.3 (06cbee3)
GitLab Shell: 8.1.1
postgresql: 9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)git
irb(main):001:0> Notify.test_email('493115250@qq.com','this is title','hello').deliver_now程序員
Notify#test_email: processed outbound mail in 540.8msredis
Sent mail to 493115250@qq.com (3359.6ms)
Date: Tue, 18 Dec 2018 18:34:20 +0800
From: GitLab <493115250@qq.com>
Reply-To: GitLab <noreply@192.168.200.148>
To: 493115250@qq.com
Message-ID: <5c18cd2c44d7a_96593f9fb05daf7c72fe@git1.mail>
Subject: this is title
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: Allsql
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>hello</p></body></html>apache
=> #<Mail::Message:69954716508780, Multipart: false, Headers: <Date: Tue, 18 Dec 2018 18:34:20 +0800>, <From: GitLab <493115250@qq.com>>, <Reply-To: GitLab <noreply@192.168.200.148>>, <To: 493115250@qq.com>, <Message-ID: <5c18cd2c44d7a_96593f9fb05daf7c72fe@git1.mail>>, <Subject: this is title>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):002:0> vim
提別說明Notify.test_email('收件人','標題','內容').deliver_now
gitlab的權限
guest訪客,只能發表評論,不能讀寫
reporter報告者
只能克隆,不能提交代碼,產品測試用的
developer開發人員
能夠進行代碼的讀寫,普通程序員用的
master主程序員
能夠添加項目成員,添加標籤,建立和保護分支產品經理用的
owner全部者
有全部的權限,通常不用