咸鱼

咸鱼是以盐腌渍后,晒干的鱼

0%

Gitlab升级笔记

2017年在 Ubuntu14.04 中安装 Gitlab社区版 ,自从做过一次升级至版本 10.5.5 后,直到目前没升级过,版本落后太多,而且最近暴露的日志等漏洞也波及到Gitlab,为了安全要升级一下。

在官网得知:如果想要升级到最新版本,得一个一个版本的升级,不能跨版本升级,每个版本之间有依赖,感觉好麻烦。

之前都是下载deb包安装升级的,这次尝试一下apt升级。

注意:下面的命令都是以root的身份执行,普通用户需带sudo

一、升级Gitlab失败

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 4.4.0-148-generic x86_64)

* Documentation: https://help.ubuntu.com/

System information as of Tue Jan 18 14:19:39 CST 2022

System load: 0.0 Memory usage: 2% Processes: 185
Usage of /: 10.7% of 116.77GB Swap usage: 0% Users logged in: 0

Graph this data and manage this system at:
https://landscape.canonical.com/

UA Infrastructure Extended Security Maintenance (ESM) is not enabled.

5 updates can be installed immediately.
4 of these updates are security updates.
To see these additional updates run: apt list --upgradable

Enable UA Infrastructure ESM to receive 150 additional security updates.
See https://ubuntu.com/advantage or run: sudo ua status

New release '16.04.7 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Your Hardware Enablement Stack (HWE) is supported until April 2019.

# 下载&添加公钥
$ curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
$ vim /etc/apt/sources.list.d/gitlab-ce.list
# 写入这一行,注意,不同的ubuntu版本,最后的代号不一样,trusty是ubuntu 14.04的代号
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu trusty main

# source.list 最好切换到国内的,如清华大学的源
$ apt update

# 查看是否有新版本可以升级
$ apt list --upgradable
Listing... Done
gitlab-ce/trusty 11.10.8-ce.0 amd64 [upgradable from: 10.5.5-ce.0]

# 升级gitlab-ce/trusty
$ apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
amd64-microcode linux-modules-extra-4.4.0-148-generic
Use 'apt-get autoremove' to remove them.
The following packages have been kept back:
linux-generic-lts-xenial linux-headers-generic-lts-xenial
linux-image-generic-lts-xenial
The following packages will be upgraded:
gitlab-ce
1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 620 MB of archives.
After this operation, 488 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/ trusty/main gitlab-ce amd64 11.10.8-ce.0 [620 MB]
Err https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/ trusty/main gitlab-ce amd64 11.10.8-ce.0
HttpError404
E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/trusty/main/g/gitlab-ce/gitlab-ce_11.10.8-ce.0_amd64.deb HttpError404

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
# 遇到了404错误

查看一下这个链接,原来trusty(14)已经被删除了,但xenial(16)还在。看来得先升级到ubuntu16.04。

二、升级Ubuntu16.04

1
2
3
# 升级到ubuntu 16.04
$ do-release-upgrade
# 等待下载更新(要保证有足够的磁盘空间)

