greyhole をcentos6にインストールしてみた (keyword greyhole blkid mkfs.ext4 )

nikkei linux 201305 page 16
冊子では、ubuntuにインストーるしている

ここではcenot6.4にインストールしてみるつもりなので、そのメモを残す
1)まずはopkg.orgの検索で引っかかるかどうかみてみる
 結果はまったく引っかからず。

 ああ、そうすか

2)本家 http://www.greyhole.net を訪ねてみる
  yumとaptの両方系の
 リポジトリがある。すばらしい

3)yum系の場合は
Install Using YUM

On Fedora, CentOS and any other distribution using YUM, you can use the Greyhole YUM repository to install and keep Greyhole up to date.
Download greyhole.repo as /etc/yum.repos.d/greyhole.repo, and then use yum to install or update Greyhole:

sudo curl -o /etc/yum.repos.d/greyhole.repo http://www.greyhole.net/releases/rpm/greyhole.repo
sudo yum install greyhole
sudo yum update greyhole # To update, later on


yum listをみると
[root@cent6-64-38 yum.repos.d]# cat /tmp/yumlist | grep greyhole
greyhole.x86_64                           0.9.31-1                      greyhole
hda-greyhole.x86_64                       0.9.31-1                      greyhole
[root@cent6-64-38 yum.repos.d]#
こんな感じになる。


[root@cent6-64-38 yum.repos.d]# yum install greyhole
Loaded plugins: fastestmirror, priorities, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * epel: ftp.iij.ad.jp
 * extras: ftp.riken.jp
 * rpmforge: ftp.kddilabs.jp
 * updates: ftp.riken.jp
93 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package greyhole.x86_64 0:0.9.31-1 will be installed
--> Processing Dependency: php >= 5 for package: greyhole-0.9.31-1.x86_64
--> Processing Dependency: php-intl for package: greyhole-0.9.31-1.x86_64
--> Processing Dependency: php-mbstring for package: greyhole-0.9.31-1.x86_64
--> Processing Dependency: php-mysql for package: greyhole-0.9.31-1.x86_64
--> Processing Dependency: mysql-server for package: greyhole-0.9.31-1.x86_64
--> Running transaction check
---> Package mysql-server.x86_64 0:5.1.67-1.el6_3 will be installed
--> Processing Dependency: mysql = 5.1.67-1.el6_3 for package: mysql-server-5.1.67-1.el6_3.x86_64
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.67-1.el6_3.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.67-1.el6_3.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.67-1.el6_3.x86_64
---> Package php.x86_64 0:5.3.3-22.el6 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-22.el6 for package: php-5.3.3-22.el6.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.3.3-22.el6 for package: php-5.3.3-22.el6.x86_64
---> Package php-intl.x86_64 0:5.3.3-22.el6 will be installed
---> Package php-mbstring.x86_64 0:5.3.3-22.el6 will be installed
---> Package php-mysql.x86_64 0:5.3.3-22.el6 will be installed
--> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-22.el6.x86_64
--> Running transaction check
---> Package mysql.x86_64 0:5.1.67-1.el6_3 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
---> Package php-cli.x86_64 0:5.3.3-22.el6 will be installed
---> Package php-common.x86_64 0:5.3.3-22.el6 will be installed
---> Package php-pdo.x86_64 0:5.3.3-22.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch         Version                 Repository      Size
================================================================================
Installing:
 greyhole             x86_64       0.9.31-1                greyhole       129 k
Installing for dependencies:
 mysql                x86_64       5.1.67-1.el6_3          updates        886 k
 mysql-server         x86_64       5.1.67-1.el6_3          updates        8.6 M
 perl-DBD-MySQL       x86_64       4.013-3.el6             base           134 k
 perl-DBI             x86_64       1.609-4.el6             base           705 k
 php                  x86_64       5.3.3-22.el6            base           1.1 M
 php-cli              x86_64       5.3.3-22.el6            base           2.2 M
 php-common           x86_64       5.3.3-22.el6            base           524 k
 php-intl             x86_64       5.3.3-22.el6            base            70 k
 php-mbstring         x86_64       5.3.3-22.el6            base           455 k
 php-mysql            x86_64       5.3.3-22.el6            base            81 k
 php-pdo              x86_64       5.3.3-22.el6            base            75 k

