network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no addresses: [192.168.1.30/24]
root@ubuntu1804:~# vim /etc/netplan/02-netcfg.yaml network: version: 2 renderer: networkd ethernets: eth1: dhcp4: yes addresses: [192.168.10.107/24] gateway4: 192.168.10.1 nameservers: addresses: [223.6.6.6]
root@ubuntu1804:~# vim /etc/apt/sources.list deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
root@ubuntu1804:~# apt update root@ubuntu1804:~# apt update Get:1 http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB] Get:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB] Get:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB] Get:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB] ……
root@ubuntu1804:~# ls /data/ gitlab-ce_11.11.5-ce.0_amd64.deb
root@ubuntu1804:/data# dpkg -i gitlab-ce_11.11.5-ce.0_amd64.deb root@ubuntu1804:/data# dpkg -i gitlab-ce_11.11.5-ce.0_amd64.deb Selecting previously unselected package gitlab-ce. (Reading database ... 69294 files and directories currently installed.) Preparing to unpack gitlab-ce_11.11.5-ce.0_amd64.deb ... Unpacking gitlab-ce (11.11.5-ce.0) … #等待安裝完成
root@ubuntu1804:/data# vim /etc/gitlab/gitlab.rb external_url 'http://192.168.1.30' #修改指定的ip主機
root@ubuntu1804:/data# gitlab-ctl reconfigure
root@ubuntu1804:~# gitlab-psql gitlabhq_production-# \db List of tablespaces Name | Owner | Location ------------+-------------+---------- pg_default | gitlab-psql | pg_global | gitlab-psql | (2 rows)
root@ubuntu1804:~# gitlab-ctl status run: alertmanager: (pid 4704) 1841s; run: log: (pid 4373) 1867s run: gitaly: (pid 4475) 1844s; run: log: (pid 3483) 2026s run: gitlab-monitor: (pid 4553) 1843s; run: log: (pid 4169) 1887s run: gitlab-workhorse: (pid 4512) 1844s; run: log: (pid 4027) 1910s run: logrotate: (pid 4073) 1900s; run: log: (pid 4089) 1899s run: nginx: (pid 4040) 1906s; run: log: (pid 4060) 1905s run: node-exporter: (pid 4537) 1843s; run: log: (pid 4146) 1892s run: postgres-exporter: (pid 4727) 1840s; run: log: (pid 4409) 1863s run: postgresql: (pid 3659) 2012s; run: log: (pid 3689) 2011s run: prometheus: (pid 4578) 1842s; run: log: (pid 4245) 1875s run: redis: (pid 3417) 2034s; run: log: (pid 3442) 2031s run: redis-exporter: (pid 4561) 1842s; run: log: (pid 4202) 1881s run: sidekiq: (pid 3967) 1920s; run: log: (pid 3983) 1916s run: unicorn: (pid 3908) 1926s; run: log: (pid 3957) 1923s
gitlab-ctl start/stop/restart gitlab
root@ubuntu1804:~# gitlab-ctl tail nginx ==> /var/log/gitlab/nginx/current <== ==> /var/log/gitlab/nginx/access.log <== ==> /var/log/gitlab/nginx/error.log <== ==> /var/log/gitlab/nginx/gitlab_error.log <== ==> /var/log/gitlab/nginx/gitlab_access.log <== 192.168.1.1 - - [21/Jul/2019:10:36:00 +0800] "GET / HTTP/1.1" 302 99 "" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3724.8 Safari/537.36" ……
root@ubuntu1804:/data/src# git clone http://192.168.1.30/root/web-page.git Cloning into 'web-page'... remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done.
root@ubuntu1804:/data/src# ls web-page root@ubuntu1804:/data/src# cat web-page/index.html <h>hello jie!</h1>
root@ubuntu1804:/data/src/web-page# cat index.html <h>hello jie!</h1> <h>hello kobe!</h1> <h>hello curry!</h1> <h>hello rose!</h1>
root@ubuntu1804:/data/src/web-page# git add index.html
root@ubuntu1804:/data/src/web-page# git commit -m 'v6' [master 1202723] v6 1 file changed, 4 insertions(+), 1 deletion(-)
root@ubuntu1804:/data/src/web-page# git push #其中git pull爲獲取代碼到本地 Username for 'http://192.168.1.30': root #要求輸入登陸gitlab的web端的用戶名 Password for 'http://root@192.168.1.30': #再輸入登陸gitlab的web端的用戶密碼 Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 268 bytes | 268.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To http://192.168.1.30/root/web-page.git ecc001d..1202723 master -> master #提交完成
root@ubuntu1804:/data/src/web-page# git reset --hard HEAD HEAD is now at 952e66b v7
root@ubuntu1804:/data/src/web-page# cat index.html <h>hello jie!</h1> <h>hello kobe!</h1> <h>hello curry!</h1> <h>hello rose!</h1> <h>hello jordan!</h1> <h>hello jordan!</h1> <h>hello howard!</h1>
root@ubuntu1804:/data/src/web-page# git reset --hard HEAD^ HEAD is now at 9cb6bf6 v6
root@ubuntu1804:/data/src/web-page# cat index.html <h>hello jie!</h1> <h>hello kobe!</h1> <h>hello curry!</h1> <h>hello rose!</h1> <h>hello jordan!</h1> <h>hello jordan!</h1>
root@ubuntu1804:/data/src/web-page# git reflog 9cb6bf6 (HEAD -> master) HEAD@{0}: reset: moving to HEAD^ 952e66b (origin/master, origin/HEAD) HEAD@{1}: reset: moving to HEAD 952e66b (origin/master, origin/HEAD) HEAD@{2}: commit: v7 9cb6bf6 (HEAD -> master) HEAD@{3}: commit: v6 03e27be (tag: v1.4) HEAD@{4}: commit: v7 1202723 HEAD@{5}: commit: v6 ecc001d HEAD@{6}: clone: from http://192.168.1.30/root/web-page.git
root@ubuntu1804:/data/src/web-page# git reset --hard 9cb6bf6
root@ubuntu1804:/data/src/web-page# git branch * master
root@ubuntu1804:/data/src/web-page# git checkout -b operations Switched to a new branch 'operations'
root@ubuntu1804:/data/src/web-page# git branch master * operations
root@ubuntu1804:/data/src/web-page# git checkout master Switched to branch 'master' Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded. (use "git pull" to update your local branch) root@ubuntu1804:/data/src/web-page# git branch * master operations
root@ubuntu1804:~# gitlab-ctl stop sidekiq ok: down: sidekiq: 0s, normally up root@ubuntu1804:~# gitlab-ctl stop nunicorn
root@ubuntu1804:~# gitlab-rake gitlab:backup:create
root@ubuntu1804:~# ll /var/opt/gitlab/backups/1563709800_2019_07_21_11.11.5_gitlab_backup.tar -rw------- 1 git git 92160 Jul 21 19:50 /var/opt/gitlab/backups/1563709800_2019_07_21_11.11.5_gitlab_backup.tar
root@ubuntu1804:~# gitlab-ctl stop sidekiq ok: down: sidekiq: 0s, normally up root@ubuntu1804:~# gitlab-ctl stop unicorn ok: down: unicorn: 0s, normally up
root@ubuntu1804:~# gitlab-rake gitlab:backup:restore /var/opt/gitlab/backups/1563709800_2019_07_21_11.11.5_gitlab_backup.tar
oot@ubuntu1804:~# gitlab-ctl start sidekiq ok: run: sidekiq: (pid 80094) 1s root@ubuntu1804:~# gitlab-ctl start unicorn ok: run: unicorn: (pid 80191) 0s