1.配置网卡及Ubuntu仓库源 1)配置网卡eth0,本地内网网卡无需指定网关和域名服务器 network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no addresses: [192.168.1.30/24] 2)配置网卡eth1,要保持以下两个字节的严格缩进,否则会导致网卡起不来 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] 3)配置阿里云仓库源 root@ubuntu1804:~# vim /etc/apt/sources.list deb bionic main restricted universe multiverse deb-src bionic main restricted universe multiverse deb bionic-security main restricted universe multiverse deb-src bionic-security main restricted universe multiverse deb bionic-updates main restricted universe multiverse deb-src bionic-updates main restricted universe multiverse deb bionic-proposed main restricted universe multiverse deb-src bionic-proposed main restricted universe multiverse deb bionic-backports main restricted universe multiverse deb-src bionic-backports main restricted universe multiverse 4)更新仓库 root@ubuntu1804:~# apt update root@ubuntu1804:~# apt update Get:1 bionic InRelease [242 kB] Get:2 bionic-security InRelease [88.7 kB] Get:3 bionic-updates InRelease [88.7 kB] Get:4 bionic-proposed InRelease [242 kB] …… 2.安装gitlab包 1)下载gitlab-ce社区版包 root@ubuntu1804:~# ls /data/ gitlab-ce_11.11.5-ce.0_amd64.deb 2)安装gitlab,要确定gitlab包适合此版本ubuntu系统 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) … #等待安装完成 3)此时无法识别主机,需修改git配置文件,指定主机 root@ubuntu1804:/data# vim /etc/gitlab/gitlab.rb external_url 'http://192.168.1.30' #修改指定的ip主机 4)配置完进行gitlab初始化 root@ubuntu1804:/data# gitlab-ctl reconfigure 3.命令操作 1)进入数据库命令行 root@ubuntu1804:~# gitlab-psql gitlabhq_production-# \db List of tablespaces Name | Owner | Location ------------+-------------+---------- pg_default | gitlab-psql | pg_global | gitlab-psql | (2 rows) 2)查看gitlab的运行状态 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 3)gitlab服务命令行的启动、停止、重启 gitlab-ctl start/stop/restart gitlab 4)查看gitlab的nginx服务组件的日志 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" …… 4.浏览器访问gitlab 1)设置新的密码,默认登录的用户为root
2)登录后默认的界面 3)点击setting,在点击sign-up可以设置是否允许创建新用户 4)去掉对勾,禁止创建新账户 5)再点击保存修改生效GitLab的部署、代码克隆和提交、数据备份等
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/31f4c75a0f2ef14ad429b9b0e540f3c8.html