本文记录VMware Workstation
环境下Ubuntu server 22.04
系统安装gitlab-ce_15.8.3
的过程。
准备环境
- 一台安装好
ubuntu server
的虚拟机 - ubuntu可联网
- SecureCRT软件(或其它带SSH登陆功能的工具)
更新软件包信息和安装软件
首先设置好国内更新源,在安装Ubuntu
的时候我已经填写了阿里云的站点(mirrors.aliyun.com/ubuntu),如果你没有修改这一项,登陆服务器后修改 /etc/apt/sources.list
即可
1 | sudo apt-get update |
安装或更新以下软件(虽然安装Ubuntu
的时候勾选了Openssh
但是不是最新版本,提示升级)
1 | sudo apt-get install curl openssh-server ca-certificates postfix |
命令回显
1 | kir@gitlabserver:/etc/apt$ sudo apt-get install curl openssh-server ca-certificates postfix |
postfix 软件安装后会弹出一个”Postfix Configuration”向导,直接选No configuration
不进行配置(本地环境不实用)
下载和安装gitlab-ce_15.8.3
这个看各自网络的网速,官网下载(ubuntu/jammy/gitlab-ce_15.8.3-ce.0_amd64.deb - gitlab/gitlab-ce · packages.gitlab.com)
清华镜像站下载(Index of /gitlab-ce/ubuntu/pool/jammy/main/g/gitlab-ce/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror)
下载完成后,校验一下MD5值,对比官网提供的校验信息
1 | kir@gitlabserver:~$ sudo md5sum gitlab-ce_15.8.3-ce.0_amd64.deb |
命令回显:
1 | kir@gitlabserver:~$ sudo dpkg -i gitlab-ce_15.8.3-ce.0_amd64.deb |
修改外部url和reconfigure
- 修改
/etc/gitlab/
下的gitlab.rb
文件,external_url直接修改为ubuntu系统
的的IP
地址,如果 80 端口有冲突可在后边加上端口号
1 | external_url 'http://192.168.x.x' |
1 | kir@gitlabserver:~$ cd /etc/gitlab |
- 重配置(这一步骤耗时较长)
1 | kir@gitlabserver:/opt/gitlab/bin$ sudo gitlab-ctl reconfigure |
- 重启gitlab
1 | kir@gitlabserver:/opt/gitlab/bin$ sudo gitlab-ctl restart |
修改 root 密码
根据重配置
步骤后的提示Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
,root的初始密码储存在initial_root_password
,文件在第一次reconfigure 24小时后清除。
- 使用
initial_root_password
文件里的密码 web登陆,”Edit profile”–”Panssword”修改
- 使用命令修改
1 | kir@gitlabserver:/etc/gitlab$ sudo gitlab-rake "gitlab:password:reset[root]" |
- 控制台修改
1 | 切换路径 |
注册和登陆Gitlab
在启动gitlab后,直接用浏览器登陆可能出现下图所示502错误,等一会儿再打开就ok了,猜测是服务没有完全运行起来,也有可能是我物理机配置差劲。
- 注册,由于是本地使用,之前也没配置邮件Postfix,填上舒服的信息即可
- 注册完后登陆出错,看提示是账号被挂起,使用root管理员账户登陆进行审批通过即可
- 登陆管理员账户进行审批通过
- 退出管理员登陆,使用刚才注册的账号登陆,确认后,选择一个角色
最后
- 为什么写这篇文,因为我的一块硬盘报废了,整块硬盘直接奔溃,各种尝试后放弃了,因为这块500G的硬盘是大学时候台式电脑的,间接原因是使用时间和寿命,直接原因是电脑死机强制关机。
- 然后京东购了一块固态盘,一看价格现在同容量的固态硬盘比机械硬盘还便宜了。都说固态硬盘一坏文件全扑街,机械硬盘还有抢救的机会,这个只能靠自己掌控了,临近使用寿命或电脑出现异常就要考虑换硬盘了,最好的方法是做备份。
- 虽然这块盘报废了,也丢失了一些文件,但是由于我把重要的文件都做有备份,但是像这种虚拟机的环境一般都不留备份(文件太大太多)。
- 得益于硬盘报废,实操了一把前面文章写的自动备份Hexo源文件到私有仓库和Hexo环境新电脑环境重构,博客源文件回来了。
- 备份很重要-备份很重要-备份很重要