git:gitbucket
差分
このページの2つのバージョン間の差分を表示します。
次のリビジョン | 前のリビジョン | ||
git:gitbucket [2015/05/15 01:11] – 作成 clownclown | git:gitbucket [2025/02/16 13:53] (現在) – 外部編集 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
====== gitbucket ====== | ====== gitbucket ====== | ||
+ | ===== インストール ===== | ||
+ | |||
+ | ==== tomcat ==== | ||
+ | GitBucket起動時にtomcatユーザのホームディレクトリをworkに設定するので、ディレクトリがないとエラーになります。 | ||
+ | 事前にユーザ作成を行っておくのが無難です。 | ||
< | < | ||
# useradd -s /bin/false tomcat | # useradd -s /bin/false tomcat | ||
+ | </ | ||
+ | インストール時にyum-plugin-prioritiesを要求されるので、事前にインストールします。 | ||
+ | < | ||
# yum install -y yum-plugin-priorities | # yum install -y yum-plugin-priorities | ||
+ | </ | ||
+ | 公式リポジトリを追加してtomcatをインストールします。 | ||
+ | < | ||
# rpm -Uvh http:// | # rpm -Uvh http:// | ||
# yum install -y --nogpgcheck tomcat7-webapps tomcat7-admin-webapps | # yum install -y --nogpgcheck tomcat7-webapps tomcat7-admin-webapps | ||
+ | </ | ||
+ | ==== gitbucket ==== | ||
+ | |||
+ | webappsディレクトリにgitbucket(warファイル)をDLします。 | ||
+ | |||
+ | the release page:https:// | ||
+ | < | ||
# cd / | # cd / | ||
- | # wget https:// | + | # wget https:// |
+ | </ | ||
+ | |||
+ | ==== gitbucket-gist-plugin ==== | ||
+ | |||
+ | the release page:https:// | ||
+ | |||
+ | < | ||
+ | # mkdir -p / | ||
+ | # cd / | ||
+ | # wget https:// | ||
+ | # chown -R tomcat: | ||
+ | </ | ||
+ | |||
+ | ==== configure & start ==== | ||
+ | |||
+ | apacheと連携するために、httpの8080ポートはコメントアウトして、ajpポートを8009→8089に変更します。 | ||
+ | ※ajpポートの変更は、セットアップした環境の他のサービスと重複しているため。 | ||
+ | < | ||
# cp -a / | # cp -a / | ||
# vi / | # vi / | ||
- | 70d69 | + | 92c92 |
- | < < | + | |
- | 74d72 | + | |
- | < | + | |
- | 94d91 | + | |
- | < < | + | |
- | 96,97d92 | + | |
- | < | + | |
< < | < < | ||
- | + | --- | |
- | # service tomcat7 start | + | > < |
+ | </ | ||
+ | apacheのconfファイルを作成します。 | ||
+ | < | ||
# vi / | # vi / | ||
行 30: | 行 60: | ||
ProxyPassReverse /gitbucket ajp:// | ProxyPassReverse /gitbucket ajp:// | ||
ProxyRequests Off | ProxyRequests Off | ||
+ | </ | ||
+ | サービス起動します。 | ||
+ | < | ||
+ | # service tomcat7 start | ||
# / | # / | ||
+ | </ | ||
+ | http:// | ||
+ | root / root | ||
- | http:// | + | ==== ユーザ設定 ==== |
- | root / root | + | SSHキーを作成する。 |
+ | < | ||
+ | # ssh-keygen | ||
+ | Generating public/ | ||
+ | Enter file in which to save the key (/root/ | ||
+ | Created directory '/root/ | ||
+ | Enter passphrase (empty for no passphrase): | ||
+ | Enter same passphrase again: ←何も入力せずにEnter | ||
+ | Your identification has been saved in / | ||
+ | Your public key has been saved in / | ||
+ | The key fingerprint is: | ||
+ | 15: | ||
+ | The key's randomart image is: | ||
+ | +--[ RSA 2048]----+ | ||
+ | | . .E=o . | | ||
+ | | . o =+.+ | | ||
+ | | . o .+. . | | ||
+ | | . ..= o o.| | ||
+ | | S = = o o| | ||
+ | | | ||
+ | | | | ||
+ | | | | ||
+ | | | | ||
+ | +-----------------+ | ||
+ | </ | ||
+ | 作成したSSHキーを確認する。 | ||
+ | < | ||
+ | # cat .ssh/ | ||
+ | ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAA ~省略~ cfapXHhBTa38zp50vS546sC+JB8vBXjG1Q== root@localhost.localdomain | ||
+ | </ | ||
+ | GitBucketにログインする | ||
+ | 右上のAccount Settings(人の影)をクリック | ||
+ | 左のメニューからSSH Keysをクリック | ||
+ | Add an SSH KeyのTitleは適当、Keyは作成したSSHキーを張り付ける。 | ||
+ | 以後のgitの操作はSSH接続で行う。 | ||
+ | 任意のリポジトリを開き、右の「HTTP clone URL」の項目でSSHをクリックすると、SSH接続のURLが表示されます。 | ||
+ | |||
+ | ===== Tips ===== | ||
+ | |||
+ | ==== CentOS6環境でコマンドラインからPUSHするとエラーになる ==== | ||
+ | |||
+ | http経由でGitBucketにPUSHする際、デフォルトの設定では、匿名ユーザでアクセスしようとしてエラーが発生します。 | ||
+ | < | ||
+ | [root@localhost pj]# git push | ||
+ | error: Cannot access URL http:// | ||
+ | fatal: git-http-push failed | ||
+ | </ | ||
+ | |||
+ | 設定を変更してユーザ認証を強制することで、現象の回避が可能です。 | ||
+ | |||
+ | * 現在の設定を確認< | ||
+ | # git config -l | ||
+ | ~省略~ | ||
+ | remote.origin.url=http:// | ||
+ | </ | ||
+ | * 認証ユーザの設定< | ||
+ | git config remote.origin.url http:// | ||
+ | </ | ||
+ | * push< | ||
+ | # git push | ||
+ | Password: userのパスワード | ||
+ | Counting objects: 5, done. | ||
+ | Writing objects: 100% (3/3), 243 bytes, done. | ||
+ | Total 3 (delta 0), reused 0 (delta 0) | ||
+ | remote: Updating references: 100% (1/1) | ||
+ | To http:// | ||
+ | | ||
+ | Edit | ||
+ | </ | ||
+ | |||
+ | ==== バックアップ ==== | ||
+ | ユーザ直下の.gitbucketディレクトリを丸ごと保存。 | ||
+ | < | ||
+ | # tar zcf / | ||
+ | </ | ||
+ | 必要なときに展開して設置。 | ||
+ | < | ||
+ | # tar zxvf / | ||
+ | </ | ||
+ | jenkinsに定義して自動バックアップする。 | ||
+ | |||
+ | * jenkinsユーザにsudo権限付与(設定しないと、/ | ||
+ | # visudo | ||
+ | |||
+ | コメントアウト | ||
+ | # | ||
+ | |||
+ | 追加 | ||
+ | jenkins ALL=(ALL) | ||
+ | </ | ||
+ | * jennkinsの「シェルの実行」に定義< | ||
+ | sudo tar zcf / | ||
+ | </ | ||
+ | |||
+ | ==== リストア ==== | ||
+ | 適当な場所で解凍して、オリジナルの場所に設置・上書きします。 | ||
+ | < | ||
+ | # mkdir / | ||
+ | # chmod 777 / | ||
+ | # cd / | ||
+ | |||
+ | [_backup]# tar xzvf gitbucket-20150608093100.tar.gz | ||
+ | |||
+ | [_backup]# / | ||
+ | [_backup]# \cp -ar / | ||
+ | [_backup]# / | ||
+ | [_backup]# / | ||
+ | </ | ||
+ | |||
+ | ==== バージョンアップ ==== | ||
+ | https:// | ||
+ | < | ||
+ | # wget -O gitbucket.war https:// | ||
+ | |||
+ | # / | ||
+ | |||
+ | # mkdir -p / | ||
+ | # tar zcf / | ||
+ | # tar zcf / | ||
+ | # cp / | ||
+ | |||
+ | # rm -f / | ||
+ | # rm -rf / | ||
+ | # rm -rf / | ||
+ | # cp ./ | ||
+ | |||
+ | # / | ||
+ | # / | ||
</ | </ |
git/gitbucket.1431652277.txt.gz · 最終更新: 2025/02/16 13:50 (外部編集)