Apr 27, 2007
[Linux] 巨大なデータの tar アーカイビングに苦戦
大量のデータを tar でアーカイビングしようとして苦戦。 最初は特に意識せず普通に
とやったのだが、tar cvf /home/foo.tar ./foo
と怒られてしまった。 それなら、とtar: Cannot write to /home/foo.tar: File too large tar: Error is not recoverable: exiting now
と bzip2 圧縮をかけたのだが、tar --use=bzip2 -cvf /home/foo.tar.bz2 ./foo
bzip2: I/O or other error, bailing out. Possible reason follows.
bzip2: File too large
Input file = (stdin), output file = (stdout)
Broken pipe
と、またツレナイ結果に。
結局仕方が無いので
#!/bin/sh
src=./foo
dest=/home/
prefix=foo.
suffix=.tar.bz2
cd $src
for i in * ; do
if [ -d $i ] ; then
echo "archiving $i... -> $dest/$prefix$i$suffix"
tar --use=bzip2 -cvf $dest/$prefix$i$suffix $i > /dev/null
fi
done
とディレクトリ個別にアーカイビングするハメに。
もっと良い方法がある気がするのだが。
どうすれば良いのだろう??
Apr 26, 2007
[Maven] Maven2 で JUnit4 を使用する。
ようやく Maven2 で JUnit4 のテストが出来るようになった。 ただ、2007/04/26 時点で最新の Maven2.0.6 でもデフォルトでは JUnit4 はサポートされていない。 pom.xml で Surefire のバージョンを最新(?) のものに指定する必要がある。 毎回設定するのも面倒なので、早くデフォルトで JUnit4 がサポートされないものか。
pom.xml の設定方法(最小限)
<?xml version="1.0"?>
<project>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Apr 19, 2007
[Linux] Debian Etch で Apache2.2 + SSL
Debian Etch がリリースされたので、Sarge からアップグレードしてみた。 apt の dist-upgrade は少々不安だったので(^^;、クリーンインストールで。 特に何事もなく進んで喜んでいたのだが、Apache2.2 + SSL の設定で思わぬ苦戦をした。 ということで、最終的に上手くいった方法をメモ。
openssl のインストール
example:/# apt-get install openssl Reading package lists... Done Building dependency tree... Done Suggested packages: ca-certificates The following NEW packages will be installed: openssl 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 1004kB of archives. After unpacking 2351kB of additional disk space will be used. Get:1 http://ftp.jp.debian.org etch/main openssl 0.9.8c-4 [1004kB] Fetched 1004kB in 8s (122kB/s) Selecting previously deselected package openssl. (Reading database ... 18787 files and directories currently installed.) Unpacking openssl (from .../openssl_0.9.8c-4_i386.deb) ... Creating directory /etc/ssl Setting up openssl (0.9.8c-4) ... example:/#
openssl の設定
よしだメモ さんの [linux]Debian etchでSSL に書いてあった通りに /etc/ssl/openssl.cnf を編集。
[usr_cert]セクションのnsCertType=serverのコメントアウトを外す
[v3_ca]セクションのnsCertType=sslCA,emailCAのコメントアウトを外す
証明書の作成
こちらもよしだメモさんのエントリ通りに作業。
example:/# cd /usr/lib/ssl/misc/
example:/usr/lib/ssl/misc# ./CA.sh -newca
CA certificate filename (or enter to create)
Making CA certificate ...
Generating a 1024 bit RSA private key
.............++++++
..................................................................++++++
writing new private key to './demoCA/private/./cakey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
...SNIP...
Certificate is to be certified until Apr 17 01:07:26 2010 GMT (1095 days)
Write out database with 1 new entries
Data Base Updated
example:/usr/lib/ssl/misc# openssl rsa -in ./demoCA/private/cakey.pem -out ./demoCA/private/cakey.pem
Enter pass phrase for ./demoCA/private/cakey.pem:
writing RSA key
example:/usr/lib/ssl/misc# openssl x509 -in ./demoCA/cacert.pem -out ./demoCA/cacert.crt
example:/usr/lib/ssl/misc# openssl x509 -inform pem -in ./demoCA/cacert.pem -outform der -out ./demoCA/ca.der
証明書を Apache に登録
で、/etc/apache2/ssl/cacert.crt と /etc/apache2/ssl/private/cakey.pem を httpd-ssl.conf に登録。 ついでに、ServerName やら何やらも設定しておく。example:/usr/lib/ssl/misc/demoCA# mkdir /etc/apache2/ssl example:/usr/lib/ssl/misc/demoCA# cp ./cacert.crt /etc/apache2/ssl example:/usr/lib/ssl/misc/demoCA# cd private/ example:/usr/lib/ssl/misc/demoCA/private# mkdir /etc/apache2/ssl/private example:/usr/lib/ssl/misc/demoCA/private# cp ./cakey.pem /etc/apache2/ssl/private/ example:/usr/lib/ssl/misc/demoCA/private# cd /etc/apache2/sites-available example:/etc/apache2/sites-available# cp /usr/share/doc/apache2.2-common/examples/apache2/extra/httpd-ssl.conf.gz ./ example:/etc/apache2/sites-available# gzip -d ./httpd-ssl.conf.gz example:/etc/apache2/sites-available# ln -s /etc/apache2/sites-available/httpd-ssl.conf /etc/apache2/sites-enabled/httpd-ssl.conf example:/etc/apache2/sites-available# vi ./httpd-ssl.conf
Apache で ssl モジュール有効化
example:/etc/apache2/sites-available# a2enmod ssl Module ssl installed; run /etc/init.d/apache2 force-reload to enable.
Apache 再起動
example:/etc/apache2/sites-available# apache2ctl -t Syntax OK example:/etc/apache2/sites-available# /etc/init.d/apache2 restart Forcing reload of web server (apache2)...httpd (no pid file) not running .
ローカルからの接続確認
example:~# openssl s_client -connect localhost:https
CONNECTED(00000003)
...SNIP...
---
GET / HTTP/1.0 ← これを入力して \n\n
HTTP/1.1 200 OK
Date: Thu, 19 Apr 2007 14:45:57 GMT
Server: Apache/2.2.3 (Debian) DAV/2 SVN/1.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c
Last-Modified: Fri, 11 Nov 2005 08:09:59 GMT
ETag: "1508105-65-a5c6e3c0"
Accept-Ranges: bytes
Content-Length: 101
Connection: close
Content-Type: text/html; charset=UTF-8
<html>
<head>
<meta http-equiv="refresh" content="0; URL=./blog/">
</head>
<body>
</body>
</html>
closed
example:~#
リモートから Web ブラウザで確認
後はリモートから Web ブラウザで https の接続を確認して完了。 たったこれだけで 1 週間以上悩んだ・・・ orz よしだメモ さんに大感謝!!



