git:gitbucket
文書の過去の版を表示しています。
gitbucket
インストール
tomcat
GitBucket起動時にtomcatユーザのホームディレクトリをworkに設定するので、ディレクトリがないとエラーになります。 事前にユーザ作成を行っておくのが無難です。
# useradd -s /bin/false tomcat
インストール時にyum-plugin-prioritiesを要求されるので、事前にインストールします。
# yum install -y yum-plugin-priorities
公式リポジトリを追加してtomcatをインストールします。
# rpm -Uvh http://mirrors.dotsrc.org/jpackage/6.0/generic/free/RPMS/jpackage-release-6-3.jpp6.noarch.rpm # yum install -y --nogpgcheck tomcat7-webapps tomcat7-admin-webapps
gitbucket
webappsディレクトリにgitbucket(warファイル)をDLします。
# cd /var/lib/tomcat7/webapps/ # wget https://github.com/takezoe/gitbucket/releases/download/3.2/gitbucket.war
apacheと連携するために、httpの8080ポートはコメントアウトして、ajpポートを8009→8089に変更します。 ※ajpポートの変更は、セットアップした環境の他のサービスと重複しているため。
# cp -a /etc/tomcat7/server.xml /etc/tomcat7/server.xml.bk # vi /etc/tomcat7/server.xml 70d69 < <!-- 74d72 < --> 94d91 < <!-- 96,97d92 < --> < <Connector port="8089" protocol="AJP/1.3" redirectPort="8443" />
apacheのconfファイルを作成します。
# vi /etc/httpd/conf.d/gitbucket.conf ProxyPass /gitbucket ajp://localhost:8089/gitbucket ProxyPassReverse /gitbucket ajp://localhost:8089/gitbucket ProxyRequests Off
サービス起動します。
# service tomcat7 start # /etc/init.d/httpd restart
http://SERVER/gitbucket/ root / root
Tips
CentOS6環境でコマンドラインからPUSHするとエラーになる
http経由でGitBucketにPUSHする際、デフォルトの設定では、匿名ユーザでアクセスしようとしてエラーが発生します。
[root@localhost pj]# git push error: Cannot access URL http://192.168.56.14/gitbucket/git/user/pj.git/, return code 22 fatal: git-http-push failed
設定を変更してユーザ認証を強制することで、現象の回避が可能です。
- 現在の設定を確認
# git config -l ~省略~ remote.origin.url=http://192.168.56.14/gitbucket/git/user/pj.git
- 認証ユーザの設定
git config remote.origin.url http://user@192.168.56.14/gitbucket/git/user/pj.git
- 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://user@192.168.56.14/gitbucket/git/user/pj.git 6282168..78800c3 master -> master Edit
バックアップ
ユーザ直下の.gitbucketディレクトリを丸ごと保存。
# tar zcf /home/tomcat/gitbucket-`date +%Y-%m-%d`.tar.gz /home/tomcat/.gitbucket
必要なときに展開して設置。
# tar zxvf /home/tomcat/gitbucket-2015-05-15.tar.gz
jenkinsに定義して自動バックアップする。
- jenkinsユーザにsudo権限付与(設定しないと、/home/tomcat/配下にアクセスできないのでエラーになる)
# visudo コメントアウト #Defaults requiretty 追加 jenkins ALL=(ALL) NOPASSWD: /bin/ls, /bin/tar
- jennkinsの「シェルの実行」に定義
sudo tar zcf /var/backup/gitbucket-`date +%Y%m%d%H%M%S`.tar.gz /home/tomcat/.gitbucket
git/gitbucket.1431929527.txt.gz · 最終更新: 2025/02/16 13:50 (外部編集)