Transaction Summary
================================================================================
Install      12 Package(s)

Total download size: 15 M
Installed size: 45 M
Is this ok [y/N]: 

Is this ok [y/N]: y
Downloading Packages:
(1/12): greyhole-0.9.31-1.x86_64.rpm                     | 129 kB     00:01     
(2/12): mysql-5.1.67-1.el6_3.x86_64.rpm                  | 886 kB     00:00     
(3/12): mysql-server-5.1.67-1.el6_3.x86_64.rpm           | 8.6 MB     00:02     
(4/12): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm            | 134 kB     00:00     
(5/12): perl-DBI-1.609-4.el6.x86_64.rpm                  | 705 kB     00:00     
(6/12): php-5.3.3-22.el6.x86_64.rpm                      | 1.1 MB     00:00     
(7/12): php-cli-5.3.3-22.el6.x86_64.rpm                  | 2.2 MB     00:00     
(8/12): php-common-5.3.3-22.el6.x86_64.rpm               | 524 kB     00:00     
(9/12): php-intl-5.3.3-22.el6.x86_64.rpm                 |  70 kB     00:00     
(10/12): php-mbstring-5.3.3-22.el6.x86_64.rpm            | 455 kB     00:00     
(11/12): php-mysql-5.3.3-22.el6.x86_64.rpm               |  81 kB     00:00     
(12/12): php-pdo-5.3.3-22.el6.x86_64.rpm                 |  75 kB     00:00     
--------------------------------------------------------------------------------
Total                                           2.0 MB/s |  15 MB     00:07     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : php-common-5.3.3-22.el6.x86_64                              1/12 
  Installing : perl-DBI-1.609-4.el6.x86_64                                 2/12 
  Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                           3/12 
  Installing : php-cli-5.3.3-22.el6.x86_64                                 4/12 
  Installing : php-5.3.3-22.el6.x86_64                                     5/12 
  Installing : php-mbstring-5.3.3-22.el6.x86_64                            6/12 
  Installing : php-intl-5.3.3-22.el6.x86_64                                7/12 
  Installing : php-pdo-5.3.3-22.el6.x86_64                                 8/12 
  Installing : php-mysql-5.3.3-22.el6.x86_64                               9/12 
  Installing : mysql-5.1.67-1.el6_3.x86_64                                10/12 
  Installing : mysql-server-5.1.67-1.el6_3.x86_64                         11/12 
  Installing : greyhole-0.9.31-1.x86_64                                   12/12 
Executing post-install script...
===========================================================================
See /usr/share/greyhole/USAGE to learn how to configure and start Greyhole.
===========================================================================
  Verifying  : php-cli-5.3.3-22.el6.x86_64                                 1/12 
  Verifying  : mysql-server-5.1.67-1.el6_3.x86_64                          2/12 
  Verifying  : perl-DBD-MySQL-4.013-3.el6.x86_64                           3/12 
  Verifying  : php-common-5.3.3-22.el6.x86_64                              4/12 
  Verifying  : greyhole-0.9.31-1.x86_64                                    5/12 
  Verifying  : php-5.3.3-22.el6.x86_64                                     6/12 
  Verifying  : php-mysql-5.3.3-22.el6.x86_64                               7/12 
  Verifying  : perl-DBI-1.609-4.el6.x86_64                                 8/12 
  Verifying  : php-mbstring-5.3.3-22.el6.x86_64                            9/12 
  Verifying  : mysql-5.1.67-1.el6_3.x86_64                                10/12 
  Verifying  : php-intl-5.3.3-22.el6.x86_64                               11/12 
  Verifying  : php-pdo-5.3.3-22.el6.x86_64                                12/12 

Installed:
  greyhole.x86_64 0:0.9.31-1                                                    

