Install GitLab-Runner in Ubuntu 19.04 and 19.10

In Ubuntu 19.04 and 19.10, the GitLab Runner installer doesn't work completely. After installed by apt, you often have to do the post-installation process manually, running /usr/lib/gitlab-runner/mk-prebuilt-images.sh to build some Docker image, but fail at this step.

Here are step you need to do, to successfully build that Docker image (assumed that you already installed Docker).

First, find a Debian repository mirror near to you. I'm in Viet Nam, so the mirror I chose is http://opensource.xtdv.net/debian/.

Second, open file for editing, find these lines:

cdebootstrap -v \
    --flavour=minimal \
    --exclude="dmsetup,systemd-sysv,systemd,udev" \
    --include="bash,ca-certificates,git,netcat-traditional" \
    stable ./debian-minbase \

and add that mirror URL after "./debian-minbase". It becomes:

cdebootstrap -v \
    --flavour=minimal \
    --exclude="dmsetup,systemd-sysv,systemd,udev" \
    --include="bash,ca-certificates,git,netcat-traditional" \
    stable ./debian-minbase http://opensource.xtdv.net/debian/ \

Third, download the latest version of the two packages libdebian-installer-extra4, libdebian-installer4 from Debian repository. For example, at the time of my writing, those files can be found in the XTDV mirror at:

http://opensource.xtdv.net/debian/pool/main/libd/libdebian-installer/libdebian-installer4_0.120_amd64.deb

http://opensource.xtdv.net/debian/pool/main/libd/libdebian-installer/libdebian-installer-extra4_0.120_amd64.deb

We will install those *.deb files with dpkg -i command.

Here are the commands to do it quickly (copy/paste):

$ cd /tmp/
$ wget http://opensource.xtdv.net/debian/pool/main/libd/libdebian-installer/libdebian-installer4_0.120_amd64.deb
$ wget http://opensource.xtdv.net/debian/pool/main/libd/libdebian-installer/libdebian-installer-extra4_0.120_amd64.deb
$ sudo dpkg -i *.deb

After that, we run the GitLab's mk-prebuilt-images.sh script again. Now it is successful:

$ sudo /usr/lib/gitlab-runner/mk-prebuilt-images.sh
I: Generating GitLab Runner Docker image. This may take a while...
I: cdebootstrap; saving build log to /var/cache/gitlab-runner/cdebootstrap.log /
  100 %        53,3 MiB / 197,4 MiB = 0,270   6,9 MiB/s       0:28             
'/usr/bin/gitlab-runner-helper' -> './gitlab-runner-helper'
'/usr/lib/gitlab-runner/gitlab-runner-build' -> './gitlab-runner-build'
'/usr/lib/gitlab-runner/gitlab-runner-cache' -> './gitlab-runner-cache'
'/usr/lib/gitlab-runner/gitlab-runner-service' -> './gitlab-runner-service'
'/usr/lib/gitlab-runner/Dockerfile' -> './Dockerfile'
Sending build context to Docker daemon  65.29MB daemon  557.1kB
Step 1/3 : FROM scratch
 ---> 
Step 2/3 : ADD stable.tar.xz /
 ---> 8770ce53ba90
Step 3/3 : COPY gitlab* /usr/bin/
 ---> 16eb39566cb1
Successfully built 16eb39566cb1
Successfully tagged gitlab-runner-helper:11.2.0
I: Packing image into /var/lib/gitlab-runner/gitlab-runner-helper.tar.xz
c73d4848c4fff6c68559f3bcf6afd3e0338a7be078226a9cefb8562635ad5831
  100 %        46,2 MiB / 206,3 MiB = 0,224   2,0 MiB/s       1:41             
gitlab-runner-helper-11.2.0
Untagged: gitlab-runner-helper:11.2.0
Deleted: sha256:16eb39566cb1a7831f65022eb279825da5369c2410e9fff5af2a3e90a187f95c
Deleted: sha256:a6fc8fe2e360618e6f9562efc8be9d69ab9abf0fdd0a0299463f8651cc9c4da3
Deleted: sha256:8770ce53ba90689c94d61f2543f7a375c05678d48986c1ced354f3de074b6d93
Deleted: sha256:7b9a74a902cafe5ee188d074c8010e9c66a895f4f06deb9b05d1c79a79f6caf3
Website này sử dụng Disqus cho comment. Nếu bạn không thấy các comment dưới đây, có lẽ Disqus đang bị chặn. Bạn cần đổi DNS.
comments powered by Disqus