コンテンツにスキップ

「Greyhole」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
ページの作成:「Category:ストレージ en:Greyhole {{Related articles start}} {{Related|Samba}} {{Related articles end}} [http://www.greyhole.net/ Greyhole] は Samba を...」
 
アーカイブ
タグ: 新規リダイレクト
 
(他の1人の利用者による、間の2版が非表示)
1行目: 1行目:
#redirect [[ArchWiki:アーカイブ]]
[[Category:ストレージ]]
[[Category:アーカイブ]]
[[en:Greyhole]]
{{Related articles start}}
{{Related|Samba}}
{{Related articles end}}

[http://www.greyhole.net/ Greyhole] は [[Samba]] を使用してハードドライブを全て集めたストレージプールを作成するアプリケーションです。保存したファイルの冗長コピーを作成することもでき、ハードドライブが故障したときにデータが消失するのを防げます。

==インストール==
===AUR===
[[Arch User Repository]] から {{AUR|greyhole}} パッケージをインストールしてください。

===手動===
1. 必要なパッケージを[[インストール]]: {{Pkg|mysql}}, {{Pkg|php}}, {{Pkg|php-pear}}, {{Pkg|samba}}, {{Pkg|base-devel}}, {{Pkg|rsync}}, {{Pkg|postfix}}。

2. [http://www.greyhole.net/download/ こちら] から最新のソースパッケージをダウンロード。

3. Greyhole のファイルを展開:

# tar zxvf greyhole-*.tar.gz
# cd greyhole-*
# GREYHOLE_INSTALL_DIR=`pwd`

4. Greyhole 用に作業ディレクトリを作成:

# mkdir -p /var/spool/greyhole
# chmod 777 /var/spool/greyhole

5. Greyhole のファイルをインストール:
{{bc|
# install -m 0755 -D -p greyhole /usr/bin
# install -m 0755 -D -p greyhole-dfree /usr/bin
# install -m 0750 -D -p greyhole-config-update /usr/bin
# install -m 0644 -D -p logrotate.greyhole /etc/logrotate.d/greyhole
# install -m 0644 -D -p greyhole.cron.d /etc/cron.d/greyhole
# install -m 0644 -D -p greyhole.example.conf /etc/greyhole.conf
# install -m 0755 -D -p greyhole.cron.weekly /etc/cron.weekly/greyhole
# install -m 0755 -D -p greyhole.cron.daily /etc/cron.daily/greyhole
}}

6. php-pear に必要なファイルがアーカイブに入っていないので GitHub からダウンロードして適切な場所に移動:
{{bc|<nowiki>
# wget https://raw.github.com/gboudreau/Greyhole/master/includes/common.php
# wget https://raw.github.com/gboudreau/Greyhole/master/includes/sql.php
# include_path=`php -i | grep include_path | awk -F':' '{print $NF}'`
# mkdir "$include_path/includes"
# install -m 0644 -D -p includes/common.php "$include_path/includes"
# install -m 0644 -D -p includes/sql.php "$include_path/includes"
</nowiki>}}
{{ic|include_path}} を設定する際に PHP がタイムゾーンに関してエラーを吐く場合は {{ic|/etc/php/php.ini}} ファイルにタイムゾーンを設定してください。

7. Samba の VFS モジュールをインストール:
まずは使用している Samba のバージョンを確認:
# smbd --version
Samba 3.4 の場合:
{{bc|
# if [ -x /usr/lib64/samba/vfs/ ]; then cp samba-module/bin/greyhole-x86_64.so /usr/lib64/samba/vfs/greyhole.so; else cp samba-module/bin/greyhole-i386.so /usr/lib/samba/vfs/greyhole.so; fi
}}
Samba 3.5 の場合:
{{bc|
# if [ -x /usr/lib64/samba/vfs/ ]; then cp samba-module/bin/3.5/greyhole-x86_64.so /usr/lib64/samba/vfs/greyhole.so; else cp samba-module/bin/3.5/greyhole-i386.so /usr/lib/samba/vfs/greyhole.so; fi
}}
Samba 3.6 の場合、手動でモジュールをコンパイルしてください:
{{bc|<nowiki>
# SAMBA_VERSION=`smbd --version | awk '{print $2}'`
# wget http://samba.org/samba/ftp/stable/samba-${SAMBA_VERSION}.tar.gz
# tar zxf samba-${SAMBA_VERSION}.tar.gz && rm samba-${SAMBA_VERSION}.tar.gz
# cd samba-${SAMBA_VERSION}/source3
# ./configure
</nowiki>}}
モジュールをビルドする前に Samba 3.6 で動作させるには修正する必要があるファイルが存在します。[http://pastebin.com/Khmex6sz こちら] のコードを {{ic|Greyhole-Samba-3.6.patch}} という名前で保存して以下のコマンドを実行:
# patch -p1 < Greyhole-Samba-3.6.patch
次に [http://pastebin.com/U51s5yKb こちら] のコードを {{ic|vfs_greyhole.c}} という名前で {{ic|modules}} ディレクトリに保存してください。

それから Samba をビルド:
# make
上記のコマンドにはしばらく時間がかかります。コンパイルが完了したら Greyhole モジュールを適切なディレクトリにコピーしてください:
{{bc|# if [ -x /usr/lib64/samba/vfs/ ]; then cp bin/greyhole.so /usr/lib64/samba/vfs/greyhole.so; else cp bin/greyhole.so /usr/lib/samba/vfs/greyhole.so; fi}}

8. {{ic|smbd.service}} を[[再起動]]してください。

9. その後 Greyhole の初期化スクリプトをインストールする必要があります。汎用の Linux のサンプル init スクリプトは Greyhole のソースに {{ic|initd_script.sh}} という名前で付属しています。

==設定==
{{Note|以下の手順は Greyhole の USAGE ファイルを元にしています。}}
=== Samba の設定 ===
{{ic|/etc/samba/smb.conf}} を編集して以下の行を {{ic|[global]}} セクションに追加:
{{bc|1=
unix extensions = no
wide links = yes
}}

共有それぞれに、以下のように {{ic|dfree command}} と {{ic|vfs objects}} 行を追加してください:
{{bc|1=
[share_name]
path = /path/to/share_name
create mask = 0770
directory mask = 0770
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
printable = no
dfree command = /usr/bin/greyhole-dfree
vfs objects = greyhole
}}
その後 {{ic|smbd.service}} を再起動してください。

=== データベースの設定 ===

[[MySQL]] をセットアップして以下のコマンドを実行してください:
{{bc|
# mysql -u root -p -e "create database greyhole; grant all on greyhole.* to greyhole_user@localhost identified by '89y63jdwe';"
# mysql -u greyhole_user -p89y63jdwe greyhole < /usr/share/greyhole/schema-mysql.sql
}}

=== PHP の設定 ===
{{ic|/etc/php/php.ini}} を開いて、以下の行を:
{{bc|1=
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/
}}
以下のようにしてください:
{{bc|1=
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/
}}
{{ic|date.timezone}} にタイムゾーンを設定してください:
{{bc|1=
date.timezone = "Asia/Tokyo"
}}
最後に、以下の行をアンコメント:
extension=pdo_mysql.so

=== Greyhole の設定 ===

Greyhole の設定は {{ic|/etc/greyhole.conf}} でカスタマイズできます。

{{ic|storage_pool_directories}} と定義したディレクトリの数だけ、以下のコマンドを実行してください (パーティションのルートディレクトリに隠しファイルが作成されます):
{{bc|# touch <dir>/.greyhole_uses_this}}
上記のファイルを使うことで Greyhole はマウントされているかどうか判断します。ファイルがルートディレクトリに存在しないと Greyhole は警告を出力します。

CIFS クライアントの問題を回避するために以下のコマンドを実行してください:
{{bc|
# modprobe cifs
# echo 0 > /proc/fs/cifs/OplockEnabled
}}

その後 {{ic|greyhole.service}} を[[起動]]・[[有効化]]してください。

2024年9月8日 (日) 17:14時点における最新版