Japanese | English

またリニューアルした

管理しやすくしようと思ってPHPのスクリプトを書いたりした後に、去年から撮り始めた写真を一緒にアップしようとzenphotoを使い始めたら、Blogger, 自作の管理ツール, zenphotoとアカウントとログイン先が3カ所になってしまって管理が面倒になった。それでアカウントを1つにまとめようと思い、全部Googleのアカウントで管理するようにした。サイトはBlogger, 写真はPicasaで。

一応、ドメイン取ってサーバも借りてるし、WordPressなどのBlogツールやwikiなんかを設定する事も考えたけど、ツールがアップグレードされたら、自分のサイトで使っているツールもアップグレードする必要があるので面倒だと思ったので、サイトはBlogger中心になった。

コンテンツ


Blogger Helpの和訳を削除した。もう公式のヘルプが日本語化されているので、ここで和訳を公開すると混乱を招く、とまではいかないかもしれないけど、あまり良くないだろうと。もう情報も古いし。

それから、Google Map APIを使ったスクリプトも削除した。自分の為に作ってみたけど自分でも結局ほとんど使わなかったので。

テンプレート


Bloggerはblog*spotじゃなくてFTPで自分の借りてるサーバにアップロードしているので、テンプレートはクラッシックテンプレート。新しいタイプのテンプレートならタグクラウド(Bloggerの場合はラベル)なんかもできるんだろうけど、リストにするしかなかった。最新のポスト(Recent Posts)やラベルリストはjavascriptを使って表示するようにした。

Recept Postを表示するスクリプトを書くのに参考にしたサイトは、JavaScript++かも日記ブログタイトルを読み込む2。ブラウザによって挙動が違っててハマった時に参考になった(namespaceの処理とか)。

ラベルリストの参考にしたサイトは、phydeaux3Automatic List of Labels for Blogger Classic Templates / FTPという記事。

テンプレートのデザインはWordPressのHemingwayとそれをBlogger用にしたHemingway template for Bloggerを参考にした。ただしHTMLは書き直したので構造は全然違う。

その他


サイトフィードの順番がおかしいのは、後から昔の投稿をコピーしたからだろう。直すのは面倒そう。。

About Meの顔は植田まさし風 似顔絵ジェネレーターVer2.0で作った。似てるって言われたんだけど。。。

Labels:

Document Index

Windows 関連



Mac 関連



Linux (CentOS) 関連


Server 設定



Web Application



その他


Labels:

Trac を GTD に使えるか

GTD を実践するのに Trac を使えないか考えた時のメモ(考えたけど今は使ってない)。

設定


Ticket を設定する。

Componet を次のように設定する。
  • Personal
  • Professional
  • Job
  • Home
  • Other

Priorities はデフォルトのまま。

Severities は次のように設定。
  • @ACTION
  • @WAITING
  • Someday

Type は次のように設定する。
  • task
  • enhancement
  • defect

milestone は適宜プロジェクトのロードマップとして使う(元々そうだけど)。

レポートのカスタマイズ


今週のレポート


今週アップデートされたチケットを表示。

