bitbucket server(オンプレミス版)のインストール

会社でGitを使う場合、小規模であればbitbucket serverがお勧めです。
オンプレミス版で10ユーザーだと$10という破格値で買えます!
買いきりですが、サポートを付けたかったら2年目以降に$10で付けれますのでそれでも安いですよね。

bitbucket serverですが以前はStashと呼ばれていたものです。
今回はCetnOS7にインストールしてみました。
そういえばCentOS7のインストールについてもまだ記事書いていなかったなぁ・・・順番前後するけど今度に書こう!

ひとまずbitbucket server無料トライアル申込をしてインストーラーをダウンロードします。
atlassian-bitbucket-5.9.0-x64.binというファイルがダウンロードされました。
早速サーバーにアップしてインストールします。

実行権限が無いので実行権限を付けてインストール
インストールは途中で設定を聞いてくるタイプなのでここは全部デフォルトにしました。

# chmod +x atlassian-bitbucket-5.9.0-x64.bin
# ./atlassian-bitbucket-5.9.0-x64.bin

npacking JRE …
Starting Installer …

Unsupported Git version found [1.8.3.1]. Please upgrade Git to a supported
version before installing Bitbucket.
See http://go.atlassian.com/installgit for more information.
NOTE: If you proceed without a working Git, Bitbucket won’t be able to start
after installation until a working Git is found.
If you proceed without a working Git, Bitbucket won’t be able to start after installation.
Are you sure you want to continue?
Yes [y, Enter], No [n]
y
Bitbucket 5.9.0 installation wizard
Would you like to install or upgrade an instance?
Install a new instance [1, Enter], Upgrade an existing instance [2]
1
Install Bitbucket 5.9.0
What type of instance are you looking to install?
Install a Server instance [1, Enter], Install a Data Center instance [2], Install a Smart Mirroring instance [3]

Where should Bitbucket be installed?

[/opt/atlassian/bitbucket/5.9.0]

Default location for Bitbucket home directory

The location for Bitbucket data.
This will be the default location for repositories, plugins, and other data.

Ensure that this location is not used by another Bitbucket installation.
[/var/atlassian/application-data/bitbucket]

Configure which ports Bitbucket will use.

Bitbucket requires a TCP port that isn’t being used by other applications.

The HTTP port is where users access Bitbucket through their browsers.

Bitbucket also requires ports 7992 and 7993 are available to run an embedded
Elasticsearch instance that provides search functionality to Bitbucket.
HTTP Port Number
[7990]

For a production server we recommend that you run Bitbucket as a
Windows/Linux service because Bitbucket will restart automatically when the
computer restarts.
Install Bitbucket as a service?
Yes [y, Enter], No [n]
y
Please review your Bitbucket installation settings

Installation Directory: /opt/atlassian/bitbucket/5.9.0
Home Directory: /var/atlassian/application-data/bitbucket
HTTP Port: 7990
Install as a service: Yes

Install [i, Enter], Exit [e]
i
Git version 1.8.3.1 is not supported. If you proceed Bitbucket won’t be able to start after installation.
Are you sure you want to continue?
Yes [y, Enter], No [n]
y

Extracting files …
Would you like to launch Bitbucket?
Yes [y, Enter], No [n]
y

Please wait a few moments while Bitbucket starts up.
Launching Bitbucket …

Installation of Bitbucket 5.9.0 is complete
Your installation of Bitbucket 5.9.0 is now ready and can be accessed via
your browser.
Bitbucket 5.9.0 can be accessed at http://localhost:7990
Launch Bitbucket 5.9.0 in browser?
Yes [y, Enter], No [n]
Finishing installation …

とインストールは終了しましたが、最初の方でGitのversionについてエラーが出ていました。
→Git version 1.8.3.1 is not supported. If you proceed Bitbucket won’t be able to start after installation.

yumでインストールしていたものなのでyumで削除して最新のGitのソースを取得してインストールします。
# yum remove git

(2018/3/27)時点ではgit-2.16.3.tar.gzが最新です。

作業ディレクトリで解凍します。
# tar zxvf git-2.16.3.tar.gz
# cd git-2.16.3
# ./configure
# make
ここでエラーになります。
どうやらパッケージが足りないようだったのでyumでインストール
# yum install perl-ExtUtils-MakeMaker

# make

# make install

問題なくインストール完了!

# git –version
-bash: /usr/bin/git: そのようなファイルやディレクトリはありません

おや?
gitはどこに起動ファイルあるのかとログを見てみると/usr/local/binにありました。
確認してもPATHは通ってるし・・・

過去のバージョンがわるさしているのか?
原因探すのは時間がかかりそうだな・・・よしリンクで解決しよう!

根本解決ではないですが簡単ですし、何かあってもすぐに消せるし問題なし!
リンクを設定
# ln -s /usr/local/bin/git /usr/bin/git
確認
# ls -al /usr/bin/git
lrwxrwxrwx 1 root root 18 3月 26 19:06 /usr/bin/git -> /usr/local/bin/git
gitが通るか確認
# git –version
git version 2.16.3

問題ないですね。

インストール時に1.8が入ってたので一度bitbucketを再起動します。
再起動しないとずっと1.8というエラーが表示されます。

そのまんまインストールしたので起動スクリプトは下記のフォルダにあります。
/opt/atlassian/bitbucket/5.9.0/bin

停止
# stop-bitbucket.sh

起動
# start-bitbucket.sh

インストール自体はここで終わりですが内部DBを使うよりDBを別で立てたほうがいいです。
postgresqlがいいようなので久しぶりにインストールしてみますかね。

コメントする