Technology Engineering

178inaba の技術ブログ

Raspberry Piでいろいろ。【その3 -> GitLabインストール】

inabaです。

前回

inaba.hatenablog.com

今日はGitLabをインストールしていきます。

やること

  • SSH接続 OK
  • 起動ドライブをHDDにする OK
  • 無線でつなぐ OK
  • Swap領域設定 OK
  • パスワード変更 OK
  • パッケージ更新 OK
  • GitLabインストール

GitLabインストール

基本的に下記を参考にインストールしていきます。

about.gitlab.com

1. Install and configure the necessary dependencies

必要なパッケージをインストールしていきます。

$ sudo apt-get install curl openssh-server ca-certificates postfix apt-transport-https
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ca-certificates is already the newest version.
curl is already the newest version.
openssh-server is already the newest version.
openssh-server set to manually installed.
The following extra packages will be installed:
  libcurl3-gnutls ssl-cert
Suggested packages:
  procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin dovecot-common postfix-cdb mail-reader ufw postfix-doc openssl-blacklist
The following NEW packages will be installed:
  apt-transport-https libcurl3-gnutls postfix ssl-cert
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,673 kB of archives.
After this operation, 3,845 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libcurl3-gnutls armhf 7.38.0-4+deb8u5 [225 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main apt-transport-https armhf 1.0.9.8.3 [134 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main ssl-cert all 1.0.35 [20.9 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main postfix armhf 2.11.3-1 [1,293 kB]                                                                                 
Fetched 1,673 kB in 9s (185 kB/s)                                                                                                                                                
Preconfiguring packages ...
Selecting previously unselected package libcurl3-gnutls:armhf.
(Reading database ... 31272 files and directories currently installed.)
Preparing to unpack .../libcurl3-gnutls_7.38.0-4+deb8u5_armhf.deb ...
Unpacking libcurl3-gnutls:armhf (7.38.0-4+deb8u5) ...
Selecting previously unselected package apt-transport-https.
Preparing to unpack .../apt-transport-https_1.0.9.8.3_armhf.deb ...
Unpacking apt-transport-https (1.0.9.8.3) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../ssl-cert_1.0.35_all.deb ...
Unpacking ssl-cert (1.0.35) ...
Selecting previously unselected package postfix.
Preparing to unpack .../postfix_2.11.3-1_armhf.deb ...
Unpacking postfix (2.11.3-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (215-17+deb8u5) ...
Setting up libcurl3-gnutls:armhf (7.38.0-4+deb8u5) ...
Setting up apt-transport-https (1.0.9.8.3) ...
Setting up ssl-cert (1.0.35) ...
Setting up postfix (2.11.3-1) ...
Adding group `postfix' (GID 115) ...
Done.
Adding system user `postfix' (UID 109) ...
Adding new user `postfix' (UID 109) with group `postfix' ...
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding sqlite map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (GID 116) ...
Done.
setting myhostname: raspberrypi
setting alias maps
setting alias database
changing /etc/mailname to gitlab.raspberrypi.local
setting myorigin
setting destinations: gitlab.raspberrypi.local, raspberrypi, localhost.localdomain, localhost
setting relayhost: 
setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
/etc/aliases does not exist, creating it.
WARNING: /etc/aliases exists, but does not have a root alias.

Postfix is now set up with a default configuration.  If you need to make 
changes, edit
/etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
Processing triggers for libc-bin (2.19-18+deb8u6) ...
Processing triggers for systemd (215-17+deb8u5) ...

途中、Postfix設定のため、こんな画面が出てきます。

f:id:i178inaba:20161214004424p:plain

ここは下記を参考にSMTPを使用するInternet Siteを選択。

docs.gitlab.com

f:id:i178inaba:20161214004429p:plain

上記はドメイン名を設定する画面です。
適当にgitlab.raspberrypi.localと設定しました。
間違っても後で変えられると思います。

$ curl https://packages.gitlab.com/gpg.key | sudo apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1703  100  1703    0     0   1850      0 --:--:-- --:--:-- --:--:--  1849
OK

2. Add the GitLab package server and install the package

GitLabのパッケージサーバを追加してGitLabをインストールします。

$ sudo curl -sS https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | sudo bash
Detected operating system as raspbian/jessie.
Checking for curl...
Detected curl...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/gitlab_raspberry-pi2.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.

The repository is setup! You can now install packages.

$ sudo apt-get install gitlab-ce
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  gitlab-ce
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 263 MB of archives.
After this operation, 724 MB of additional disk space will be used.
Get:1 https://packages.gitlab.com/gitlab/raspberry-pi2/raspbian/ jessie/main gitlab-ce armhf 8.7.9+20160704103025-ce.1 [263 MB]
Fetched 263 MB in 2min 39s (1,653 kB/s)                                                                                                                                          
Selecting previously unselected package gitlab-ce.
(Reading database ... 31486 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_8.7.9+20160704103025-ce.1_armhf.deb ...
Unpacking gitlab-ce (8.7.9+20160704103025-ce.1) ...
Setting up gitlab-ce (8.7.9+20160704103025-ce.1) ...
gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://raspberrypi
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab: 
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab: 
It looks like GitLab has not been configured yet; skipping the upgrade script.

3. Configure and start GitLab

GitLabのconfigureをします。

$ sudo gitlab-ctl reconfigure
# 長いので出力は割愛。

下記にアクセスするとGitLabの画面が出ます。

http://raspberrypi.local/

下記画面でrootのパスワードを設定します。

f:id:i178inaba:20161214012746p:plain f:id:i178inaba:20161214013437p:plain

  • Username: root
  • Password: 先程設定したパスワード

でログイン。

f:id:i178inaba:20161214013325p:plain

ログインできました!

細かい設定等はあるかもしれませんがとりあえずGitLabのインストールという目標は達成しました。
今後はバックアップ設定とかしたいですね。
お疲れ様でした。