Dependency Installed:
  mysql.x86_64 0:5.1.67-1.el6_3          mysql-server.x86_64 0:5.1.67-1.el6_3   
  perl-DBD-MySQL.x86_64 0:4.013-3.el6    perl-DBI.x86_64 0:1.609-4.el6          
  php.x86_64 0:5.3.3-22.el6              php-cli.x86_64 0:5.3.3-22.el6          
  php-common.x86_64 0:5.3.3-22.el6       php-intl.x86_64 0:5.3.3-22.el6         
  php-mbstring.x86_64 0:5.3.3-22.el6     php-mysql.x86_64 0:5.3.3-22.el6        
  php-pdo.x86_64 0:5.3.3-22.el6         

Complete!
[root@cent6-64-38 yum.repos.d]# 



* mysqlのセットアップ
 わすれてるなぁ
 この備忘録を参照しつつ
http://d.hatena.ne.jp/toshi_hirasawa/20120825/1345872375
rpmでのmysqlのセットアップ(Syslog連携、vim風にする)


ここまでできればつかみはOKかな?

mysql> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

mysql> 




mysql> create database greyhole;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on greyhole.* to greyhole_user@localhost identified by 'xxxxxx';
Query OK, 0 rows affected (0.00 sec)

mysql> 








[root@cent6-64-39 etc]# mysql -u greyhole_user -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.67 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use greyhole
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> quit
Bye
[root@cent6-64-39 etc]# mysql -u greyhole_user -pXXXXXXX greyhole < /usr/share/greyhole/schema-mysql.sql 
[root@cent6-64-39 etc]# 










-------------------
[root@cent6-64-38 ~]# mysql -u greyhole_user -pxxxxxxxxx
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.67 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> use greyhole
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+--------------------+
| Tables_in_greyhole |
+--------------------+
| du_stats           |
| settings           |
| tasks              |
| tasks_completed    |
+--------------------+
4 rows in set (0.00 sec)

mysql> 






----------------------

[root@cent6-64-38 ~]# df | grep mnt
/dev/sdb1            384578164    199228 364843496   1% /mnt/mnt1
/dev/sdc1            384578164    199228 364843496   1% /mnt/mnt2
[root@cent6-64-38 ~]# 



[root@cent6-64-38 mnt1]# pwd
/mnt/mnt1
[root@cent6-64-38 mnt1]# 
[root@cent6-64-38 mnt1]# ls -ltr
合計 16
drwx------. 2 root root 16384  1月  5 22:32 2011 lost+found
[root@cent6-64-38 mnt1]# mkdir gh
[root@cent6-64-38 mnt1]# cd /mnt/mnt2/
[root@cent6-64-38 mnt2]# ls -ltr
合計 16
drwx------. 2 root root 16384  1月  9 20:51 2011 lost+found
[root@cent6-64-38 mnt2]# mkdir gh
[root@cent6-64-38 mnt2]# 




[root@cent6-64-38 etc]# diff greyhole.conf.orig greyhole.conf
67a68
> 	num_copies[share] = 2
86a88,89
> 	storage_pool_drive = /mnt/mnt1/gh, min_free: 10gb
> 	storage_pool_drive = /mnt/mnt2/gh, min_free: 10gb
[root@cent6-64-38 etc]#




[root@cent6-64-38 etc]# /etc/init.d/greyhole start
Starting Greyhole ...                                      [  OK  ]
PHP Warning:  date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /usr/bin/greyhole on line 36
[root@cent6-64-38 etc]# chkconfig greyhole on
[root@cent6-64-38 etc]# 






ot@cent6-64-38 etc]# cd /home/
[root@cent6-64-38 home]# ls -ltr
合計 24
drwx------.  2 root     root     16384  4月  5 14:59 2013 lost+found
drwx------.  4 narumi   narumi    4096  4月  6 23:13 2013 narumi
drwx------. 29 hirasawa hirasawa  4096  4月  7 22:36 2013 hirasawa
[root@cent6-64-38 home]# 
[root@cent6-64-38 home]# mkdir smb
[root@cent6-64-38 home]# mkdir ./smb/share
[root@cent6-64-38 home]#




  664  chown -R nobody:nogroup /home/smb
  665  ls -ltr
  666  cat /etc/group | more
  667  cat /etc/group | grep no
  668  cat /etc/passwd | grep no
  669  chown -R nobody:nobody /home/smb
  670  ls -ltr
  671  history






