先日さくらのクラウドに「GitLab Community Edition」をインストールするためのスタートアップスクリプトが追加されました。
さくらのクラウドニュース:スタートアップスクリプト「GitLab Community Edition」の提供を開始しました
このスクリプトを用いてGitLab環境を構築してみます。
前提条件
- さくらのクラウドのアカウントが作成済みであること
まだの場合は以下のリンクを参考にアカウントの作成を行ってください。
GitLabインストール済みのサーバ作成
さくらのクラウド コントロールパネルへログイン
まずはコントロールパネルにログインします。
サーバ作成画面を開く
ログインできたらサーバ作成画面まで移動します。
- サービス選択画面で「IaaS」を選択
- 左上のゾーン選択ボタンから「SandBox」以外のゾーンを選択
- 左のメニューから「サーバ」を選択後、右上の「追加」ボタンをクリック
サーバ作成画面
もし「シンプルモード」チェックボックスがチェックされている場合はチェックを外します。
-
- サーバプラン
CPUコア数/メモリサイズを選択します。
後から変更することも可能ですのでお好みの値を選択してください。
-
- ディスク
新規ディスクを作成し、そこにCentOS7.3をインストールします。
ディスクソースに「アーカイブ」を選択した上で、アーカイブ選択欄で「CentOS7.3」を選択してください。
ディスクプランやディスクサイズについてはお好みでOKです。
-
- NIC
デフォルトでインターネットに接続するようになっているはずです。
ここは変更しなくてOKです。
-
- ディスクの修正
パスワードとホスト名を設定します。
公開鍵は「なし」でも良いですが、本番稼働させるサーバの場合は設定しておくのがオススメです。
- スタートアップスクリプトの選択
スタートアップスクリプト欄で「shell」を選択すると、配置するスタートアップスクリプトの選択が行えるようになります。
ドロップダウンからGitLabを選択します。
その後、GitLab管理者(rootユーザ)の初期パスワード入力欄が表示されますので、任意の値を設定します。
-
- シンプル監視 & 6. サーバの情報
シンプル監視は設定なしでもOKです。必要に応じて設定してください。
サーバの情報欄には名前やタグ、説明などを入力します。必要に応じて設定してください。
※ここで入力する名前はさくらのクラウド上でのサーバの表示名のようなものです。
日本語も使えますのでわかりやすい名前にしておくのがオススメです。
-
- その他のオプションなど
変更しなくてOKです。作成数は1のままにしてください。
あとは右下の「作成」ボタンを押すだけです。
サーバ作成が完了するまでしばらく待ちましょう。
[TIPS]: スタートアップスクリプトの実行ログ確認
あとはしばらく待つだけでスタートアップスクリプトによりGitLabのインストール&環境設定が行われます。
このスタートアップのログは作成されたサーバ内の以下のファイルに出力されています。
/root/.sacloud-api/notes/[12桁の数値].log
12桁の数値はサーバ作成時にランダムで割り当てられるものです。
インストールがうまくいかない場合などは上記のログを参照してみましょう。
なお、今回利用しているGitLabのスタートアップスクリプトでは以下のようなログが出力されるはずです。
-------------------------------------------------- Sat Aug 26 18:46:40 JST 2017
Loaded plugins: fastestmirror, priorities
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
Package curl-7.29.0-35.el7.centos.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package openssh-clients.x86_64 0:6.6.1p1-31.el7 will be updated
---> Package openssh-clients.x86_64 0:6.6.1p1-35.el7_3 will be an update
--> Processing Dependency: openssh = 6.6.1p1-35.el7_3 for package: openssh-clients-6.6.1p1-35.el7_3.x86_64
---> Package openssh-server.x86_64 0:6.6.1p1-31.el7 will be updated
---> Package openssh-server.x86_64 0:6.6.1p1-35.el7_3 will be an update
---> Package policycoreutils.x86_64 0:2.5-9.el7 will be updated
---> Package policycoreutils.x86_64 0:2.5-11.el7_3 will be an update
--> Running transaction check
---> Package openssh.x86_64 0:6.6.1p1-31.el7 will be updated
---> Package openssh.x86_64 0:6.6.1p1-35.el7_3 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
openssh-clients x86_64 6.6.1p1-35.el7_3 updates 642 k
openssh-server x86_64 6.6.1p1-35.el7_3 updates 440 k
policycoreutils x86_64 2.5-11.el7_3 updates 841 k
Updating for dependencies:
openssh x86_64 6.6.1p1-35.el7_3 updates 438 k
Transaction Summary
================================================================================
Upgrade 3 Packages (+1 Dependent package)
Total download size: 2.3 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
--------------------------------------------------------------------------------
Total 6.0 MB/s | 2.3 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : openssh-6.6.1p1-35.el7_3.x86_64 1/8
Updating : openssh-clients-6.6.1p1-35.el7_3.x86_64 2/8
Updating : openssh-server-6.6.1p1-35.el7_3.x86_64 3/8
Updating : policycoreutils-2.5-11.el7_3.x86_64 4/8
Cleanup : openssh-server-6.6.1p1-31.el7.x86_64 5/8
Cleanup : openssh-clients-6.6.1p1-31.el7.x86_64 6/8
Cleanup : openssh-6.6.1p1-31.el7.x86_64 7/8
Cleanup : policycoreutils-2.5-9.el7.x86_64 8/8
Verifying : openssh-6.6.1p1-35.el7_3.x86_64 1/8
Verifying : policycoreutils-2.5-11.el7_3.x86_64 2/8
Verifying : openssh-clients-6.6.1p1-35.el7_3.x86_64 3/8
Verifying : openssh-server-6.6.1p1-35.el7_3.x86_64 4/8
Verifying : openssh-6.6.1p1-31.el7.x86_64 5/8
Verifying : policycoreutils-2.5-9.el7.x86_64 6/8
Verifying : openssh-server-6.6.1p1-31.el7.x86_64 7/8
Verifying : openssh-clients-6.6.1p1-31.el7.x86_64 8/8
Updated:
openssh-clients.x86_64 0:6.6.1p1-35.el7_3
openssh-server.x86_64 0:6.6.1p1-35.el7_3
policycoreutils.x86_64 0:2.5-11.el7_3
Dependency Updated:
openssh.x86_64 0:6.6.1p1-35.el7_3
Complete!
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
Package 2:postfix-2.10.1-6.el7.x86_64 already installed and latest version
Nothing to do
success
success
Detected operating system as centos/7.
Checking for curl...
Detected curl...
Downloading repository file: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.repo?os=centos&dist=7&source=script
done.
Installing pygpgme to verify GPG signatures...
Loaded plugins: fastestmirror, priorities
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Importing GPG key 0xE15E78F4:
Userid : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
Fingerprint: 1a4c 919d b987 d435 9396 38b9 1421 9a96 e15e 78f4
From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
Loading mirror speeds from cached hostfile
Package pygpgme-0.3-9.el7.x86_64 already installed and latest version
Nothing to do
Installing yum-utils...
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-40.el7 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-40.el7.noarch
--> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-40.el7.noarch
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.9.1-6.el7_2.3 will be installed
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
--> Running transaction check
---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
yum-utils noarch 1.1.31-40.el7 base 116 k
Installing for dependencies:
libxml2-python x86_64 2.9.1-6.el7_2.3 base 247 k
python-chardet noarch 2.2.1-1.el7_1 base 227 k
python-kitchen noarch 1.1.1-5.el7 base 267 k
Transaction Summary
================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 856 k
Installed size: 4.3 M
Downloading packages:
--------------------------------------------------------------------------------
Total 2.7 MB/s | 856 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-chardet-2.2.1-1.el7_1.noarch 1/4
Installing : python-kitchen-1.1.1-5.el7.noarch 2/4
Installing : libxml2-python-2.9.1-6.el7_2.3.x86_64 3/4
Installing : yum-utils-1.1.31-40.el7.noarch 4/4
Verifying : yum-utils-1.1.31-40.el7.noarch 1/4
Verifying : python-kitchen-1.1.1-5.el7.noarch 2/4
Verifying : libxml2-python-2.9.1-6.el7_2.3.x86_64 3/4
Verifying : python-chardet-2.2.1-1.el7_1.noarch 4/4
Installed:
yum-utils.noarch 0:1.1.31-40.el7
Dependency Installed:
libxml2-python.x86_64 0:2.9.1-6.el7_2.3 python-chardet.noarch 0:2.2.1-1.el7_1
python-kitchen.noarch 0:1.1.1-5.el7
Complete!
Generating yum cache for gitlab_gitlab-ce...
Importing GPG key 0xE15E78F4:
Userid : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
Fingerprint: 1a4c 919d b987 d435 9396 38b9 1421 9a96 e15e 78f4
From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
The repository is setup! You can now install packages.
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package gitlab-ce.x86_64 0:9.5.1-ce.0.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
gitlab-ce x86_64 9.5.1-ce.0.el7 gitlab_gitlab-ce 378 M
Transaction Summary
================================================================================
Install 1 Package
Total download size: 378 M
Installed size: 1.1 G
Downloading packages:
warning: /var/cache/yum/x86_64/7/gitlab_gitlab-ce/packages/gitlab-ce-9.5.1-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Public key for gitlab-ce-9.5.1-ce.0.el7.x86_64.rpm is not installed
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Importing GPG key 0xE15E78F4:
Userid : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
Fingerprint: 1a4c 919d b987 d435 9396 38b9 1421 9a96 e15e 78f4
From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
Importing GPG key 0xF27EAB47:
Userid : "GitLab, Inc. <support@gitlab.com>"
Fingerprint: dbef 8977 4ddb 9eb3 7d9f c3a0 3cfc f9ba f27e ab47
From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gitlab-ce-9.5.1-ce.0.el7.x86_64 1/1
tput: No value for $TERM and no -T specified
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
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://GitLab
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.
Verifying : gitlab-ce-9.5.1-ce.0.el7.x86_64 1/1
Installed:
gitlab-ce.x86_64 0:9.5.1-ce.0.el7
Complete!
* Moving existing certificates found in /opt/gitlab/embedded/ssl/certs
* Symlinking existing certificates found in /etc/gitlab/trusted-certs
gitlab Reconfigured!
(exit code: 0)
最後に(exit code: 0)と出力されていればスタートアップスクリプトが正常終了しています。
GitLabにサインイン
ブラウザでGitLabにサインインしてみます。
http://サーバのIPアドレス/にアクセスしてみましょう。
- サーバのIPアドレスの確認
サーバのIPアドレスはコントロールパネルから確認できます。
- サインイン画面
続いてhttp://サーバのIPアドレス/を開きます。
ユーザ名にroot、パスワードにはサーバ作成時に指定した値を入力します。
サインインできたら次のような画面が表示されるはずです。
おめでとうございます!!以上でサーバ構築完了です。
あとはGitLabをガンガン使ってみましょう!!!
なお、このスクリプトでは以下の設定は行われていません。
- SSL対応
- メールの設定
必要に応じて設定してみてください。
以上です。














