初めて環境作ったときのコマンドライン。 当時はvmwareでcentos7を立てて作ったけど、今はdockerコンテナで動いている。
インストール curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash 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 [nari@linux4ruby ~]$ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 6463 0 6463 0 0 7526 0 --:--:-- --:--:-- --:--:-- 7532[sudo] nari のパスワード: 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... 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ftp.jaist.ac.jp * epel: ftp.jaist.ac.jp * extras: ftp.jaist.ac.jp * ius: mirrors.kernel.org * updates: ftp.jaist.ac.jp gitlab_gitlab-ce-source/signature | 836 B 00:00:00 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 https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg から鍵を取得中です。 gitlab_gitlab-ce-source/signature | 951 B 00:00:00 !!! gitlab_gitlab-ce-source/primary | 175 B 00:00:01 パッケージ pygpgme-0.3-9.el7.x86_64 はインストール済みか最新バージョンです 何もしません Installing yum-utils... 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ftp.jaist.ac.jp * epel: mirrors.aliyun.com * extras: ftp.jaist.ac.jp * ius: mirrors.kernel.org * updates: ftp.jaist.ac.jp パッケージ yum-utils-1.1.31-46.el7_5.noarch はインストール済みか最新バージョンです 何もしません 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. [nari@linux4ruby ~]$ [nari@linux4ruby ~]$ sudo yum install gitlab-ce 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ftp.jaist.ac.jp * epel: ftp.jaist.ac.jp * extras: ftp.jaist.ac.jp * ius: mirrors.kernel.org * updates: ftp.jaist.ac.jp 依存性の解決をしています --> トランザクションの確認を実行しています。 ---> パッケージ gitlab-ce.x86_64 0:11.4.4-ce.0.el7 を インストール --> 依存性解決を終了しました。 依存性を解決しました ================================================================================================================================== Package アーキテクチャー バージョン リポジトリー 容量 ================================================================================================================================== インストール中: gitlab-ce x86_64 11.4.4-ce.0.el7 gitlab_gitlab-ce 435 M トランザクションの要約 ================================================================================================================================== インストール 1 パッケージ 総ダウンロード容量: 435 M インストール容量: 1.3 G Is this ok [y/d/N]: y Downloading packages: 警告: /var/cache/yum/x86_64/7/gitlab_gitlab-ce/packages/gitlab-ce-11.4.4-ce.0.el7.x86_64.rpm: ヘッダー V4 RSA/SHA1 Signature、鍵 ID f27eab47: NOKEY gitlab-ce-11.4.4-ce.0.el7.x86_64.rpm の公開鍵がインストールされていません gitlab-ce-11.4.4-ce.0.el7.x86_64.rpm | 435 MB 00:00:21 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 上記の処理を行います。よろしいでしょうか? [y/N]y 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 上記の処理を行います。よろしいでしょうか? [y/N]y Running transaction check Running transaction test Transaction test succeeded Running transaction インストール中 : gitlab-ce-11.4.4-ce.0.el7.x86_64 1/1 It looks like GitLab has not been configured yet; skipping the upgrade script. *. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ \ / /_/ / / /_/ /___/ /_/ / /_/ / \____/_/\__/_____/\__,_/_.___/ Thank you for installing GitLab! GitLab was unable to detect a valid hostname for your instance. Please configure a URL for your GitLab instance by setting `external_url` configuration in /etc/gitlab/gitlab.rb file. Then, you can start your GitLab instance by running the following command: sudo gitlab-ctl reconfigure For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md 検証中 : gitlab-ce-11.4.4-ce.0.el7.x86_64 1/1 インストール: gitlab-ce.x86_64 0:11.4.4-ce.0.el7 完了しました! [nari@linux4ruby ~]$ アクセスURLを指定 sudo cat /etc/gitlab/gitlab.rb | grep external_url 1 2 3 4 5 6 7 8 9 [nari@linux4ruby ~]$ sudo cat /etc/gitlab/gitlab.rb | grep external_url ##! For more details on configuring external_url see: #external_url 'http://gitlab.example.com' external_url 'http://192.168.1.87' # registry_external_url 'https://registry.gitlab.example.com' # pages_external_url "http://pages.example.com/" # gitlab_pages['artifacts_server_url'] = nil # Defaults to external_url + '/api/v4' # mattermost_external_url 'http://mattermost.example.com' [nari@linux4ruby ~]$ 初期設定 sudo gitlab-ctl reconfigure 1 2 3 4 5 6 7 8 9 [nari@linux4ruby ~]$ sudo gitlab-ctl reconfigure :(長いので省略) Running handlers: Running handlers complete Chef Client finished, 435/620 resources updated in 02 minutes 20 seconds gitlab Reconfigured! [nari@linux4ruby ~]$ gitのユーザ作成 groupadd gitgroup 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 [root@linux4ruby ~]# groupadd gitgroup [root@linux4ruby ~]# useradd -g gitrgoup gituser useradd: グループ 'gitrgoup' は存在しません [root@linux4ruby ~]# useradd -g gitrgoup gitusergoup gituserroup gituser [root@linux4ruby ~]# [root@linux4ruby ~]# passwd gituser ユーザー gituser のパスワードを変更。 新しいパスワード: よくないパスワード: このパスワードは 8 未満の文字列です。 新しいパスワードを再入力してください: passwd: すべての認証トークンが正しく更新できました。 [root@linux4ruby ~]# cd / [root@linux4ruby /]# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var [root@linux4ruby /]# mkdir /git/-server [root@linux4ruby /]# chown gituser:gitgroup /git-server [root@linux4ruby /]# [root@linux4ruby /]# [root@linux4ruby /]# exit ログアウト [nari@linux4ruby git]$ sudo gituser [sudo] nari のパスワード: sudo: gituser: コマンドが見つかりません [nari@linux4ruby git]$ sudo gituser sudo: gituser: コマンドが見つかりません [nari@linux4ruby git]$ su - gituser パスワード: [gituser@linux4ruby ~]$ pwd /home/gituser [gituser@linux4ruby ~]$ cd /git-server/ [gituser@linux4ruby git-server]$ ls [gituser@linux4ruby git-server]$ mkdir sample1-rep.git [gituser@linux4ruby git-server]$ ls sample1-rep.git [gituser@linux4ruby git-server]$ [gituser@linux4ruby git-server]$ [gituser@linux4ruby git-server]$ ls sample1-rep.git [gituser@linux4ruby git-server]$ cd sample1-rep.git/ [gituser@linux4ruby sample1-rep.git]$ ls [gituser@linux4ruby sample1-rep.git]$ [gituser@linux4ruby sample1-rep.git]$ [gituser@linux4ruby sample1-rep.git]$ git init --bare --shared Initialized empty shared Git repository in /git-server/sample1-rep.git/ [gituser@linux4ruby sample1-rep.git]$ ls -la 合計 16 drwxrwsr-x. 7 gituser gitgroup 119 10月 17 11:02 . drwxr-xr-x. 3 gituser gitgroup 29 10月 17 11:02 .. -rw-rw-r--. 1 gituser gitgroup 23 10月 17 11:02 HEAD drwxrwsr-x. 2 gituser gitgroup 6 10月 17 11:02 branches -rw-rw-r--. 1 gituser gitgroup 126 10月 17 11:02 config -rw-rw-r--. 1 gituser gitgroup 73 10月 17 11:02 description drwxrwsr-x. 2 gituser gitgroup 4096 10月 17 11:02 hooks drwxrwsr-x. 2 gituser gitgroup 21 10月 17 11:02 info drwxrwsr-x. 4 gituser gitgroup 30 10月 17 11:02 objects drwxrwsr-x. 4 gituser gitgroup 31 10月 17 11:02 refs [gituser@linux4ruby sample1-rep.git]$ exit ログアウト [nari@linux4ruby git]$ [nari@linux4ruby git]$