[root@cent6-64-38 samba]# diff ./smb.conf.20140408 ./smb.conf
17a18,20
>    unix extensions = no
>    wide links = yes   
> 
55a59,72
> [share]
>      comment = Share Space for Greyhole
>      path = /home/smb/share
>      create mask = 0770
>      directory mask = 0770
>      read only = no
>      available = yes
>      browseable = Yes
>      writable = Yes
>      guest ok  = Yes
>      printable = no
>      dfree command = /usr/bin/greyhole-dfree
>      vfs objects = greyhole
> 
[root@cent6-64-38 samba]# 




[root@cent6-64-38 samba]# /etc/init.d/sm
smartd  smb     
[root@cent6-64-38 samba]# /etc/init.d/sm
smartd  smb     
[root@cent6-64-38 samba]# /etc/init.d/smb restart
SMB サービスを停止中:                                      [  OK  ]
SMB サービスを起動中:                                      [  OK  ]
[root@cent6-64-38 samba]# 



ここで共有ホルダーにアクセスして
てすと用のファイルとてすと用のディレクトを新規作成してみるですよ



まずはこっちを確認する
[root@cent6-64-38 share]# pwd
/home/smb/share
[root@cent6-64-38 share]# ls -ltr
合計 4
-rwxrw----. 1 nobody nobody    0  4月  8 12:51 2013 greyhole-1st.txt
drwxrwx---. 2 nobody nobody 4096  4月  8 12:51 2013 greyhole-1std.dir
[root@cent6-64-38 share]#





/var/log/greyhole.log
をチェックすると
このエラーがやはしでてますな

Apr 08 12:53:28 3 initialize: PHP Fatal Error: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead; BT: greyhole-dfree[L36]








しばらくたつと....

[root@cent6-64-38 share]# /etc/init.d/greyhole start
Starting Greyhole ...                                      [  OK  ]
PHP Warning:  date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /usr/bin/greyhole on line 36
[root@cent6-64-38 share]# ps -ef | grep greyhole
root     11571     1  2 13:04 pts/0    00:00:00 /usr/bin/php /usr/bin/greyhole --daemon
root     11718 10407  0 13:04 pts/0    00:00:00 grep greyhole
[root@cent6-64-38 share]# tail -f /var/log/greyhole.log
Apr 08 13:04:24 7 write:   Saving 2 metadata files for share/UpYourToeicScoreFrom3xxTo7xxaa_files/viewer.js
Apr 08 13:04:24 7 write:     Saving metadata in /mnt/mnt1/gh/.gh_metastore/share/UpYourToeicScoreFrom3xxTo7xxaa_files/viewer.js
Apr 08 13:04:24 7 write:     Saving metadata in /mnt/mnt2/gh/.gh_metastore/share/UpYourToeicScoreFrom3xxTo7xxaa_files/viewer.js
Apr 08 13:04:24 7 write:   Copying 96.5KB file to /mnt/mnt2/gh/share/UpYourToeicScoreFrom3xxTo7xxaa_files/viewer.js
Apr 08 13:04:24 7 write:   Saving 2 metadata files for share/UpYourToeicScoreFrom3xxTo7xxaa_files/viewer.js
Apr 08 13:04:24 7 write:     Saving metadata in /mnt/mnt1/gh/.gh_metastore/share/UpYourToeicScoreFrom3xxTo7xxaa_files/viewer.js
Apr 08 13:04:24 7 write:     Saving metadata in /mnt/mnt2/gh/.gh_metastore/share/UpYourToeicScoreFrom3xxTo7xxaa_files/viewer.js
Apr 08 13:04:24 7 sleep: Nothing to do... Sleeping.


おおすばらしい。



/etc/fstabにUUID=の形式で書きたい場合は


#blkidコマンドで確認して、あとは /etc/fstabの他のUUIDで始まるエントリを
参考にして追加するばよし。


[hirasawa@ubuntu1204-20 ~]$

セットアップが完了して、しばらく遊んでいて気がついたこと、

-