WebDAVサーバ構築 その1 | ぼぶろぐ

ぼぶろぐ

以前は、あいらぶLinux♪というタイトルでしたが、
最近はLinux以外のことも書いているので、タイトルを変更しました。
ぼぶちゃんのぶろぐでぼぶろぐです。

◆WebDAV構築 その1
WebDAVはwebのファイルサーバで、構築は初めてですね。
本当はsamba3.4をインストールしようかなと思ったのですが、
難しそうだったのでこっちにしました。


[root@localhost ~]# vi /etc/fstab

変更箇所
[root@localhost ~]# diff /etc/fstab /etc/fstab_20090710
9c9
< /dev/VolGroup00/LogVol00 / ext3 defaults,acl 1 1
---
> /dev/VolGroup00/LogVol00 / ext3 defaults 1 1

[root@localhost ~]# mount -o remount /
[root@localhost ~]# useradd -s /sbin/nologin hoge
[root@localhost ~]# passwd hoge
ユーザー hoge のパスワードを変更。
新しいUNIX パスワード:
よくないパスワード: 異なる文字が十分に含まれていません
新しいUNIX パスワードを再入力してください:
passwd: 全ての認証トークンが正しく更新できました。
[root@localhost ~]# chmod 711 /home/hoge/
[root@localhost ~]# mkdir /home/hoge/webdav/
[root@localhost ~]# chown hoge. /home/hoge/webdav/
[root@localhost ~]# setfacl -m g:apache:rwx,g:apache:rwx /home/hoge/webdav/
[root@localhost ~]# setfacl -m d:g:apache:rwx,g:apache:rwx /home/hoge/webdav/
[root@localhost ~]# setfacl -m g:hoge:rwx,g:hoge:rwx /home/hoge/webdav/
[root@localhost ~]# setfacl -m d:g:hoge:rwx,g:hoge:rwx /home/hoge/webdav/
[root@localhost ~]# getfacl /home/hoge/webdav/
getfacl: Removing leading '/' from absolute path names
# file: home/hoge/webdav/
# owner: hoge
# group: hoge
user::rwx
group::r-x
group:apache:rwx
group:hoge:rwx
mask::rwx
other::r-x
default:user::rwx
default:group::r-x
default:group:apache:rwx
default:group:hoge:rwx
default:mask::rwx
default:other::r-x

[root@localhost ~]# yum -y install httpd-devel
Loaded plugins: downloadonly, fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* fedora: mirror.ovh.net
* updates: fedora.intergenia.de
fedora | 2.8 kB 00:00
updates | 3.4 kB 00:00
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package httpd-devel.i386 0:2.2.11-2.fc10 set to be updated
--> Processing Dependency: apr-util-devel for package: httpd-devel-2.2.11-2.fc10.i386
--> Processing Dependency: apr-devel for package: httpd-devel-2.2.11-2.fc10.i386
--> Running transaction check
---> Package apr-devel.i386 0:1.3.5-1.fc10 set to be updated
--> Processing Dependency: apr = 1.3.5-1.fc10 for package: apr-devel-1.3.5-1.fc10.i386
---> Package apr-util-devel.i386 0:1.3.7-1.fc10 set to be updated
--> Processing Dependency: apr-util = 1.3.7-1.fc10 for package: apr-util-devel-1.3.7-1.fc10.i386
--> Processing Dependency: openldap-devel for package: apr-util-devel-1.3.7-1.fc10.i386
--> Processing Dependency: db4-devel for package: apr-util-devel-1.3.7-1.fc10.i386
--> Processing Dependency: expat-devel for package: apr-util-devel-1.3.7-1.fc10.i386
--> Running transaction check
---> Package apr.i386 0:1.3.5-1.fc10 set to be updated
--> Processing Dependency: apr-util = 1.3.4-1.fc10 for package: apr-util-ldap-1.3.4-1.fc10.i386
---> Package apr-util.i386 0:1.3.7-1.fc10 set to be updated
---> Package db4-devel.i386 0:4.7.25-7.fc10 set to be updated
--> Processing Dependency: libdb_cxx-4.7.so for package: db4-devel-4.7.25-7.fc10.i386
---> Package expat-devel.i386 0:2.0.1-5 set to be updated
---> Package openldap-devel.i386 0:2.4.12-1.fc10 set to be updated
--> Processing Dependency: cyrus-sasl-devel >= 2.1 for package: openldap-devel-2.4.12-1.fc10.i386
--> Running transaction check
---> Package apr-util-ldap.i386 0:1.3.7-1.fc10 set to be updated
---> Package cyrus-sasl-devel.i386 0:2.1.22-19.fc10 set to be updated
---> Package db4-cxx.i386 0:4.7.25-7.fc10 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
Package Arch Version Repository Size
=========================================================================================
Installing:
httpd-devel i386 2.2.11-2.fc10 updates 147 k
Installing for dependencies:
apr-devel i386 1.3.5-1.fc10 updates 176 k
apr-util-devel i386 1.3.7-1.fc10 updates 68 k
cyrus-sasl-devel i386 2.1.22-19.fc10 fedora 352 k
db4-cxx i386 4.7.25-7.fc10 updates 685 k
db4-devel i386 4.7.25-7.fc10 updates 7.0 M
expat-devel i386 2.0.1-5 fedora 142 k
openldap-devel i386 2.4.12-1.fc10 fedora 1.6 M
Updating for dependencies:
apr i386 1.3.5-1.fc10 updates 133 k
apr-util i386 1.3.7-1.fc10 updates 94 k
apr-util-ldap i386 1.3.7-1.fc10 updates 13 k

