ギャバンITサービス
お菓子の家が作れるシステムエンジニアです

gitlabのインストール

初めて環境作ったときのコマンドライン。 当時は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]$

 ⭐️

linuxの基礎

忘れそうなコマンド類のメモ。 crontabで定期実行する例 指定は分、時、日、月、曜日を指定。 毎日11:00にとあるシェルを動かす場合 00 11 * * * /bin/sh /gvis/script/hogehoge.sh 1月15日と6月15日の11:00にとあるシェルを動かす場合 00 11 15 1,6 * /bin/sh /gvis/script/hogehoge.sh 毎週月曜から金曜の11:00にとあるシェルを動かす場合 00 11 * * 1-5 /bin/sh /gvis/script/hogehoge.sh 5分おきにとあるシェルを動かす場合 */5 * * * * /bin/sh /gvis/script/hogehoge.sh crontabのコマンドライン crontabの登録内容をテキストに書き出して保存。 crontab -l > res.txt テキストからcrontab登録。 crontab ./res.txt ほとんど使わないけど、crontabの直接編集。 オッサンはnanoじゃなくviに慣れてるので、いったんテキストファイルをviで編集してからでないと登録しない。 crontab -e 変更前と変更後を維持したいから、直接編集は使わない。 業務利用だったら、diffで比較して差分が必要な箇所だけになってることを確認するのも理由。 ローカルlinuxのcrontab 実際のrootのcrontab設定。 シェルは間違って動くと困るものもあるので、実行権はつけてない。 (dockerのエンジン停止とか困る) 代わりに/bin/shで呼び出す。 ちゃんと書けば、書いておいたタイミングで確実に動いてくれる。 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 #daily shutdown 59 23 * * * /bin/sh /gvis/script/901_OSstop.sh > /dev/null 59 11 * * 1-5 /bin/sh /gvis/script/901_OSstop.sh > /dev/null #Timely procdure 00,10,20,30,40,50 * * * * sync 01,11,21,31,41,51 0-23 * * * /bin/sh /gvis/script/903_ping_kanshi.sh 172.16.17.15 Yamaha_rtx1210 > /dev/null 05,15,25,35,45,55 0-23 * * * /bin/sh /gvis/script/802_CHKdiskStat.sh > /dev/null 06,16,26,36,46,56 6-21 * * * /bin/sh /gvis/script/803_CHKonlchkStat.sh > /dev/null 07,17,27,37,47,57 0-23 * * * /bin/sh /gvis/script/804_CHKsyslogStat.sh > /dev/null 09,19,29,39,49,59 6-23 * * * /bin/sh /gvis/script/805_CHKgavann-it.sh > /dev/null ### */2 0-23 * * * /bin/sh /gvis/script/808_CHKnetlogStat.sh > /dev/null */2 0-23 * * * /bin/sh /gvis/script/808_CHKnetlogStat2.sh > /dev/null #monthly GoogleDrive every Weekday 30 9 * * 1-5 /bin/sh /gvis/script/gdr/003_SyncNari.sh > /dev/null #daily Report 11 5 * * * /bin/sh /gvis/script/801_daily_report.sh > /dev/null 11 10 * * * /bin/sh /gvis/script/801_daily_report.sh > /dev/null #daily rm 00 7 * * * /bin/find /gvis/ -name ".*DS_Store" -print -exec rm {} ";" 01 7 * * * /bin/find /gvis/ -name "Thumbs.db" -print -exec rm {} ";" 02 7 * * * /bin/find /nari/ -name ".*DS_Store" -print -exec rm {} ";" 03 7 * * * /bin/find /nari/ -name "Thumbs.db" -print -exec rm {} ";" fsckしてからマウント ディスクの不整合を整えてマウントする。 ...

Dockerでサービス設定

systemctlのdocker.serviceファイル 何が正解かを見つけるのは道半ば。自信のない個所や試せてない箇所も多い。 設定ファイルはsystemctlで確認できる。 /lib/systemd/system/docker.serviceって書いてある。 1 2 3 4 5 # systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled) : (省略) 書き換えたら、必ず実行必要。でもいつも忘れる。 # systemctl daemon-reload Dockerでサービス停止するときにsocketのメッセージ docker利用環境をcent8からubuntu20に引っ越した頃、systemctlでサービス停止するときに「ソケットまだ生きてんでー」みたいなメッセージが出るようになった。 Warning: Stopping docker.service, but it can still be activated by: docker.socket とりあえずコンフィグレーションコメント化。 修正前)Requires=docker.socket containerd.service 修正後)# Requires=docker.socket containerd.service あとは"-H fd://“を外す。 ...

gavann-it.comのサイト応答がない

サイトをwgetで定期監視してるメールが来た時のサイト状態

GCP clougloggingのメモ

【バケットの作成】 gcloud beta logging buckets create gvisLogging –location global –description “GVIS log bucket” 参考URL https://cloud.google.com/logging/docs/buckets?hl=ja 【ログルータ】 参考URL https://cloud.google.com/logging/docs/routing/overview?hl=ja 【ログシンク】 LOG_ID(“cloudaudit.googleapis.com/activity”) OR LOG_ID(“externalaudit.googleapis.com/activity”) OR LOG_ID(“cloudaudit.googleapis.com/system_event”) OR LOG_ID(“externalaudit.googleapis.com/system_event”) OR LOG_ID(“cloudaudit.googleapis.com/access_transparency”) OR LOG_ID(“externalaudit.googleapis.com/access_transparency”) NOT LOG_ID(“cloudaudit.googleapis.com/activity”) AND NOT LOG_ID(“externalaudit.googleapis.com/activity”) AND NOT LOG_ID(“cloudaudit.googleapis.com/system_event”) AND NOT LOG_ID(“externalaudit.googleapis.com/system_event”) AND NOT LOG_ID(“cloudaudit.googleapis.com/access_transparency”) AND NOT LOG_ID(“externalaudit.googleapis.com/access_transparency”) ※方針変えたので途中で作るのやめ