Project

General

Profile

Actions

C7InstallGitBucket

自宅PCにBitbucketをインストールしてみた記録です。

これを書いたときの各種ソフトのバージョン

OS CentOS Linux release 7.5.1810
Kernel 3.10.0-957.1.3.el7.x86_64
Apache 2.4.6
PostgreSQL 9.2.24
Gitbucket 4.30.0

sudo mkdir -p /var/lib/gitbucket
/var/lib/gitbucketにgitbucketの配布物を移動

sudo groupadd -g 555 gitbucket
sudo useradd -g gitbucket --no-user-group --home-dir /var/lib/gitbucket --no-create-home --shell /usr/sbin/nologin --system --uid 555 gitbucket
sudo chown -R gitbucket:gitbucket /var/lib/gitbucket

https://gist.github.com/tmaeda/4723371c3fd913670c52
を参考に/etc/systemd/system/gitbucket.serviceを作る

[Unit]
Description=Git hosting service

[Service]
User=gitbucket
ExecStart=/usr/bin/java -jar /var/lib/gitbucket/gitbucket.war --gitbucket.home=/var/lib/gitbucket --prefix=/gitbucket

[Install]
WantedBy=multi-user.target

sudo systemctl daemon-reload
sudo systemctl start gitbucket
sudo systemctl enable gitbucket

いったん止める
sudo systemctl stop gitbucket
sudo -u postgres createuser -P gitbucketuser
(パスワード XXXXXX)
sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O gitbucketuser gitbucketdb

cd /var/lib/gitbucket
sudo chmod 755 database.conf

db {
url = "jdbc:postgresql://localhost/gitbucketdb"
user = "gitbucketuser"
password = "XXXXXX"
}

sudo vim /var/lib/pgsql/data/pg_hba.conf
でgitbucketuserのmd5認証を追加
(そうしないと、Ident認証に失敗 という趣旨のエラーが
sudo journalctl --boot -u gitbucket.service
に出てくる

リバースプロキシの設定
sudo vim /etc/httpd/conf.d/gitbucket.conf

https://github.com/gitbucket/gitbucket/wiki/Reverse-proxy-with-Apache

sudo systemctl reload httpd

https://~/gitbucketに root/rootで入って、パスワードを変更 XXXXXX

System Administration - System settings - Base URLを変更する

Create a new repository
Initialize this repository with an empty commit

rootでなく普段の自分を system adminで追加
repositoryのsettigsでColaboratorsに自分を追加


Count of this page : 575

Updated by mole lord about 2 years ago · 3 revisions