Transaction Summary
=========================================================================================
Install 8 Package(s)
Update 3 Package(s)
Remove 0 Package(s)

Total download size: 10 M
Downloading Packages:
(1/11): apr-1.3.5-1.fc10.i386.rpm | 133 kB 00:02
(2/11): apr-devel-1.3.5-1.fc10.i386.rpm | 176 kB 00:02
(3/11): apr-util-1.3.7-1.fc10.i386.rpm | 94 kB 00:00
(4/11): apr-util-devel-1.3.7-1.fc10.i386.rpm | 68 kB 00:01
(5/11): apr-util-ldap-1.3.7-1.fc10.i386.rpm | 13 kB 00:00
(6/11): cyrus-sasl-devel-2.1.22-19.fc10.i386.rpm | 352 kB 00:04
(7/11): db4-cxx-4.7.25-7.fc10.i386.rpm | 685 kB 00:04
(8/11): db4-devel-4.7.25-7.fc10.i386.rpm | 7.0 MB 00:43
(9/11): expat-devel-2.0.1-5.i386.rpm | 142 kB 00:01
(10/11): httpd-devel-2.2.11-2.fc10.i386.rpm | 147 kB 00:01
(11/11): openldap-devel-2.4.12-1.fc10.i386.rpm | 1.6 MB 00:10
-----------------------------------------------------------------------------------------
Total 135 kB/s | 10 MB 01:18
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : apr-1.3.5-1.fc10.i386 1/14
Updating : apr-util-1.3.7-1.fc10.i386 2/14
Updating : apr-util-ldap-1.3.7-1.fc10.i386 3/14
Installing : cyrus-sasl-devel-2.1.22-19.fc10.i386 4/14
Installing : db4-cxx-4.7.25-7.fc10.i386 5/14
Installing : apr-devel-1.3.5-1.fc10.i386 6/14
Installing : db4-devel-4.7.25-7.fc10.i386 7/14
Installing : openldap-devel-2.4.12-1.fc10.i386 8/14
Installing : expat-devel-2.0.1-5.i386 9/14
Installing : apr-util-devel-1.3.7-1.fc10.i386 10/14
Installing : httpd-devel-2.2.11-2.fc10.i386 11/14
Cleanup : apr-util-1.3.4-1.fc10.i386 12/14
Cleanup : apr-1.3.3-1.fc10.i386 13/14
Cleanup : apr-util-ldap-1.3.4-1.fc10.i386 14/14

Installed:
httpd-devel.i386 0:2.2.11-2.fc10

Dependency Installed:
apr-devel.i386 0:1.3.5-1.fc10 apr-util-devel.i386 0:1.3.7-1.fc10
cyrus-sasl-devel.i386 0:2.1.22-19.fc10 db4-cxx.i386 0:4.7.25-7.fc10
db4-devel.i386 0:4.7.25-7.fc10 expat-devel.i386 0:2.0.1-5
openldap-devel.i386 0:2.4.12-1.fc10

Dependency Updated:
apr.i386 0:1.3.5-1.fc10 apr-util.i386 0:1.3.7-1.fc10 apr-util-ldap.i386 0:1.3.7-1.fc10

Complete!
[root@localhost ~]# wget http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
--2009-07-10 22:54:31-- http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
webdav.todo.gr.jp をDNSに問いあわせています... 210.150.184.134
webdav.todo.gr.jp|210.150.184.134|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 16954 (17K) [text/x-csrc]
`mod_encoding.c.apache2.20040616' に保存中

100%[===============================================>] 16,954 --.-K/s 時間 0.05s

2009-07-10 22:54:31 (324 KB/s) - `mod_encoding.c.apache2.20040616' へ保存完了 [16954/16954]