SQL:
SQL Query for Report:
SELECT p.value AS __color__,
t.milestone AS __group__,
(CASE status
WHEN 'closed' THEN 'color: #777; background: #ddd; border-color:
#ccc;'
ELSE
(CASE owner WHEN '$USER' THEN 'font-weight: bold' END)
END) AS __style__,
id AS ticket, summary, component, status,
resolution,version, t.type AS type, priority, owner,
changetime AS modified,
time AS _time,reporter AS _reporter
FROM ticket t,enum p
WHERE p.name=t.priority AND p.type='priority'
AND t.changetime >
strftime('%%s',datetime(strftime('%%s','now')-604800,'unixepoch','weekda
y 1','start of day'))
ORDER BY (milestone IS NULL), milestone DESC, (status = 'closed'),
(CASE status WHEN 'closed' THEN modified ELSE (-1)*p.value END)
DESC

Weekly Review


先週 1 週間(月曜から日曜)にアップデートがあったチケットを表示。

SQL:
SQL Query for Report:
SELECT p.value AS __color__,
t.milestone AS __group__,
(CASE status
WHEN 'closed' THEN 'color: #777; background: #ddd; border-color:
#ccc;'
ELSE
(CASE owner WHEN '$USER' THEN 'font-weight: bold' END)
END) AS __style__,
id AS ticket, summary, component, status,
resolution,version, t.type AS type, priority, owner,
changetime AS modified,
time AS _time,reporter AS _reporter
FROM ticket t,enum p
WHERE p.name=t.priority AND p.type='priority'
AND t.changetime <
strftime('%%s',datetime(strftime('%%s','now')-604800,'unixepoch','weekda
y 1','start of day'))
AND t.changetime >
strftime('%%s',datetime(strftime('%%s','now')-1209600,'unixepoch','weekd
ay 1','start of day'))
ORDER BY (milestone IS NULL), milestone DESC, (status = 'closed'),
(CASE status WHEN 'closed' THEN modified ELSE (-1)*p.value END)
DESC

Labels: , ,

TruStudio のインストール

PHP, HTML の編集、Subversionクライアントとして使う。

TruStudio のインストール


  1. TruStudio を download する
  2. 解凍する
  3. 適当なディレクトリにコピーまたは移動する

Subclipse (SVN クライアント)


  1. TruStudio を起動
  2. Help > Software update > Find and Install
  3. Search for new feature install
  4. New remote site > enter name: Subclipse, URL: http://subclipse.tigris.org/update
  5. Subclipse を選択 > Finish をクリック
  6. ダイアログに従ってインストールしたら、TruStudio を再起動する

Labels: ,

Linux で外付けの HDD を使用する

参照



設定手順


USB 接続の HDD にパーティションを作ってフォーマットする。

fdisk を実行。
# fidsk /dev/sda

fdisk のメニューで Linux パーティションを作る。
コマンド (m でヘルプ): d
領域番号 (1-4): 1

コマンド (m でヘルプ): n
コマンドアクション
e 拡張
p 基本領域 (1-4)
p
領域番号 (1-4): 1
最初 シリンダ (1-9733, default 1):
Using default value 1
終点 シリンダ または +サイズ または +サイズM または +サイズK (1-9733, default 9733):
Using default value 9733

フォーマットする。
# mkfs -t ext3 /dev/sda1

mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
9781248 inodes, 19545072 blocks
977253 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=20971520
597 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

結果を確認。
# mount /dev/sda1 /mnt/usb/
# df -h
Filesystem サイズ 使用 残り 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
73G 2.1G 67G 4% /
/dev/hda1 99M 12M 82M 13% /boot
none 248M 0 248M 0% /dev/shm
/dev/sda1 74G 85M 70G 1% /mnt/usb

rsync でバックアップする時の例


ホームディレクトリと TWiki のデータをバックアップ:
#!/bin/sh
mount /dev/sda1 /mnt/usb
rsync -uva /var/www/html/twiki/data/ /mnt/usb/twiki/data/
rsync -uva /home/username/ /mnt/usb/username/
umount /mnt/usb

Labels: ,

Webmin の導入

インストール


以下のサイトのどちらかから RPM をダウンロード

次のコマンドを実行
# rpm -ivh webmin-1.200-1.noarch.rpm

webmin を使うには http://example.com:10000/ にアクセスする。

Firewall の設定


webmin と usermin を使う為に /etc/sysconfig/iptables に次の行を追加する。
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 20000 -j ACCEPT

編集したら、以下のコマンドで iptables をリスタートする。
# service iptables restart

Labels: ,

Twiki の導入

参照


TWiki Installation Guide

インストール先など


  • ディレクトリ: /var/www/html/twiki
  • Installation guide にある httpd.conf の例を twiki.conf として /etc/httpd/conf.d にコピー

設定ファイル


twiki/bin/setlib.cfg


以下の行を修正:
$twikiLibPath = '/var/www/html/twiki/lib';

twiki/lib/TWiki.cfg


以下の行を修正:
$defaultUrlHost   = "http://192.168.1.11";
$scriptUrlPath = "/twiki/bin";
$dispScriptUrlPath = $scriptUrlPath;
$dispViewPath = "/view";
$pubUrlPath = "/twiki/pub";
$pubDir = "/var/www/html/twiki/pub";
$templateDir = "/var/www/html/twiki/templates";
$dataDir = "/var/www/html/twiki/data";

$useLocale = 1;
$siteLocale = "ja_JP.eucjp";

上の設定が終わったら、ブラウザで以下の URL (インストールしたマシン)にアクセスする。
http://example.com/twiki/bin/testenv

Configuration


TWiki の設定は、wiki のページを編集して行う。ただし、wysiwyg の編集画面で編集すると、内容がおかしくなる事があるので注意。

TWiki.TWikiPreferences


Default User Settings

テキストエリアのサイズを変更:
  • Set EDITBOXHEIGHT = 30

Email and Proxy server Settings

以下の項目を変更:
  • Set WIKIWEBMASTER = webmaster@example.com
  • Set SMTPMAILHOST = localhost

注意: 上は localhost で SMTP サーバが動いている場合

User


ユーザ名を登録する。

Admin Group


次のページを編集する: Main.TWikiAdminGroup

Labels: ,

Trac の導入

参照



インストール


/etc/yum.repos.d/dag.repo の includepkgs に trac に加え依存関係にあるパッケージを追加。

/etc/yum.repos.d/dag.repo
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
includepkgs=proftpd trac clearsilver python-clearsilver

"trac clearsilver python-clearsilver" を追加。
# yum install trac

他に mod_python が必要。インストールされていない場合は、事前にインストールする。
# yum install mod_python

プロジェクトの設定


trac で管理する subversion のリポジトリが無い場合は、作成しておく。作成方法は、Subversionを参照。仮に、リポジトリを /var/svn/reposname とする。
# cd /usr/share/trac/
# mkdir project
# cd project
# trac-admin ./projectname initenv
Creating a new Trac environment at /usr/share/trac/project/projectname

Trac will first ask a few questions about your environment
in order to initalize and prepare the project database.

Please enter the name of your project.
This name will be used in page titles and descriptions.

Project Name [My Project]> projectname

Please specify the connection string for the database to use.
By default, a local SQLite database is created in the environment
directory. It is also possible to use an already existing
PostgreSQL database (check the Trac documentation for the exact
connection string syntax).

Database connection string [sqlite:db/trac.db]>

Please specify the absolute path to the project Subversion repository.
Repository must be local, and trac-admin requires read+write
permission to initialize the Trac database.

Path to repository [/var/svn/test]> /var/svn/reposname

Please enter location of Trac page templates.
Default is the location of the site-wide templates installed with Trac.

Templates directory [/usr/share/trac/templates]>

Creating and Initializing Project
Configuring Project
trac.repository_dir

(snip)

The latest documentation can also always be found on the project
website:

http://projects.edgewall.com/trac/

Congratulations!

Apache の設定


/etc/httpd/conf.d/trac.conf
Alias /trac/ "/usr/share/trac/cgi-bin/trac.cgi"

<Location "/trac">
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /usr/share/trac/project/projectname
PythonOption TracUriRoot /trac
</Location>

パーミッションの変更。
# chown -R apache.apache /usr/share/trac/cgi-bin
# chown -R apache.apache /usr/share/trac/htdocs
# chown -R apache.apache /usr/share/trac/project
# chcon -R system_u:object_r:httpd_sys_content_t /usr/share/trac/htdocs
# chcon -R system_u:object_r:httpd_sys_content_t /usr/share/trac/cgi-bin
# chcon -R system_u:object_r:httpd_sys_content_t /usr/share/trac/project

設定したURLへアクセス。(上の場合 http://example.com/trac)

Basic 認証


認証が必要な場合。

/etc/httpd/conf.d/trac.conf
Alias /trac/ "/usr/share/trac/cgi-bin/trac.cgi"

<Location "/trac">
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /usr/share/trac/project/projectname
PythonOption TracUriRoot /trac
<LimitExcept PROPFIND OPTIONS REPORT>
AuthType Basic
AuthName "Trac Authentication"
AuthLDAPURL ldap://localhost:389/cn=ldapusers,dc=example,dc=com?uid
require user username1 username2
</LimitExcept>
</Location>

WebAdmin Plugin


easy_install のインストール


プラグインを簡単にインストールする為に、easy_installというツールをインストールする。
# wget http://peak.telecommunity.com/dist/ez_setup.py
# python ez_setup.py

WebAdmin のインストール


  1. WebAdminのパッケージをダウンロード
  2. ファイル名の.zipを削除し、拡張子を.eggにする
  3. 以下のコマンドを実行

# easy_install TracWebAdmin-0.1.1dev_r2765-py2.3.egg

インストールしたら、trac-adminコマンドで、任意のユーザにAdmin権限を与える。
# trac-admin /usr/share/trac/project/projectname permission add username TRAC_ADMIN

該当のユーザでログインして、メニュータブにAdminが出てくればOK。

Labels: ,

Scuttle のセットアップ

参照



インストール


  1. ダウンロードサイトからダウンロード
  2. 任意のディレクトリに解凍
  3. MySQL に Scuttle 用の DB とユーザを作成
  4. アーカイブ内にある tables.sql でテーブルを作成
  5. config.inc.php を編集
  6. Scuttle の URL (インストール先 URL)にアクセス

例:
# cd /var/www/html/
# mkdir scuttle
# cd scuttle
# wget http://jaist.dl.sourceforge.net/sourceforge/scuttle/scuttle.0.7.2.zip
# unzip scuttle.0.7.2.zip
# mysql -u root -p scuttle < tables.sql
# cp config.inc.php.example config.inc.php
# vi config.inc.php

例 (config.inc.phpの変更箇所のみ)
$dbtype = 'mysql';
$dbhost = '127.0.0.1';
$dbport = '3306';
$dbuser = 'scuttle';
$dbpass = 'yourpassword';
$dbname = 'scuttle';

Labels: ,

phpMyAdmin のセットアップ

参照



phpMyAdmin のインストール


  1. ファイルをダウンロード
  2. ダウンロードしたファイルを解凍して、任意のディレクトリに保存する

例:
# cd /var/www/html/
# wget http://jaist.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.8.2.tar.bz2
# tar jxvf phpMyAdmin-2.8.2.tar.bz2
# mv phpMyAdmin-2.8.2 phpmyadmin

設定


  1. 設定用のディレクトリを作成する(e.g. /var/www/html/phpmyadmin/config)
  2. phpmyadmin/scripts/setup.php にアクセスして、各設定を行う
  3. 作成されたconfig.inc.phpをphpmyadminのルートディレクトリに移動して、configディレクトリを削除する

例:
# cd /var/www/html/phpmyadmin/
# mkdir config
# chmod o+rw config/

(setup.phpで設定後)
# cd /var/www/html/phpmyadmin
# mv config/config.inc.php ./config.inc.php
# rmdir ./config

例: config.inc.php
<?php
/*
* Generated configuration file
* Generated by: phpMyAdmin 2.8.2 setup script by Michal Čihař <michal@cihar.com>
* Version: $Id: setup.php,v 1.23.2.10 2006/05/15 07:57:30 nijel Exp $
* Date: Tue, 25 Jul 2006 02:49:02 GMT
*/

/* Servers configuration */
$i = 0;

/* Server localhost (cookie) [1] */
$i++;
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['pmadb'] = 'phpMyAdmin';

/* End of servers configuration */

$cfg['ForceSSL'] = false;
$cfg['ShowPhpInfo'] = true;
$cfg['ShowChgPassword'] = true;
$cfg['AllowArbitraryServer'] = false;
$cfg['LoginCookieRecall'] = 'something';
$cfg['LoginCookieValidity'] = 1800;
$cfg['blowfish_secret'] = '44c585d968bf70.98430220';
$cfg['AllowAnywhereRecoding'] = false;
$cfg['DefaultCharset'] = 'utf-8';
$cfg['RecodingEngine'] = 'iconv';
$cfg['IconvExtraParams'] = '//TRANSLIT';
$cfg['GD2Available'] = 'no';
?>

Labels: , ,

phpLDAPadmin のセットアップ

インストール


phpLDAPadmin をダウンロードし、解凍する。
# wget http://jaist.dl.sourceforge.net/sourceforge/phpldapadmin/phpldapadmin-0.9.8.2.tar.gz
--13:51:48-- http://jaist.dl.sourceforge.net/sourceforge/phpldapadmin/phpldapadmin-0.9.8.2.tar.gz
=> `phpldapadmin-0.9.8.2.tar.gz'
jaist.dl.sourceforge.net をDNSに問いあわせています... 150.65.7.130
jaist.dl.sourceforge.net|150.65.7.130|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 754,341 (737K) [application/x-gzip]

100%[============================================================================>] 754,341 1.03M/s

13:51:49 (1.03 MB/s) - `phpldapadmin-0.9.8.2.tar.gz' を保存しました [754341/754341]

# tar zxf phpldapadmin-0.9.8.2.tar.gz

設定


config.php.example を config.php としてコピーし、修正。以下は主な修正点。
/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin
auto-detect it for you. */
// $ldapservers->SetValue($i,'server','base',array(''));
$ldapservers->SetValue($i,'server','base',array('ou=People,dc=example,dc=com'));

/* If you specified 'cookie' or 'session' as the auth_type above, you can
optionally specify here an attribute to use when logging in. If you enter
'uid' and login as 'dsmith', phpLDAPadmin will search for (uid=dsmith)
and log in as that user.
Leave blank or specify 'dn' to use full DN for logging in. Note also that if
your LDAP server requires you to login to perform searches, you can enter the
DN to use when searching in 'login_dn' and 'login_pass' above. You may also
specify 'string', in which case you can provide a string to use for logging
users in. See 'login_string' directly below. */
// $ldapservers->SetValue($i,'login','attr','dn');
$ldapservers->SetValue($i,'login','attr','uid');

Labels: , ,

dotProject についてのメモ

参照



php-gd


ガントチャートを使う時は php-gd が必要なので事前にインストールする。
# yum install php-gd
# apachectl graceful

インストール


  1. アーカイブをダウンロードし、任意のディレクトリに解凍
  2. ブラウザでアクセスする
  3. dotProject のインストーラ画面が表示される
  4. パーミッションの変更や、必要なモジュールなどが表示されていたら、適宜修正、インストールする
  5. install をクリック > DB 設定を入力し 'install db & write cfg' をクリック

既知の問題


jpGraph


参考: http://www.dotproject.net/vbulletin/showthread.php?t=3329

dotproject/modules/tasks/ にある以下のファイルをアップグレード。
  • gantt.php (upgrade to 1.51)
  • viewgantt.php (upgrade to 1.35)

php.ini の memory_limit 増やさないと行けない場合もある(以下は例。8Mだとダメだった)。
memory_limit = 16M

Labels: ,

Subversion の導入

インストール


次の 2 つをインストールする。
  • subversion
  • mod_dav_svn

# yum install mod_dav_svn

設定


Apache (httpd)


/etc/httpd/conf/httpd.conf で次のモジュールが読み込まれてるかどうか確認する。
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so

/etcc/http/conf.d/subversion.conf を編集して以下の内容にする。
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

<Location /repos>
DAV svn
SVNParentPath /var/www/svn
</Location>

設定を反映させる。
# apachectl graceful

ディレクトリの準備


# mkdir /var/www/svn

新しいリポジトリの作成例。次のようなディレクトリ、ファイルがあるとする。
/tmp/testproj/branches/
/tmp/testproj/tags/
/tmp/testproj/trunk/index.html

リポジトリを作成する。
# cd /var/www/svn
# svnadmin create testproj
# chown -R apache:apache testproj

testproj をインポートする。
# svn import /tmp/testproj file:///var/www/svn/testproj -m "initial import"
追加しています /tmp/testproj/trunk
追加しています /tmp/testproj/trunk/index.html
追加しています /tmp/testproj/branches
追加しています /tmp/testproj/tags

リビジョン 1 をコミットしました。

移行


別のサーバなどに移行する時は、dumpしてから移行先のマシンでloadする
# svnadmin dump /var/www/svn/testproj >/tmp/svndumpfile

# cd /var/svn
# svnadmin create testproj
# svnadmin load testproj < /tmp/svndumpfile
# chown -R apache.apache testproj

クライアント側の操作


ウェブブラウザで見る場合


http://example.com/repos/testproj/ を開く

Mac OSX の Finder で見る場合


  1. "移動" > "サーバへ接続"
  2. URL を入力する。 http://example.com/repos/testproj/

GUI クライアント



参照


Labels: ,

Samba の設定 (SWAT)

SWAT のインストール


yum install samba-swat

設定


system-config-securitylevel を実行して次の Port を通すように設定する
  • 901:tcp for SWAT
  • 137:udp, 138:udp, 139:tcp, 445:tpc for Samba

SWAT を使った Samba の設定


  1. URL を開く: http://example.com:901/
  2. Password を入力
  3. Shares から Chose Shares: Homes に
  4. Path を /home/username, select browseable yes にして Commit Changes
  5. Password へ移動
  6. username, password を入力して Add New User

クライアントの設定 (Mac OSX の場合)


  1. Finder を開く
  2. 移動 > サーバへ接続
  3. smb://servername/shared_dir
  4. username, password を入力する

Appendix


Firewall (iptables) の設定 (上記設定後の値)


# cat /etc/sysconfig/iptables

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 901 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcpps:tcp -p tcpps:tcp --dport 445 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

xinetd


場合によっては xinetd の設定をする必要がある。
# cat /etc/xinetd.d/swat 

# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat ?
# to configure your Samba server. To use SWAT, ?
# connect to port 901 with your favorite web browser.
service swat
{
port = 901
socket_type = stream
wait = no
only_from = 127.0.0.1 192.168.1.0/24
user = root
server = /usr/sbin/swat
log_on_failure == USERID
disable = no
}

Labels: , ,

ProFTPD の設定

インストール


CentOS の公式パッケージには含まれていないので、yum のリポジトリを追加する。
/etc/yum.repos.d に以下の内容で dag.repo を作成。
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
includepkgs=proftpd

そして dag リポジトリの GPG KEY をインポートする。
# rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

yum コマンドでインストールする。
# yum install proftpd

設定


proftpd.conf


LDAP で認証するように /etc/proftpd.conf を編集する。
AuthPAMConfig         proftpd
PersistentPasswd off
AuthOrder mod_auth_pam.c* mod_auth_unix.c

Firewall


system-config-securitylevel を実行して port 21 を通す。または /etc/sysconfig/iptables に以下の行を追加する。
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

起動


# service proftpd start

マシン起動時に起動するには次のようにする。
# chkconfig proftpd on

Appendix


その他の設定ファイル


/etc/pam.d/proftpd
#%PAM-1.0
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_stack.so service=system-auth
auth required pam_shells.so
account required pam_stack.so service=system-auth
session required pam_stack.so service=system-auth

パッケージの rebuild


LDAP 認証を mod_ldap を使って行う場合は、パッケージを rebuild する必要がある。
ソースのダウンロード。
# wget http://ftp.riken.jp/Linux/dag/packages/proftpd/proftpd-1.2.10-9.rf.src.rpm

rpmbuild を実行。
# rpmbuild --rebuild --target i586 --with ldap proftpd-1.2.10-9.rf.src.rpm

rebuild したパッケージのインストール。
# rpm -ivh /usr/src/redhat/RPMS/i586/proftpd-1.2.10-9.rf.i586.rpm

Labels: ,

OpenLDAP の導入

概要


LDAP を SSH, sFTP, www (Basic 認証)のログイン認証に使う。

インストールしたパッケージ


# yum list | grep ldap
nss_ldap.i386 226-10 installed
openldap.i386 2.2.13-4 installed
openldap-clients.i386 2.2.13-4 installed
openldap-devel.i386 2.2.13-4 installed
openldap-servers.i386 2.2.13-4 installed
php-ldap.i386 4.3.9-3.9 installed
python-ldap.i386 2.0.1-2 installed
compat-openldap.i386 2.1.30-4 update
mod_authz_ldap.i386 0.26-2 base
openldap-servers-sql.i386 2.2.13-4 update

# yum list | grep pam
pam.i386 0.77-66.13 installed
pam-devel.i386 0.77-66.13 installed
pam_ccreds.i386 1-3 installed
pam_krb5.i386 2.1.8-1 installed
pam_passwdqc.i386 0.7.5-2 installed
pam_smb.i386 1.1.7-5 installed

設定ファイル


# pwd
/etc/openldap
# ls -R
.:
cacerts ldap.conf schema slapd.conf

./cacerts:

./schema:
README core.schema dyngroup.schema java.schema nis.schema redhat
corba.schema cosine.schema inetorgperson.schema misc.schema openldap.schema

./schema/redhat:
autofs.schema

slapd.conf


/etc/openldap/sldapd.conf
以下のように編集する(rootpw はちゃんと変える事)。
suffix          "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"

rootpw secret

access to attrs=userPassword
by self write
by users auth
by anonymous auth

access to *
by self write
by users read
by anonymous read

この例では、ユーザは自分の情報を読み書きできるけれど、他人のパスワードを見る、または情報を書き換える事はできないように設定している。

以下はあるユーザに管理権限を与える例。
access to attrs=userPassword
by self write
by dn="uid=username,ou=People,dc=example,dc=com" write
by users read
by anonymous auth

access to *
by self write
by dn="uid=username,ou=People,dc=example,dc=com" write
by users read
by anonymous read

rootpw の暗号化


slappasswd を使う。
# slappasswd
New password:
Re-enter new password:
{SSHA}IURIkjnl/xCkPBTG5xCmLKtXfeFLFCSe

生成された文字列を slapd.conf に設定。
rootpw                  {SSHA}IURIkjnl/xCkPBTG5xCmLKtXfeFLFCSe

起動


# service ldap start

マシン起動時に LDAP も起動するには次のようにする。
# chkconfig ldap on

正常に動作しているかは、次のようにして確認できる。
# ldapsearch -v -x -b '' -s base +
ldap_initialize( <DEFAULT> )
filter: (objectclass=*)
requesting: +
# extended LDIF
#
# LDAPv3
# base <> with scope base
# filter: (objectclass=*)
# requesting: +
#

#
dn:
structuralObjectClass: OpenLDAProotDSE
namingContexts: dc=example,dc=com
supportedControl: 2.16.840.1.113730.3.4.18
supportedControl: 2.16.840.1.113730.3.4.2
supportedControl: 1.3.6.1.4.1.4203.1.10.1
supportedControl: 1.2.840.113556.1.4.1413
supportedControl: 1.2.840.113556.1.4.1339
supportedControl: 1.2.840.113556.1.4.319
supportedControl: 1.2.826.0.1.334810.2.3
supportedExtension: 1.3.6.1.4.1.1466.20037
supportedExtension: 1.3.6.1.4.1.4203.1.11.1
supportedExtension: 1.3.6.1.4.1.4203.1.11.3
supportedFeatures: 1.3.6.1.4.1.4203.1.5.1
supportedFeatures: 1.3.6.1.4.1.4203.1.5.2
supportedFeatures: 1.3.6.1.4.1.4203.1.5.3
supportedFeatures: 1.3.6.1.4.1.4203.1.5.4
supportedFeatures: 1.3.6.1.4.1.4203.1.5.5
supportedLDAPVersion: 2
supportedLDAPVersion: 3
supportedSASLMechanisms: CRAM-MD5
supportedSASLMechanisms: DIGEST-MD5
subschemaSubentry: cn=Subschema

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

#

データの入力


LDIF ファイルを使った入力


LDIF ファイルの例:
dn: dc=example,dc=com
objectClass: dcObject
objectClass: organization
o: example
dc: example

dn: ou=Users,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: users

dn: cn=FirstnameLastname,ou=Users,dc=example,dc=com
sn: Lastname
telephoneNumber: 03-1111-2222
userPassword: 1234567
mail: user@example.com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
uid: username
cn: FirstnameLastname

コマンド実行例:
# ldapadd -x -h localhost -D cn=manager,dc=example,dc=com -f ldif.txt -W
Enter LDAP Password:
adding new entry "dc=example,dc=com"

adding new entry "ou=Users,dc=example,dc=com"

adding new entry "cn=FirstnameLastname,ou=Users,dc=example,dc=com"

検索例 (uid=username):
# ldapsearch -LLL -x -h localhost -b dc=example,dc=com uid=username
dn: cn=FirstnameLastname,ou=Users,dc=example,dc=com
sn: Lastname
telephoneNumber: 00-1111-2222
userPassword:: MTIzNDU2Nw==
mail: user@example.com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
uid: username
cn: FirstnameLastname

LDAP をシステムのログイン認証に使う


PAM の設定


'authconfig' を実行して、use LDAP と use LDAP auth にチェックし、next へ進んで OK を押す。すると /etc/pam.d/system-auth に以下のように追加される。
auth        sufficient    /lib/security/$ISA/pam_ldap.so use_first_pass
account [default=bad success=ok user_unknown=ignore] /lib/security/$ISA/pam_ldap.so
password sufficient /lib/security/$ISA/pam_ldap.so use_authtok
session optional /lib/security/$ISA/pam_ldap.so

その後、system-auth に以下の行を追加。
session     required      /lib/security/$ISA/pam_mkhomedir.so skel=/etc/skel umask=0022

system-auth の例:
# cat /etc/pam.d/system-auth 
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth required /lib/security/$ISA/pam_env.so
auth sufficient /lib/security/$ISA/pam_unix.so likeauth nullok
auth sufficient /lib/security/$ISA/pam_ldap.so use_first_pass
auth required /lib/security/$ISA/pam_deny.so

account required /lib/security/$ISA/pam_unix.so broken_shadow
account sufficient /lib/security/$ISA/pam_succeed_if.so uid < 100 quiet
account [default=bad success=ok user_unknown=ignore] /lib/security/$ISA/pam_ldap.so
account required /lib/security/$ISA/pam_permit.so

password requisite /lib/security/$ISA/pam_cracklib.so retry=3
password sufficient /lib/security/$ISA/pam_unix.so nullok use_authtok md5 shadow
password sufficient /lib/security/$ISA/pam_ldap.so use_authtok
password required /lib/security/$ISA/pam_deny.so

session required /lib/security/$ISA/pam_limits.so
session required /lib/security/$ISA/pam_unix.so
session optional /lib/security/$ISA/pam_ldap.so
session required /lib/security/$ISA/pam_mkhomedir.so skel=/etc/skel umask=0022

NSS の設定


/etc/nsswitch.conf の passwd, shadow, group に ldap を追加。
passwd:     files ldap
shadow: files ldap
group: files ldap

既存ユーザの移行


移行ツールの設定

/usr/share/openldap/migration/migrate_common.ph の $DEFAULT_MAIL_DOMAIN と $DEFAULT_BASE を修正する。
# Default DNS domain
$DEFAULT_MAIL_DOMAIN = "example.com";

# Default base
$DEFAULT_BASE = "dc=example,dc=com";

移行ツールを実行する

# /usr/share/openldap/migration/migrate_passwd.pl /etc/passwd ./ldifpasswd.txt
# /usr/share/openldap/migration/migrate_group.pl /etc/group ./ldifgroup.txt

./ldifpasswd.txt と ldifgroup.txt が作成される。これらの上位エントリ 'ou=People,dc=example,dc=com' 用の ldif ファイルを作成する。
例:
dn: ou=People,dc=example,dc=com
ou: People
objectClass: top
objectClass: organizationalUnit

dn: ou=Group,dc=example,dc=com
ou: Group
objectClass: top
objectClass: organizationalUnit

このエントリを最初に登録する。
# ldapadd -x -h localhost -D cn=manager,dc=example,dc=com -f ldif.txt -W
Enter LDAP Password:
adding new entry "ou=People,dc=example,dc=com"

移行ツールで作った ldifpasswd.txt から uid が 100 以下のものと 65000 以上のものを削除する(これらはシステムが使用するユーザなので)。その後、以下のように実行する。
# ldapadd -x -h localhost -D cn=manager,dc=example,dc=com -f ldifpasswd.txt -W
Enter LDAP Password:
adding new entry "uid=username,ou=People,dc=example,dc=com"

# ldapadd -x -h localhost -D cn=manager,dc=example,dc=com -f ldifgroup.txt -W
Enter LDAP Password:
adding new entry "ou=People,dc=example,dc=com"

確認手順

  1. /etc/passwd にユーザがいない事を確認
  2. /home/username を作成し、owner をそのユーザに変更
  3. そのユーザでログインする(ログインできるはず)
  4. LDAP を停止して、同じユーザでログインする(ログインできないはず)
  5. そのユーザのホームディレクトリを削除
  6. LDAP を起動して、そのユーザでログインする(ログインできて、ホームディレクトリが作成される)

実行例:
# grep username /etc/passwd
# mkdir /home/username
# chown username /home/username
# ls -l /home
合計 16
drwxr-xr-x 2 username root 4096 3月 5 15:24 username

$ ssh username@example.com
username@example.com's password:
Last login: Mon Aug 22 22:42:17 2005 from 192.168.1.2
-bash-3.00$

# service ldap stop
# ls -l /home
合計 16
drwxr-xr-x 2 500 root 4096 3月 5 15:28 username

$ ssh username@example.com
username@example.com's password:
Permission denied, please try again.
username@example.com's password:

# rm -r /home/username
rm: descend into directory `/home/username'? y
rm: remove 通常ファイル `/home/username/.bash_history'? y
rm: remove ディレクトリ `/home/username'? y
# service ldap start

$ ssh username@example.com
username@example.com's password:
Creating directory '/home/username'.
Last login: Sun Mar 5 15:25:28 2006 from 192.168.1.2

Labels: ,

MySQL の導入

インストール


# yum install mysql-server

参考: MySQL関連でインストール済みのソフトウェア(2006/07/25現在)
# yum list installed | grep mysql
mysql.i386 5.0.22-1.centos.1 installed
mysql-server.i386 5.0.22-1.centos.1 installed
mysqlclient14.i386 4.1.14-4.2.c4.1 installed
php-mysql.i386 5.0.4-5.centos4 installed

起動


デーモンの起動。
# service mysqld start

システム起動時に起動する。
# chkconfig mysqld on

root password の変更


# mysqladmin -u root password 'mynewpassword'

パスワードを変更したら、次のコマンドを実行。
# mysqladmin -h hostname flush-privileges

参照


Labels: ,

JBoss (4.0.2) のセットアップ

Set up


JDK のインストール


  1. J2SE JDK を Sun (J2SE 1.5) からダウンロード
  2. ./jdk-1_5_0_05-linux-i586.rpm.bin を実行する

JBoss のインストール


  1. JBoss Application Server を JBoss.org からダウンロード
  2. アーカイブを解凍し、任意のディレクトリに保存する

# cd /usr/local
# tar xjvf jboss-4.0.2.tar.bz2

/usr/local/jboss-4.0.2/bin/run.conf を編集し JAVA_HOME を設定
JAVA_HOME="/usr/java/jdk1.5.0_05"
JAVA="$JAVA_HOME/bin/java"

Frewall を設定


JBoss を port 8080 で使用する場合、system-config-securitylevel などで tcp:8080 を通すよう設定する。

起動と終了


JBoss を起動する


# cd /usr/local/jboss-4.0.2/bin
# ./run.sh

run.sh は設定ファイルを相対パスで見ているようなので、ディレクトリを移動する。
終了する時は ctrl + c を押す。

バックグラウンドで起動する場合


# cd /usr/local/jboss-4.0.2/bin
# ./run.sh &

終了するには、shutdown.sh -S を実行する。

Labels: ,

Exim の設定

設定 (とりあえず動かすだけ)


/etc/exim/exim.conf

変更箇所
domainlist local_domains = @
domainlist relay_to_domains =
hostlist relay_from_hosts = 127.0.0.1

acl_check_rcpt:
accept hosts = : 127.0.0.1

Labels: ,

Apache の設定

httpd.conf


/etc/httpd/conf/httpd.conf

Load Module


mime_magic_module をコメントアウト。
# LoadModule mime_magic_module modules/mod_mime_magic.so

Document Root


CGI を有効にする。
<Directory "/var/www/html">
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Add Handler


このサーバで CGI を有効にする為に、コメント(#)を削除。
AddHandler cgi-script .cgi

Twiki を使う為の設定


/etc/httpd/conf.d に twiki.conf を作成。
#ScriptAlias /twiki/bin/ "/var/www/html/twiki/bin/"
#Alias /twiki/ "/var/www/html/twiki/"
<Directory "/var/www/html/twiki/bin">
Options +ExecCGI
SetHandler cgi-script
AllowOverride All
Allow from all
</Directory>
<Directory "/var/www/html/twiki/pub">
Options FollowSymLinks +Includes
AllowOverride None
Allow from all
</Directory>
<Directory "/var/www/html/twiki/data">
deny from all
</Directory>
<Directory "/var/www/html/twiki/templates">
deny from all
</Directory>

Basic 認証で LDAP を使う


httpd.conf


/etc/httpd/conf/httpd.conf に LoadModule を追加する。
LoadModule ldap_module modules/mod_ldap.so
LoadModule auth_ldap_module modules/mod_auth_ldap.so

.htaccess


認証をさせるディレクトリに保存する .htaccess の例
AuthType Basic
AuthName "Enter User and Password, please."
AuthLDAPURL ldap://localhost:389/ou=People,dc=example,dc=com?uid
require user username1

SSL を使う


CA の作成


/usr/share/ssl/openssl.cnf の "dir" 行を編集する。
dir             = ./demoCA              # Where everything is kept

/usr/share/ssl/misc にある CA スクリプトを実行する。
# pwd
/usr/share/ssl/misc
# ./CA -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:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Tokyo
Locality Name (eg, city) [Newbury]:
Organization Name (eg, company) [My Company Ltd]:example
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:example
Email Address []:

CA は /usr/share/ssl/misc/demoCA に作成される。
# pwd
/usr/share/ssl/misc/demoCA
# ls
cacert.pem certs crl index.txt newcerts private serial

CSR の生成


# pwd
/etc/httpd/conf
# openssl req -new -nodes -keyout ./ssl.key/examplekey.pem -out ./ssl.csr/examplereq.pem
Generating a 1024 bit RSA private key
.......................++++++
..++++++
writing new private key to './ssl.key/examplekey.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Tokyo
Locality Name (eg, city) [Newbury]:
Organization Name (eg, company) [My Company Ltd]:example
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:host1.example.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:xxxxxxxx
An optional company name []:

cert ファイルの作成


# pwd
/usr/share/ssl/misc
# man cp
# cp -p /etc/httpd/conf/ssl.csr/examplereq.pem .
# openssl ca -out stonedsoulcert.pem -infiles examplereq.pem
Using configuration from /usr/share/ssl/openssl.cnf
Enter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: Mar 25 03:47:17 2006 GMT
Not After : Mar 25 03:47:17 2007 GMT
Subject:
countryName = JP
stateOrProvinceName = Tokyo
organizationName = example
commonName = host1.example.com
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
84:26:DA:3E:57:4D:70:89:FA:0F:D9:0A:46:0A:1C:A8:20:AA:40:2F
X509v3 Authority Key Identifier:
keyid:29:71:7A:54:BC:F3:08:1D:66:49:67:4E:CC:58:E8:5C:78:07:2E:E4
DirName:/C=JP/ST=Tokyo/L=Newbury/O=example/CN=example
serial:00

Certificate is to be certified until Mar 25 03:47:17 2007 GMT (365 days)
Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
# cp -p demoCA/cacert.pem /etc/httpd/conf/ssl.crt/
# cp -p examplecert.pem /etc/httpd/conf/ssl.crt/

Apache の設定


/etc/httpd/conf.d/ssl.conf の以下の行を編集する。
SSLCertificateFile /etc/httpd/conf/ssl.crt/examplecert.pem
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/examplekey.pem
SSLCertificateChainFile /etc/httpd/conf/ssl.crt/cacert.pem

Virtual host の設定例


document root の準備


# cd /
# mkdir virtual
# mkdir virtual/example
# mkdir virtual/example/public_html
# mkdir virtual/example/public_html/www.example.com
# chown -R apache:apache virtual

Port-based Virtual host の場合


この例では port 番号 8000 を使う。

これらの URL をリクエストすると /virtual/example/public_html/www.example.com/ にあるコンテンツを表示するように設定する。

httpd.conf

/etc/httpd/conf/httpd.conf
Listen 8000
Listen 8443

NameVirtualHost 192.168.1.11:8000
NameVirtualHost 192.168.1.11:8443

<VirtualHost 192.168.1.11:8000>
ServerAdmin root@host1.example.com
DocumentRoot /virtual/stonedsoul/public_html/www.example.com
ServerName 192.168.1.11:8000
ErrorLog logs/8000-error_log
</VirtualHost>

<VirtualHost 192.168.1.11:8443>
ServerAdmin root@host1.example.com
DocumentRoot /virtual/example/public_html
ServerName 192.168.1.11:8443
ErrorLog logs/8443-error_log
</VirtualHost>

Firewall の設定

system-config-securitylevel を実行して port 8000 と 8443 を通すと以下のようになる。

/etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8443 -j ACCEPT

Name-based Virtual host の場合



前者の URL がリクエストされたら /var/www/html のコンテンツを、後者の場合は /virtual/example/public_html/www.example.com/ のコンテンツを表示するように設定する。

httpd.conf

/etc/httpd/conf/httpd.conf
Listen 80

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName host1.example.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /virtual/example/public_html/example.com
ServerName host2.example.com
ErrorLog logs/vh1-error_log
</VirtualHost>

<VirtualHost *:443>
DocumentRoot /virtual/example/public_html
ServerName host2.example.com
ErrorLog logs/vh2-error_log
</VirtualHost>

Labels: ,

MAMP についてのメモ

Pear


MAMP では Pear は以下のディレクトリにインストールされる。
/Applications/MAMP/bin/php4/bin
/Applications/MAMP/bin/php5/bin

参照

Labels: , ,

Mac OSX への Trac インストール

fink を使ったインストール

  1. fink をアップグレード
  2. SQLite をインストール
  3. Subversion をインストール
  4. Trac をインストール

例: SSL 接続をしない場合
$ fink selfupdate
$ fink install sqlite sqlite-dev sqlite-shlibs
$ fink install svn svn-client svn-swig-py24
$ fink install trac-py24

設定


trac-admin


$ trac-admin /path/to/projectenv initenv
$ sudo chown -R www /path/to/projectenv

Apache


/etc/httpd/httpd.conf に以下のような内容を追加する。
# configuration for trac
Alias /trac/ /sw/share/trac/htdocs/
RewriteEngine On

<Directory \"/sw/share/trac/htdocs/\">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Location \"/trac/login\">
AuthType Basic
AuthName \"trac\"
AuthUserFile /sw/share/trac/proj/conf/trac.htpasswd
Require valid-user
</Location>

SetEnv TRAC_ENV \"/sw/share/trac/proj/\"
ScriptAliasMatch ^/trac(.*) /sw/share/trac/cgi-bin/trac.cgi$1

Trac web admin

  1. http://peak.telecommunity.com/dist/ez_setup.py をダウンロード
  2. ez_setup.py を実行 <code>sudo python ez_setup.py</code>
  3. python のバージョンに合った TracWebAdmin をダウンロード (例えば、python 2.4 を使っているのなら TracWebAdmin?-0.1dev_r2440-py2.4.egg.zip をダウンロードする)
  4. 拡張子 .zip を取る
  5. easy_install でインストール

$ sudo easy_install TracWebAdmin-0.1dev_r2440-py2.4.egg

web admin を有効にする為、trac.ini を編集する (以下を追記)。
[components]
webadmin.* = enabled

特定のユーザに admin 権限を与える
$ sudo trac-admin /sw/share/trac/proj permission add username TRAC_ADMIN

参照

Labels: , ,

Subversion のインストール (Mac)

インストール


Subversion は fink のパッケージにあるので、fink をつかってインストールできる。svn と svn-client をインストールするには以下のようにする。
fink install svn svn-client

GUI の svn クライアント

  • SCPlugin - Tourtois SVN のように、右クリックメニューから commit などができる。

参照

Labels: , ,

Fink の使い方

参照


準備


Fink を使うには、インストール DVD から Xcode Tools をインストールする必要がある。DVD 内の /Application/Installers/Developer Tools/Developer.mpkg が該当のパッケージ。

インストール

  1. Official Site からインストーラをダウンロードする
  2. インストール

Note


Fink はパッケージを /sw 以下にインストールする。

Labels: ,

coLinux のインストールと設定

coLinux のインストール

  1. sourceforgeからインストーラをダウンロード
  2. インストーラを実行(TAP-Win32もインストール)

参考: http://www.geocities.jp/error_storm/colinux1.html


CentOS のセットアップ

  1. coLinux 用 インストーラからCentOS用をダウンロード
  2. CentOSのダウンロードサイトからCD-ROM用のisoをダウンロード
  3. インストーラの手順に従ってインストールを実行

coLinux の設定

  1. 設定ファイルを記述(例は以下)
  2. 起動
c:
cd "\\Program Files\\coLinux"
colinux-daemon.exe -c centos4.colinux.xml -t nt

Windowsのサービスに登録する場合はコマンドプロンプトで以下を実行:
colinux-daemon.exe -c centos4.colinux.xml --install-service

設定ファイルの例

coLinux (XML)
<?xml version="1.0" encoding="UTF-8"?>
<colinux>
<block_device index="0" path="\DosDevices\c:\Program Files\coLinux\root.ext3" enabled="true" />
<block_device index="1" path="\DosDevices\c:\Program Files\coLinux\fs_128Mb" enabled="true" />
<cofs_device index="0" type="flat" path="\DosDevices\C:\" enabled="true" />
<bootparams>root=/dev/cobd0 fastboot</bootparams>
<initrd path="initrd.gz" />
<image path="vmlinux" />
<memory size="128" />
<network index="0" type="tap" />
</colinux>


CentOS の設定

ネットワーク設定

/etc/resolve.conf
search dns.example.com
nameserver 192.168.0.2 #your DNS

/etc/hosts
127.0.0.1       colinux.example.com   colinux localhost

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=colinux

/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.0.40
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
HOSTNAME=colinux
DOMAIN=example.com
# HWADDR=00:ff:52:00:00:00
TYPE=Ethernet


C ドライブのマウント

mkdir /mnt/win

/etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/cobd0 / ext3 defaults 1 1
/dev/cobd1 swap swap defaults 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /sys sysfs defaults 0 0
cofs0 /mnt/win cofs defaults 0 0 # added


Windows XP の設定

ネットワーク設定

  1. "マイ ネットワーク" のプロパティを表示
  2. "ローカルエリア接続" 等のTAPとは違う側のネットワークのプロパティを表示
  3. 共有タブの "この接続でインターネット接続の共有を使用可能にする(E)" にチェックを付ける


参照

coLinux

CentOS

Labels: ,

Search

 

Contents

My Photo
Name: izmi
Location: Tokyo, Japan

Recent Posts

Archives