升级ubuntu16.04后

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Welcome to Ubuntu 16.04.7 LTS (GNU/Linux 4.4.0-210-generic x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

$ apt update
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
Hit:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease
Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease
Hit:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
# 修改一下gitlab-ce源,升级的时候ubunut已经修改过来并注释了,我们只需把注释去掉
$ vim /etc/apt/sources.list.d/gitlab-ce.list
# 把注释去掉

# 查看gitlab版本
$ gitlab-rake gitlab:env:info

System information
System: Ubuntu 16.04
Current User: git
Using RVM: no
Ruby Version: 2.3.6p384
Gem Version: 2.6.13
Bundler Version:1.13.7
Rake Version: 12.3.0
Redis Version: 3.2.11
Git Version: 2.14.3
Sidekiq Version:5.0.5
Go Version: unknown

GitLab information
Version: 10.5.5
Revision: c7e4919
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version: 6.0.3
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git

# 启动gitlab
$ gitlab-ctl start
fail: gitaly: runsv not running
fail: gitlab-monitor: runsv not running
fail: gitlab-workhorse: runsv not running
fail: logrotate: runsv not running
fail: nginx: runsv not running
fail: node-exporter: runsv not running
fail: postgres-exporter: runsv not running
fail: postgresql: runsv not running
fail: prometheus: runsv not running
fail: redis: runsv not running
fail: redis-exporter: runsv not running
fail: sidekiq: runsv not running
fail: unicorn: runsv not running
# 服务都没有在跑,需要重新配置一下。
$ gitlab-ctl reconfigure
$ gitlab-ctl start
ok: run: gitlab-monitor: (pid 2991) 0s
ok: run: gitlab-workhorse: (pid 3004) 1s
ok: run: logrotate: (pid 3019) 0s
ok: run: nginx: (pid 3027) 0s
ok: run: node-exporter: (pid 3033) 1s
ok: run: postgres-exporter: (pid 3045) 0s
ok: run: postgresql: (pid 3127) 1s
ok: run: prometheus: (pid 3134) 0s
ok: run: redis: (pid 3138) 0s
ok: run: redis-exporter: (pid 3142) 1s
ok: run: sidekiq: (pid 3147) 0s
ok: run: unicorn: (pid 3162) 0s
ok: run: sidekiq: (pid 3189) 0s

访问 gitlab 正常,接下来就可以准备升级Gitlab。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
$ apt list --upgradable
Listing... Done
# 注意:这里显示可以升级到13.12.15,但不能直接用 ‘apt upgrade’ 更新
gitlab-ce/xenial 13.12.15-ce.0 amd64 [upgradable from: 10.5.5-ce.0]

$ apt list --upgradable -a # 查看所有的版本
Listing... Done
gitlab-ce/xenial 13.12.15-ce.0 amd64 [upgradable from: 10.5.5-ce.0]
gitlab-ce/xenial 13.12.12-ce.0 amd64
gitlab-ce/xenial 13.12.11-ce.0 amd64
gitlab-ce/xenial 13.12.10-ce.0 amd64
gitlab-ce/xenial 13.12.9-ce.0 amd64
gitlab-ce/xenial 13.12.8-ce.0 amd64
gitlab-ce/xenial 13.12.7-ce.0 amd64
gitlab-ce/xenial 13.12.6-ce.0 amd64
gitlab-ce/xenial 13.12.5-ce.0 amd64
gitlab-ce/xenial 13.12.4-ce.0 amd64
gitlab-ce/xenial 13.12.3-ce.0 amd64
gitlab-ce/xenial 13.12.2-ce.0 amd64
gitlab-ce/xenial 13.12.1-ce.0 amd64
gitlab-ce/xenial 13.12.0-ce.0 amd64
gitlab-ce/xenial 13.11.7-ce.0 amd64
gitlab-ce/xenial 13.11.6-ce.0 amd64
gitlab-ce/xenial 13.11.5-ce.0 amd64
gitlab-ce/xenial 13.11.4-ce.0 amd64
gitlab-ce/xenial 13.11.3-ce.0 amd64
gitlab-ce/xenial 13.11.2-ce.0 amd64
gitlab-ce/xenial 13.11.1-ce.0 amd64
gitlab-ce/xenial 13.11.0-ce.0 amd64
gitlab-ce/xenial 13.10.5-ce.0 amd64
gitlab-ce/xenial 13.10.4-ce.0 amd64
gitlab-ce/xenial 13.10.3-ce.0 amd64
gitlab-ce/xenial 13.10.2-ce.0 amd64
gitlab-ce/xenial 13.10.1-ce.0 amd64
gitlab-ce/xenial 13.10.0-ce.0 amd64
gitlab-ce/xenial 13.9.7-ce.0 amd64
gitlab-ce/xenial 13.9.6-ce.0 amd64
gitlab-ce/xenial 13.9.5-ce.0 amd64
gitlab-ce/xenial 13.9.4-ce.0 amd64
gitlab-ce/xenial 13.9.3-ce.0 amd64
gitlab-ce/xenial 13.9.2-ce.0 amd64
gitlab-ce/xenial 13.9.1-ce.0 amd64
gitlab-ce/xenial 13.9.0-ce.0 amd64
gitlab-ce/xenial 13.8.8-ce.0 amd64
gitlab-ce/xenial 13.8.7-ce.0 amd64
gitlab-ce/xenial 13.8.6-ce.0 amd64
gitlab-ce/xenial 13.8.5-ce.0 amd64
gitlab-ce/xenial 13.8.4-ce.0 amd64
gitlab-ce/xenial 13.8.3-ce.0 amd64
gitlab-ce/xenial 13.8.2-ce.0 amd64
gitlab-ce/xenial 13.8.1-ce.0 amd64
gitlab-ce/xenial 13.8.0-ce.0 amd64
gitlab-ce/xenial 13.7.9-ce.0 amd64
gitlab-ce/xenial 13.7.8-ce.0 amd64
gitlab-ce/xenial 13.7.7-ce.0 amd64
gitlab-ce/xenial 13.7.6-ce.0 amd64
gitlab-ce/xenial 13.7.5-ce.0 amd64
gitlab-ce/xenial 13.7.4-ce.0 amd64
gitlab-ce/xenial 13.7.3-ce.0 amd64
gitlab-ce/xenial 13.7.2-ce.0 amd64
gitlab-ce/xenial 13.7.1-ce.0 amd64
gitlab-ce/xenial 13.7.0-ce.0 amd64
gitlab-ce/xenial 13.6.7-ce.0 amd64
gitlab-ce/xenial 13.6.6-ce.0 amd64
gitlab-ce/xenial 13.6.5-ce.0 amd64
gitlab-ce/xenial 13.6.4-ce.0 amd64
gitlab-ce/xenial 13.6.3-ce.0 amd64
gitlab-ce/xenial 13.6.2-ce.0 amd64
gitlab-ce/xenial 13.6.1-ce.0 amd64
gitlab-ce/xenial 13.6.0-ce.0 amd64
gitlab-ce/xenial 13.5.7-ce.0 amd64
gitlab-ce/xenial 13.5.6-ce.0 amd64
gitlab-ce/xenial 13.5.5-ce.0 amd64
gitlab-ce/xenial 13.5.4-ce.0 amd64
gitlab-ce/xenial 13.5.3-ce.0 amd64
gitlab-ce/xenial 13.5.2-ce.0 amd64
gitlab-ce/xenial 13.5.1-ce.0 amd64
gitlab-ce/xenial 13.5.0-ce.0 amd64
gitlab-ce/xenial 13.4.7-ce.0 amd64
gitlab-ce/xenial 13.4.6-ce.0 amd64
gitlab-ce/xenial 13.4.5-ce.0 amd64
gitlab-ce/xenial 13.4.4-ce.0 amd64
gitlab-ce/xenial 13.4.3-ce.0 amd64
gitlab-ce/xenial 13.4.2-ce.0 amd64
gitlab-ce/xenial 13.4.1-ce.0 amd64
gitlab-ce/xenial 13.4.0-ce.0 amd64
gitlab-ce/xenial 13.3.9-ce.0 amd64
gitlab-ce/xenial 13.3.8-ce.0 amd64
gitlab-ce/xenial 13.3.7-ce.0 amd64
gitlab-ce/xenial 13.3.6-ce.0 amd64
gitlab-ce/xenial 13.3.5-ce.0 amd64
gitlab-ce/xenial 13.3.4-ce.0 amd64
gitlab-ce/xenial 13.3.3-ce.0 amd64
gitlab-ce/xenial 13.3.2-ce.0 amd64
gitlab-ce/xenial 13.3.1-ce.0 amd64
gitlab-ce/xenial 13.3.0-ce.1 amd64
gitlab-ce/xenial 13.2.10-ce.0 amd64
gitlab-ce/xenial 13.2.9-ce.0 amd64
gitlab-ce/xenial 13.2.8-ce.0 amd64
gitlab-ce/xenial 13.2.7-ce.0 amd64
gitlab-ce/xenial 13.2.6-ce.0 amd64
gitlab-ce/xenial 13.2.5-ce.0 amd64
gitlab-ce/xenial 13.2.4-ce.0 amd64
gitlab-ce/xenial 13.2.3-ce.0 amd64
gitlab-ce/xenial 13.2.2-ce.0 amd64
gitlab-ce/xenial 13.2.1-ce.0 amd64
gitlab-ce/xenial 13.2.0-ce.0 amd64
gitlab-ce/xenial 13.1.11-ce.0 amd64
gitlab-ce/xenial 13.1.10-ce.0 amd64
gitlab-ce/xenial 13.1.9-ce.0 amd64
gitlab-ce/xenial 13.1.8-ce.0 amd64
gitlab-ce/xenial 13.1.7-ce.0 amd64
gitlab-ce/xenial 13.1.6-ce.0 amd64
gitlab-ce/xenial 13.1.5-ce.0 amd64
gitlab-ce/xenial 13.1.4-ce.0 amd64
gitlab-ce/xenial 13.1.3-ce.0 amd64
gitlab-ce/xenial 13.1.2-ce.0 amd64
gitlab-ce/xenial 13.1.1-ce.0 amd64
gitlab-ce/xenial 13.1.0-ce.0 amd64
gitlab-ce/xenial 13.0.14-ce.0 amd64
gitlab-ce/xenial 13.0.13-ce.0 amd64
gitlab-ce/xenial 13.0.12-ce.0 amd64
gitlab-ce/xenial 13.0.10-ce.0 amd64
gitlab-ce/xenial 13.0.9-ce.0 amd64
gitlab-ce/xenial 13.0.8-ce.0 amd64
gitlab-ce/xenial 13.0.7-ce.0 amd64
gitlab-ce/xenial 13.0.6-ce.0 amd64
gitlab-ce/xenial 13.0.5-ce.0 amd64
gitlab-ce/xenial 13.0.4-ce.0 amd64
gitlab-ce/xenial 13.0.3-ce.0 amd64
gitlab-ce/xenial 13.0.1-ce.0 amd64
gitlab-ce/xenial 13.0.0-ce.0 amd64
gitlab-ce/xenial 12.10.14-ce.0 amd64
gitlab-ce/xenial 12.10.13-ce.0 amd64
gitlab-ce/xenial 12.10.12-ce.0 amd64
gitlab-ce/xenial 12.10.11-ce.0 amd64
gitlab-ce/xenial 12.10.10-ce.0 amd64
gitlab-ce/xenial 12.10.9-ce.0 amd64
gitlab-ce/xenial 12.10.8-ce.0 amd64
gitlab-ce/xenial 12.10.7-ce.0 amd64
gitlab-ce/xenial 12.10.6-ce.0 amd64
gitlab-ce/xenial 12.10.5-ce.0 amd64
gitlab-ce/xenial 12.10.3-ce.0 amd64
gitlab-ce/xenial 12.10.2-ce.0 amd64
gitlab-ce/xenial 12.10.1-ce.0 amd64
gitlab-ce/xenial 12.10.0-ce.0 amd64
gitlab-ce/xenial 12.9.10-ce.0 amd64
gitlab-ce/xenial 12.9.9-ce.0 amd64
gitlab-ce/xenial 12.9.8-ce.0 amd64
gitlab-ce/xenial 12.9.7-ce.0 amd64
gitlab-ce/xenial 12.9.5-ce.0 amd64
gitlab-ce/xenial 12.9.4-ce.0 amd64
gitlab-ce/xenial 12.9.3-ce.0 amd64
gitlab-ce/xenial 12.9.2-ce.0 amd64
gitlab-ce/xenial 12.9.1-ce.0 amd64
gitlab-ce/xenial 12.9.0-ce.0 amd64
gitlab-ce/xenial 12.8.10-ce.0 amd64
gitlab-ce/xenial 12.8.9-ce.0 amd64
gitlab-ce/xenial 12.8.8-ce.0 amd64
gitlab-ce/xenial 12.8.7-ce.0 amd64
gitlab-ce/xenial 12.8.6-ce.0 amd64
gitlab-ce/xenial 12.8.5-ce.0 amd64
gitlab-ce/xenial 12.8.2-ce.0 amd64
gitlab-ce/xenial 12.8.1-ce.0 amd64
gitlab-ce/xenial 12.8.0-ce.0 amd64
gitlab-ce/xenial 12.7.9-ce.0 amd64
gitlab-ce/xenial 12.7.8-ce.0 amd64
gitlab-ce/xenial 12.7.7-ce.0 amd64
gitlab-ce/xenial 12.7.6-ce.0 amd64
gitlab-ce/xenial 12.7.5-ce.0 amd64
gitlab-ce/xenial 12.7.4-ce.0 amd64
gitlab-ce/xenial 12.7.2-ce.0 amd64
gitlab-ce/xenial 12.7.0-ce.0 amd64
gitlab-ce/xenial 12.6.8-ce.0 amd64
gitlab-ce/xenial 12.6.7-ce.0 amd64
gitlab-ce/xenial 12.6.6-ce.0 amd64
gitlab-ce/xenial 12.6.4-ce.0 amd64
gitlab-ce/xenial 12.6.3-ce.0 amd64
gitlab-ce/xenial 12.6.2-ce.0 amd64
gitlab-ce/xenial 12.6.1-ce.0 amd64
gitlab-ce/xenial 12.6.0-ce.0 amd64
gitlab-ce/xenial 12.5.10-ce.0 amd64
gitlab-ce/xenial 12.5.9-ce.0 amd64
gitlab-ce/xenial 12.5.7-ce.0 amd64
gitlab-ce/xenial 12.5.6-ce.0 amd64
gitlab-ce/xenial 12.5.5-ce.0 amd64
gitlab-ce/xenial 12.5.4-ce.0 amd64
gitlab-ce/xenial 12.5.3-ce.0 amd64
gitlab-ce/xenial 12.5.2-ce.0 amd64
gitlab-ce/xenial 12.5.1-ce.0 amd64
gitlab-ce/xenial 12.5.0-ce.0 amd64
gitlab-ce/xenial 12.4.8-ce.0 amd64
gitlab-ce/xenial 12.4.7-ce.0 amd64
gitlab-ce/xenial 12.4.6-ce.0 amd64
gitlab-ce/xenial 12.4.5-ce.0 amd64
gitlab-ce/xenial 12.4.4-ce.0 amd64
gitlab-ce/xenial 12.4.3-ce.0 amd64
gitlab-ce/xenial 12.4.2-ce.0 amd64
gitlab-ce/xenial 12.4.1-ce.0 amd64
gitlab-ce/xenial 12.4.0-ce.0 amd64
gitlab-ce/xenial 12.3.9-ce.0 amd64
gitlab-ce/xenial 12.3.8-ce.0 amd64
gitlab-ce/xenial 12.3.7-ce.0 amd64
gitlab-ce/xenial 12.3.6-ce.0 amd64
gitlab-ce/xenial 12.3.5-ce.0 amd64
gitlab-ce/xenial 12.3.4-ce.0 amd64
gitlab-ce/xenial 12.3.3-ce.0 amd64
gitlab-ce/xenial 12.3.2-ce.0 amd64
gitlab-ce/xenial 12.3.1-ce.0 amd64
gitlab-ce/xenial 12.3.0-ce.0 amd64
gitlab-ce/xenial 12.2.12-ce.0 amd64
gitlab-ce/xenial 12.2.9-ce.0 amd64
gitlab-ce/xenial 12.2.8-ce.0 amd64
gitlab-ce/xenial 12.2.7-ce.0 amd64
gitlab-ce/xenial 12.2.6-ce.0 amd64
gitlab-ce/xenial 12.2.5-ce.0 amd64
gitlab-ce/xenial 12.2.4-ce.0 amd64
gitlab-ce/xenial 12.2.3-ce.0 amd64
gitlab-ce/xenial 12.2.1-ce.0 amd64
gitlab-ce/xenial 12.2.0-ce.0 amd64
gitlab-ce/xenial 12.1.17-ce.0 amd64
gitlab-ce/xenial 12.1.14-ce.0 amd64
gitlab-ce/xenial 12.1.13-ce.0 amd64
gitlab-ce/xenial 12.1.12-ce.0 amd64
gitlab-ce/xenial 12.1.11-ce.0 amd64
gitlab-ce/xenial 12.1.9-ce.0 amd64
gitlab-ce/xenial 12.1.8-ce.0 amd64
gitlab-ce/xenial 12.1.6-ce.0 amd64
gitlab-ce/xenial 12.1.4-ce.0 amd64
gitlab-ce/xenial 12.1.3-ce.0 amd64
gitlab-ce/xenial 12.1.2-ce.0 amd64
gitlab-ce/xenial 12.1.1-ce.0 amd64
gitlab-ce/xenial 12.1.0-ce.0 amd64
gitlab-ce/xenial 12.0.12-ce.0 amd64
gitlab-ce/xenial 12.0.9-ce.0 amd64
gitlab-ce/xenial 12.0.8-ce.0 amd64
gitlab-ce/xenial 12.0.6-ce.0 amd64
gitlab-ce/xenial 12.0.4-ce.0 amd64
gitlab-ce/xenial 12.0.3-ce.0 amd64
gitlab-ce/xenial 12.0.2-ce.0 amd64
gitlab-ce/xenial 12.0.1-ce.0 amd64
gitlab-ce/xenial 12.0.0-ce.0 amd64
gitlab-ce/xenial 11.11.8-ce.0 amd64
gitlab-ce/xenial 11.11.7-ce.0 amd64
gitlab-ce/xenial 11.11.5-ce.0 amd64
gitlab-ce/xenial 11.11.4-ce.0 amd64
gitlab-ce/xenial 11.11.3-ce.0 amd64
gitlab-ce/xenial 11.11.2-ce.0 amd64
gitlab-ce/xenial 11.11.1-ce.0 amd64
gitlab-ce/xenial 11.11.0-ce.0 amd64
gitlab-ce/xenial 11.10.8-ce.0 amd64
gitlab-ce/xenial 11.10.7-ce.0 amd64
gitlab-ce/xenial 11.10.6-ce.0 amd64
gitlab-ce/xenial 11.10.5-ce.0 amd64
gitlab-ce/xenial 11.10.4-ce.0 amd64
gitlab-ce/xenial 11.10.3-ce.0 amd64
gitlab-ce/xenial 11.10.2-ce.0 amd64
gitlab-ce/xenial 11.10.1-ce.0 amd64
gitlab-ce/xenial 11.10.0-ce.0 amd64
gitlab-ce/xenial 11.9.12-ce.0 amd64
gitlab-ce/xenial 11.9.11-ce.0 amd64
gitlab-ce/xenial 11.9.10-ce.0 amd64
gitlab-ce/xenial 11.9.9-ce.0 amd64
gitlab-ce/xenial 11.9.8-ce.0 amd64
gitlab-ce/xenial 11.9.7-ce.0 amd64
gitlab-ce/xenial 11.9.6-ce.0 amd64
gitlab-ce/xenial 11.9.4-ce.0 amd64
gitlab-ce/xenial 11.9.1-ce.0 amd64
gitlab-ce/xenial 11.9.0-ce.0 amd64
gitlab-ce/xenial 11.8.10-ce.0 amd64
gitlab-ce/xenial 11.8.9-ce.0 amd64
gitlab-ce/xenial 11.8.8-ce.0 amd64
gitlab-ce/xenial 11.8.7-ce.0 amd64
gitlab-ce/xenial 11.8.6-ce.0 amd64
gitlab-ce/xenial 11.8.3-ce.0 amd64
gitlab-ce/xenial 11.8.2-ce.0 amd64
gitlab-ce/xenial 11.8.1-ce.0 amd64
gitlab-ce/xenial 11.8.0-ce.0 amd64
gitlab-ce/xenial 11.7.12-ce.0 amd64
gitlab-ce/xenial 11.7.11-ce.0 amd64
gitlab-ce/xenial 11.7.10-ce.0 amd64
gitlab-ce/xenial 11.7.7-ce.0 amd64
gitlab-ce/xenial 11.7.6-ce.0 amd64
gitlab-ce/xenial 11.7.5-ce.0 amd64
gitlab-ce/xenial 11.7.4-ce.0 amd64
gitlab-ce/xenial 11.7.3-ce.0 amd64
gitlab-ce/xenial 11.7.0-ce.0 amd64
gitlab-ce/xenial 11.6.11-ce.0 amd64
gitlab-ce/xenial 11.6.10-ce.0 amd64
gitlab-ce/xenial 11.6.9-ce.0 amd64
gitlab-ce/xenial 11.6.8-ce.0 amd64
gitlab-ce/xenial 11.6.5-ce.0 amd64
gitlab-ce/xenial 11.6.4-ce.0 amd64
gitlab-ce/xenial 11.6.3-ce.0 amd64
gitlab-ce/xenial 11.6.2-ce.0 amd64
gitlab-ce/xenial 11.6.1-ce.0 amd64
gitlab-ce/xenial 11.6.0-ce.0 amd64
gitlab-ce/xenial 11.5.11-ce.0 amd64
gitlab-ce/xenial 11.5.10-ce.0 amd64
gitlab-ce/xenial 11.5.7-ce.0 amd64
gitlab-ce/xenial 11.5.6-ce.0 amd64
gitlab-ce/xenial 11.5.5-ce.0 amd64
gitlab-ce/xenial 11.5.4-ce.0 amd64
gitlab-ce/xenial 11.5.3-ce.0 amd64
gitlab-ce/xenial 11.5.2-ce.0 amd64
gitlab-ce/xenial 11.5.1-ce.0 amd64
gitlab-ce/xenial 11.5.0-ce.0 amd64
gitlab-ce/xenial 11.4.14-ce.0 amd64
gitlab-ce/xenial 11.4.13-ce.0 amd64
gitlab-ce/xenial 11.4.12-ce.0 amd64
gitlab-ce/xenial 11.4.11-ce.0 amd64
gitlab-ce/xenial 11.4.10-ce.0 amd64
gitlab-ce/xenial 11.4.9-ce.0 amd64
gitlab-ce/xenial 11.4.8-ce.0 amd64
gitlab-ce/xenial 11.4.7-ce.0 amd64
gitlab-ce/xenial 11.4.6-ce.0 amd64
gitlab-ce/xenial 11.4.5-ce.0 amd64
gitlab-ce/xenial 11.4.4-ce.0 amd64
gitlab-ce/xenial 11.4.3-ce.0 amd64
gitlab-ce/xenial 11.4.0-ce.0 amd64
gitlab-ce/xenial 11.3.14-ce.0 amd64
gitlab-ce/xenial 11.3.13-ce.0 amd64
gitlab-ce/xenial 11.3.12-ce.0 amd64
gitlab-ce/xenial 11.3.11-ce.0 amd64
gitlab-ce/xenial 11.3.10-ce.0 amd64
gitlab-ce/xenial 11.3.9-ce.0 amd64
gitlab-ce/xenial 11.3.8-ce.0 amd64
gitlab-ce/xenial 11.3.6-ce.0 amd64
gitlab-ce/xenial 11.3.5-ce.0 amd64
gitlab-ce/xenial 11.3.4-ce.0 amd64
gitlab-ce/xenial 11.3.3-ce.0 amd64
gitlab-ce/xenial 11.3.1-ce.0 amd64
gitlab-ce/xenial 11.3.0-ce.0 amd64
gitlab-ce/xenial 11.2.8-ce.0 amd64
gitlab-ce/xenial 11.2.7-ce.0 amd64
gitlab-ce/xenial 11.2.5-ce.0 amd64
gitlab-ce/xenial 11.2.4-ce.0 amd64
gitlab-ce/xenial 11.2.3-ce.0 amd64
gitlab-ce/xenial 11.2.2-ce.0 amd64
gitlab-ce/xenial 11.2.1-ce.0 amd64
gitlab-ce/xenial 11.2.0-ce.0 amd64
gitlab-ce/xenial 11.1.8-ce.0 amd64
gitlab-ce/xenial 11.1.7-ce.0 amd64
gitlab-ce/xenial 11.1.6-ce.0 amd64
gitlab-ce/xenial 11.1.4-ce.0 amd64
gitlab-ce/xenial 11.1.2-ce.0 amd64
gitlab-ce/xenial 11.1.1-ce.0 amd64
gitlab-ce/xenial 11.1.0-ce.0 amd64
gitlab-ce/xenial 11.0.6-ce.0 amd64
gitlab-ce/xenial 11.0.5-ce.0 amd64
gitlab-ce/xenial 11.0.4-ce.0 amd64
gitlab-ce/xenial 11.0.3-ce.0 amd64
gitlab-ce/xenial 11.0.2-ce.0 amd64
gitlab-ce/xenial 11.0.1-ce.0 amd64
gitlab-ce/xenial 11.0.0-ce.0 amd64
gitlab-ce/xenial 10.8.7-ce.0 amd64
gitlab-ce/xenial 10.8.6-ce.0 amd64
gitlab-ce/xenial 10.8.5-ce.0 amd64
gitlab-ce/xenial 10.8.4-ce.0 amd64
gitlab-ce/xenial 10.8.3-ce.0 amd64
gitlab-ce/xenial 10.8.2-ce.0 amd64
gitlab-ce/xenial 10.8.1-ce.0 amd64
gitlab-ce/xenial 10.8.0-ce.0 amd64
gitlab-ce/xenial 10.7.7-ce.0 amd64
gitlab-ce/xenial 10.7.6-ce.0 amd64
gitlab-ce/xenial 10.7.5-ce.0 amd64
gitlab-ce/xenial 10.7.4-ce.0 amd64
gitlab-ce/xenial 10.7.3-ce.0 amd64
gitlab-ce/xenial 10.7.2-ce.0 amd64
gitlab-ce/xenial 10.7.1-ce.0 amd64
gitlab-ce/xenial,xenial 10.7.0-ce.0 amd64
gitlab-ce/xenial 10.6.6-ce.0 amd64
gitlab-ce/xenial 10.6.5-ce.0 amd64
gitlab-ce/xenial 10.6.4-ce.0 amd64
gitlab-ce/xenial 10.6.3-ce.0 amd64
gitlab-ce/xenial 10.6.2-ce.0 amd64
gitlab-ce/xenial 10.6.1-ce.0 amd64
gitlab-ce/xenial 10.6.0-ce.0 amd64
gitlab-ce/xenial 10.5.8-ce.0 amd64
gitlab-ce/xenial 10.5.7-ce.0 amd64
gitlab-ce/xenial 10.5.6-ce.0 amd64
gitlab-ce/xenial 10.5.5-ce.0 amd64
gitlab-ce/now 10.5.5-ce.0 amd64 [installed,upgradable to: 13.12.15-ce.0]
...

三、Gitlab升级Path

查看【支持的升级路径】:

应该是各个版本的数据库不一致

四、升级Gitlab

参考路径 10.4.5 -> 10.8.7 -> 11.11.8 -> 12.0.12 -> 12.1.17 -> 12.9.5 ,决定先从 10.5.5 升级到 10.8.7 版本。

1. 10.5.5 升级到 10.8.7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
$ apt list --upgradable -a |grep 10.8.7
gitlab-ce/xenial 10.8.7-ce.0 amd64
# 安装指定版本
$ apt install gitlab-ce=10.8.7-ce.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-31
linux-headers-4.4.0-31-generic
linux-image-4.4.0-31-generic
linux-image-extra-4.4.0-31-generic
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
gitlab-ce
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 425 MB of archives.
After this operation, 115 MB of additional disk space will be used.
Get:1 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial/main
amd64 gitlab-ce amd64 10.8.7-ce.0 [425 MB]
Fetched 425 MB in 3min 47s (1,867 kB/s)
(Reading database ... 225666 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_10.8.7-ce.0_amd64.deb ...
Unpacking gitlab-ce (10.8.7-ce.0) over (10.5.5-ce.0) ...
Setting up gitlab-ce (10.8.7-ce.0) ...
Checking PostgreSQL executables:Starting Chef Client, version 13.6.4
resolving cookbooks for run list: ["gitlab::config", "postgresql::bin"]
Synchronizing Cookbooks:
- postgresql (0.1.0)
- gitlab (0.0.1)
- consul (0.0.0)
- package (0.1.0)
- registry (0.1.0)
- mattermost (0.1.0)
- letsencrypt (0.1.0)
- gitaly (0.1.0)
- runit (0.14.2)
- nginx (0.1.0)
- acme (3.1.0)
- crond (0.1.0)
- compat_resource (12.19.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: postgresql::bin
* ruby_block[Link postgresql bin files to the correct version]
action run (skipped due to only_if)

Running handlers:
Running handlers complete
Chef Client finished, 0/1 resources updated in 03 seconds
Checking PostgreSQL executables: OK
Found /etc/gitlab/skip-auto-migrations, exiting...

_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
sudo gitlab-ctl restart
before anything else.
If you need to roll back to the previous version you can use the database
backup made during the upgrade (scroll up for the filename).


$ gitlab-rake gitlab:env:info

System information
System: Ubuntu 16.04
Current User: git
Using RVM: no
Ruby Version: 2.3.7p456
Gem Version: 2.6.14
Bundler Version:1.13.7
Rake Version: 12.3.1
Redis Version: 3.2.11
Git Version: 2.16.4
Sidekiq Version:5.0.5
Go Version: unknown

GitLab information
Version: 10.8.7
Revision: eb600b0
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version: 7.1.2
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git

升级完成,但访问 Gitlab Web 出现500错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 尝试修复
$ gitlab-ctl restart
$ gitlab-ctl restart sidekiq
$ gitlab-ctl hup unicorn

# prometheus服务没起来
$ gitlab-ctl status
run: gitaly: (pid 774) 35s; run: log: (pid 769) 35s
run: gitlab-monitor: (pid 773) 35s; run: log: (pid 772) 35s
run: gitlab-workhorse: (pid 783) 35s; run: log: (pid 782) 35s
run: logrotate: (pid 771) 35s; run: log: (pid 770) 35s
run: nginx: (pid 791) 35s; run: log: (pid 790) 35s
run: node-exporter: (pid 776) 35s; run: log: (pid 775) 35s
run: postgres-exporter: (pid 794) 35s; run: log: (pid 793) 35s
run: postgresql: (pid 792) 35s; run: log: (pid 789) 35s
down: prometheus: 0s, normally up, want up; run: log: (pid 785) 35s
run: redis: (pid 778) 35s; run: log: (pid 777) 35s
run: redis-exporter: (pid 780) 35s; run: log: (pid 779) 35s
run: sidekiq: (pid 788) 35s; run: log: (pid 787) 35s
run: unicorn: (pid 784) 35s; run: log: (pid 781) 35s

# 查看prometheus的日志
$ tail -f -n 100 /var/log/gitlab/prometheus/current
level=error msg="Could not open the fingerprint-to-metric index for archived series.
Please try a 3rd party tool to repair LevelDB in directory
"/var/opt/gitlab/prometheus/data/archived_fingerprint_to_metric".
If unsuccessful or undesired, delete the whole directory and
restart Prometheus for crash recovery. You will lose all archived time series."
source="persistence.go:213"
level=error msg="Error opening memory series storage:
leveldb: manifest corrupted (field 'comparer'):
missing [file=MANIFEST-000158]" source="main.go:192"

# 修复prometheus
$ apt install python-pip
$ pip install leveldb
$ sudo -u gitlab-prometheus python -c "import leveldb; leveldb.RepairDB('/var/opt/gitlab/prometheus/data/archived_fingerprint_to_metric')"

$ gitlab-ctl status
run: gitaly: (pid 834) 41s; run: log: (pid 833) 41s
run: gitlab-monitor: (pid 863) 41s; run: log: (pid 862) 41s
run: gitlab-workhorse: (pid 836) 41s; run: log: (pid 835) 41s
run: logrotate: (pid 817) 41s; run: log: (pid 811) 41s
run: nginx: (pid 815) 41s; run: log: (pid 814) 41s
run: node-exporter: (pid 861) 41s; run: log: (pid 860) 41s
run: postgres-exporter: (pid 816) 41s; run: log: (pid 813) 41s
run: postgresql: (pid 871) 41s; run: log: (pid 870) 41s
run: prometheus: (pid 812) 41s; run: log: (pid 810) 41s
run: redis: (pid 865) 41s; run: log: (pid 864) 41s
run: redis-exporter: (pid 852) 41s; run: log: (pid 851) 41s
run: sidekiq: (pid 830) 41s; run: log: (pid 828) 41s
run: unicorn: (pid 869) 41s; run: log: (pid 868) 41s

访问 Gitlab Web 还是出现500错误,网上说很有可能是升级关系数据库的原因。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 查看关系数据库的升级状态,果然很多错误
$ gitlab-rake db:migrate:status
down 20180502122856 Create project mirror data
down 20180502134117 Migrate import attributes data from projects to project mirror data
down 20180503131624 Create remote mirrors
down 20180503141722 Add remote mirror available overridden to projects
down 20180503150427 Add index to namespaces runners token
down 20180503175053 Ensure missing columns to project mirror data
down 20180503175054 Add indexes to project mirror data
down 20180503193542 Add indexes to remote mirror
down 20180503193953 Add mirror available to application settings
down 20180503200320 Enable prometheus metrics by default
down 20180508055821 Make remote mirrors disabled by default
down 20180508100222 Add not null constraint to project mirror data foreign key
down 20180508102840 Add unique constraint to project mirror data project id index
down 20180529093006 Ensure remote mirror columns
# 升级数据库
$ gitlab-ctl stop # (注意:先停止服务)
$ gitlab-rake db:migrate
$ gitlab-ctl start # (注意:先开启服务)
$ gitlab-ctl reconfigure

Running handlers:
Running handlers complete
Chef Client finished, 31/558 resources updated in 34 seconds

Deprecations:

Old file /etc/gitlab/skip-auto-migrations found.
This file will stop being checked in GitLab 11, use /etc/gitlab/skip-auto-reconfigure
instead. This file has been automatically created for you as a migration aid.

To disable this message, remove the deprecated /etc/gitlab/skip-auto-migrations

gitlab Reconfigured!

到这里就500错误就解决了,可以正常访问Gitlab Web,至此升级 gtilab-ce-10.8.7 成功。

总结升级流程:

1
2
3
4
5
6
7
8
9
10
11
12
$ apt install gitlab-ce=10.8.7-ce.0

# 修复prometheus的leveldb
$ apt install python-pip
$ pip install leveldb
$ sudo -u gitlab-prometheus python -c "import leveldb; leveldb.RepairDB('/var/opt/gitlab/prometheus/data/archived_fingerprint_to_metric')"


$ gitlab-ctl stop # (注意:先停止服务)
$ gitlab-rake db:migrate # 升级数据库
$ gitlab-ctl start # (注意:先开启服务)
$ gitlab-ctl reconfigure # 重新生成配置

2. 10.8.7 升级到 11.11.8

接下来,准备升级到 gitlab-ce-11.11.8

1
2
3
4
5
$ apt install gitlab-ce=11.11.8-ce.0  # 清华大学的源下载这个很慢 172 kB/s 
$ gitlab-ctl reconfigure
$ gitlab-ctl restart
$ gitlab-ctl restart sidekiq
$ gitlab-ctl hup unicorn

11.11.8版本不用升级数据库就能正常访问了。

3. 预下载deb文件

吸取gitlab-ce-11.11.8版本下载太慢的教训,用迅雷(确实快)预先从【gitlab-ce/xenial】下载需要的版本

4. 11.11.8 升级到 12.0.12

1
2
3
4
5
6
$ dpkg -i gitlab-ce_12.0.12-ce.0_amd64.deb
$ gitlab-ctl reconfigure
$ gitlab-ctl restart
$ gitlab-ctl restart sidekiq
$ gitlab-ctl hup unicorn
# 能正常访问

5. 12.0.12 升级到 12.1.17

1
2
3
4
5
6
$ dpkg -i gitlab-ce_12.1.17-ce.0_amd64.deb
$ gitlab-ctl reconfigure
$ gitlab-ctl restart
$ gitlab-ctl restart sidekiq
$ gitlab-ctl hup unicorn
# 能正常访问

6. 12.1.17 升级到 12.9.5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$ dpkg -i gitlab-ce_12.9.5-ce.0_amd64
GitLab now ships with a newer version of PostgreSQL (11.7), but it is not yet
enabled by default. To upgrade, please see:
https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server
# 提示要升级PostgreSQL

$ gitlab-ctl reconfigure
Warnings:
The version of the running postgresql service is different than what is installed.
Please restart postgresql to start the new version.

sudo gitlab-ctl restart postgresql

gitlab Reconfigured!

$ gitlab-ctl restart
$ gitlab-ctl restart sidekiq
$ gitlab-ctl hup unicorn
# 502错误

# 升级PostgreSQL(https://docs.gitlab.com/omnibus/settings/database.html#gitlab-128-and-later)
$ gitlab-ctl pg-upgrade -V 11
Checking for an omnibus managed postgresql: OK
Checking if postgresql['version'] is set: OK
Checking if we already upgraded: NOT OK
Checking for a newer version of PostgreSQL to install
Upgrading PostgreSQL to 11.7
Checking if PostgreSQL bin files are symlinked to the expected location: OK
Waiting 30 seconds to ensure tasks complete before PostgreSQL upgrade.
See https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server for details
If you do not want to upgrade the PostgreSQL server at this time, enter Ctrl-C and see the documentation for details

Please hit Ctrl-C now if you want to cancel the operation.
Toggling deploy page:cp /opt/gitlab/embedded/service/gitlab-rails/public/deploy.html /opt/gitlab/embedded/service/gitlab-rails/public/index.html

Toggling services: OK
==== Upgrade has completed ====
Please verify everything is working and run the following if so
sudo rm -rf /var/opt/gitlab/postgresql/data.9.6
sudo rm -f /var/opt/gitlab/postgresql-version.old
# 可以正常访问

至此,完成了 10.4.5 -> 10.8.7 -> 11.11.8 -> 12.0.12 -> 12.1.17 -> 12.9.5 升级路径。

五、升级Ubuntu18.04

想一下还可以将系统升级到18.04,免得到时候16.04也停服了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ vim /etc/apt/sources.list.d/gitlab-ce.list
# 注释掉这个源

# 执行升级
$ do-release-upgrade
# 等待下载升级

# 升级完成重启
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-166-generic x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

System load: 1.67 Processes: 263
Usage of /: 12.6% of 116.77GB Users logged in: 0
Memory usage: 27% IP address for eth0: 192.168.0.166
Swap usage: 0%

=> There is 1 zombie process.

0 updates can be applied immediately.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

升级完重启后,Gitlab是正常的,可以访问!
查看一下当前版本。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$ gitlab-rake gitlab:env:info

System information
System: Ubuntu 18.04
Current User: git
Using RVM: no
Ruby Version: 2.6.5p114
Gem Version: 2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 5.0.7
Git Version: 2.24.3
Sidekiq Version:5.2.7
Go Version: unknown

GitLab information
Version: 12.9.5
Revision: 58afee038ec
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 11.7
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version: 12.0.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Git: /opt/gitlab/embedded/bin/git

升级后的优化

1
2
3
4
5
6
7
8
9
10
11
# 删除无用的旧包
$ apt autoremove

$ vim /etc/apt/sources.list
# 已经自动修改为18.04的源bionic
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse


# 手动修改gitlab源
$ vim /etc/apt/sources.list.d/gitlab-ce.list
# deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu bionic main

六、升级Ubuntu20.04

顺便升级到20.04

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 执行升级
$ do-release-upgrade

Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-96-generic x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

System load: 0.59 Processes: 325
Usage of /: 13.7% of 116.77GB Users logged in: 0
Memory usage: 27% IPv4 address for eth0: 192.168.0.166
Swap usage: 0%

升级完成后,出现502错误。

1
$ gitlab-ctl reconfigure

恢复正常。

查看一下信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
gitlab-rake gitlab:env:info

System information
System: Ubuntu 20.04
Current User: git
Using RVM: no
Ruby Version: 2.6.5p114
Gem Version: 2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 5.0.7
Git Version: 2.24.3
Sidekiq Version:5.2.7
Go Version: unknown

GitLab information
Version: 12.9.5
Revision: 58afee038ec
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 11.7
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version: 12.0.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Git: /opt/gitlab/embedded/bin/git