[root@localhost ~]# wget http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
--2009-07-10 22:56:55-- http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
webdav.todo.gr.jp をDNSに問いあわせています... 210.150.184.134
webdav.todo.gr.jp|210.150.184.134|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 260587 (254K) [application/x-gzip]
`mod_encoding-20021209.tar.gz' に保存中

100%[===============================================>] 260,587 263K/s 時間 1.0s

2009-07-10 22:56:56 (263 KB/s) - `mod_encoding-20021209.tar.gz' へ保存完了 [260587/260587]

[root@localhost ~]# tar zxvf mod_encoding-20021209.tar.gz
~省略~

[root@localhost ~]# /bin/mv mod_encoding.c.apache2.20040616 mod_encoding-20021209/mod_encoding.c
[root@localhost ~]# cd mod_encoding-20021209/lib/
[root@localhost lib]# ./configure && make && make install
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... missing
checking for working autoconf... missing
checking for working automake... missing
checking for working autoheader... missing
checking for working makeinfo... found
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... no
checking for cc... no
configure: error: no acceptable cc found in $PATH
[root@localhost lib]# cd ..
[root@localhost mod_encoding-20021209]# wget http://www.aconus.com/~oyaji/faq/mod_encoding.c-apache2.2-20060520.patch
--2009-07-10 22:59:13-- http://www.aconus.com/~oyaji/faq/mod_encoding.c-apache2.2-20060520.patch
www.aconus.com をDNSに問いあわせています... 116.80.23.142
www.aconus.com|116.80.23.142|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 3591 (3.5K) [text/x-patch]
`mod_encoding.c-apache2.2-20060520.patch' に保存中

100%[===============================================>] 3,591 --.-K/s 時間 0.02s

2009-07-10 22:59:13 (143 KB/s) - `mod_encoding.c-apache2.2-20060520.patch' へ保存完了 [3591/3591]

[root@localhost mod_encoding-20021209]# patch -p0 < mod_encoding.c-apache2.2-20060520.patch
patching file mod_encoding.c
[root@localhost mod_encoding-20021209]# ./configure --with-apxs=/usr/sbin/apxs --with-iconv-hook
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... missing
checking for working autoconf... missing
checking for working automake... missing
checking for working autoheader... missing
checking for working makeinfo... found
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether to compile with debug code... checking whether to wrap iconv with iconv_hook... yes
checking for iconv_hook in -liconv_hook... no
checking for iconv in -liconv... no
checking for libiconv in -liconv... no
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h
[root@localhost mod_encoding-20021209]# vi Makefile

変更箇所
LIBS = -L/usr/local/lib -liconv_hook

install-exec-local:
$(APXS) -i -a -n encoding mod_encoding.la

[root@localhost mod_encoding-20021209]# make && make install
/usr/sbin/apxs -c -I/usr/local/include/iconv_hook -L/usr/local/lib -liconv_hook mod_encoding.c
/usr/lib/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/local/include/iconv_hook -c -o mod_encoding.lo mod_encoding.c && touch mod_encoding.slo
env: gcc: No such file or directory
apxs:Error: Command failed with rc=65536
.
make: *** [mod_encoding.so] エラー 1


ん?なんかエラーがでてますね。
とりあえずすすめてみる。


[root@localhost mod_encoding-20021209]# cd
[root@localhost ~]# vi /etc/httpd/conf.d/mod_encoding.conf ←新規作成

[root@localhost ~]# cat /etc/httpd/conf.d/mod_encoding.conf
EncodingEngine on

SetServerEncoding UTF-8

DefaultClientEncoding UTF-8 CP932 EUCJP-MS

AddClientEncoding "Microsoft .* DAV 1.1" ASCII CP932 UTF-8
AddClientEncoding "Microsoft .* DAV" UTF-8 CP932
AddClientEncoding "(Microsoft .* DAV $)" UTF-8 CP932
AddClientEncoding "(Microsoft .* DAV 1.1)" CP932 UTF-8
AddClientEncoding "Microsoft-WebDAV*" UTF-8 CP932
AddClientEncoding "RMA/*" CP932
AddClientEncoding "xdwin9x/" CP932
AddClientEncoding "cadaver/" UTF-8 EUCJP-MS
AddClientEncoding "Mozilla/" EUCJP-MS

[root@localhost ~]# /etc/rc.d/init.d/httpd reload
httpd を再読み込み中: 設定の構文エラーのため再読み込みしません
[失敗]
[root@localhost ~]# apachectl -t
Syntax error on line 1 of /etc/httpd/conf.d/mod_encoding.conf:
Invalid command 'EncodingEngine', perhaps misspelled or defined by a module not included in the server configuration


やっぱりできないですね。。。
明日か明後日あたりに調べて直します。