Ubunt安装Gitlab

只因gitlab官方文档写着最低4G运行内存,so,本地搭建

安装

当前准备的Linux是Ubuntu 19.04 - mate

修改更新源,换为清华源

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak

sudo vi /etc/apt/sources.list

1
2
3
4
5
6
7
8
9
10
11
# 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-proposed main restricted universe multiverse

更新

sudo apt update --fix-missing

官方Ubuntu安装文档

安装openssh-server ca-certificates

sudo apt install -y openssh-server ca-certificates

再安装postfix

sudo apt install -y postfix

之后选择“Internet Site”,然后输入一个mail_name

因国内环境,so,找个清华的包下载着

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/trusty/main/g/gitlab-ce/gitlab-ce_11.10.8-ce.0_amd64.deb

然后就是一个等待的过程… …

安装Gitlab

sudo dpkg -i gitlab-ce_11.10.8-ce.0_amd64.deb

配置

修改服务器地址

sudo vi /etc/gitlab/gitlab.rb

external_url 'http://gitlab.example.com/' 改为 external_url 'http://192.168.159.149'

没准改成 ‘http://localhost' 也可以

重新加载配置并启动gitlab

sudo gitlab-ctl reconfigure

等gitlab启动输出完一堆log

浏览器地址栏输入: http://192.168.159.149 就可以访问了,默认80端口

访问之后提示你重置root密码

登录

1
2
3
user_name: root

user_password: 你自己重新设置的

控制台重设密码

新建用户后发现,竟然重新登录密码错误,很迷

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /opt/gitlab/bin

sudo gitlab-rails console production

t=User.where(id:2).first

t.password=12345678

t.password_confirmation=12345678

t.save!

exit
0%