CentOS 5 で OpenLDAP によって LDAP ユーザーサービスを提供する

CentOS 5.3 で環境構築にあたってのメモ。 ベースDNは dc=tilfin,dc=local とする。 グループ tilfin とそれに属するユーザー tosshi を追加する。 openldap パッケージをインストール # yum install openldap-clients # yum install openldap-servers /etc/openldap/slapd.conf の設定 suffix “dc=tilfin,dc=local” rootdn “cn=Manager,dc=tilfin,dc=local” rootpw secret パスワード属性に対する制限を追記 ######################################################## # Set Permisson “userPassword” access to attrs=userPassword by self write by anonymous auth by * none # Set Permission except “userPassword” access to * by self write by * read DB パラメータの配置 # cd /var/lib/ldap # cp /etc/openldap/DB_CONFIG.example DB_CONFIG # chgrp ldap DB_CONFIG ...

2009年5月6日 · Toshimitsu Takahashi

CentOS 5 に 9Arrows を導入したときのメモ

以前、何かハマって止めていました。もう一度試してみることにして、ようやく成功しました。 PostgreSQL をインストール 普段 MySQL ばかりだったが、9Arrows は Postgres を要求しているのでインストールします。 CentOS なので、例によって yum を使いました。postgres ユーザも作成されます。 devel も入れるのは、このあと pg_config を gem で pg を入れるときに必要になるためです。 # yum install postgresql.i386 # yum install postgresql-devel.i386 PostgreSQL の初期設定 postgres ユーザになって initdb そして postmaster を起動します。 # su - postgres $ initdb $ pg_ctl -D /var/lib/pgsql/data -l logfile start 9arrows_production データベースと Postgres 上に 9arrows ユーザーを作成しておきます。 さらに 9arrows_production データベース に 9arrows ユーザーをパスワード「9arrows」で割り当てます。 $ createdb 9arrows_production CREATE DATABASE $ createuser 9arrows Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) n Shall the new role be allowed to create more new roles? (y/n) n CREATE ROLE $ psql 9arrows_production 9arrows_production=# ALTER USER “9arrows” with password ‘9arrows’; ALTER ROLE 9arrows_production=# \q <== [CTRL + D] ...

2009年1月24日 · Toshimitsu Takahashi

CentOS 5 で既存 Subversion リポジトリを Git から使えるようにする

Git 参考にしたもの git-svnを使って既存のSVNリポジトリでGitを使う方法のメモ - Hello, world! - s21g git-svnメモ - I sort my thought… インストール 標準パッケージに Git はないので、RPMForge を yum で使う設定が必要 CentOS 5.2 で yum の対象リポジトリに RPMforge を追加するには - Tosshi Note # yum install –enablerepo=rpmforge (省略) Dependencies Resolved Package Arch Version Repository Size Installing for dependencies: git i386 1.5.2.1-1.el5.rf rpmforge 27 M perl-Compress-Zlib i386 1.42-1.fc6 base 52 k perl-Error noarch 0.17015-1.el5.rf rpmforge 27 k perl-Git i386 1.5.2.1-1.el5.rf rpmforge 18 k perl-HTML-Parser i386 3.55-1.fc6 base 92 k perl-HTML-Tagset noarch 3.10-2.1.1 base 15 k perl-libwww-perl noarch 5.805-1.1.1 base 376 k subversion-perl i386 1.4.2-2.el5 base 748 k Transaction Summary Install 8 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 28 M (省略) Running Transaction Installing: perl-Error ######################### [1/8] Installing: subversion-perl ######################### [2/8] Installing: perl-HTML-Tagset ######################### [3/8] Installing: perl-HTML-Parser ######################### [4/8] Installing: perl-Compress-Zlib ######################### [5/8] Installing: perl-libwww-perl ######################### [6/8] Installing: perl-Git ######################### [7/8] Installing: git ######################### [8/8] Dependency Installed: git.i386 0:1.5.2.1-1.el5.rf perl-Compress-Zlib.i386 0:1.42-1.fc6 perl-Error.noarch 0:0.17015-1.el5.rf perl-Git.i386 0:1.5.2.1-1.el5.rf perl-HTML-Parser.i386 0:3.55-1.fc6 perl-HTML-Tagset.noarch 0:3.10-2.1.1 perl-libwww-perl.noarch 0:5.805-1.1.1 subversion-perl.i386 0:1.4.2-2.el5 Complete! ...

2009年1月16日 · Toshimitsu Takahashi

CentOS 5 に Plone 3.1 をインストールしたのでその手順

Python の有名な CMS である Plone を入れてみることにしました。現在の最新リリースは 3.1.7 のようです。 Plone 4 : パワフルで高速なCMS — Plone - エンタープライズ・オープンソースCMS Plone Users Group Japan に日本語の情報があります。 ダウンロード http://plone.org/products/plone の Get Plone for Linux/BSD/Unix (33MB) Unified Installer - for Linux/BSD/OS X/UNIX/Solaris (compiles and installs) を使います。 % wget http://launchpad.net/plone/3.1/3.1.7/+download/Plone-3.1.7ex-UnifiedInstaller.tgz % tar zxvf Plone-3.1.7ex-UnifiedInstaller.tgz % cd Plone-3.1.7ex-UnifiedInstaller インストール README.txt によると、install.sh をたたくだけでインストールできるようです。 Python は /usr のものを使いたいので –with-Python オプションで指定しました。–target でインストールディレクトリを指定します。デフォルトは /opt/Plone-3.1 になるみたいです。私は、/proj に何か試すときはいつも入れているので、そちらを指定しました。サービスユーザーとしてデフォルトで plone が追加されます。これはそのままにしました。 % sudo ./install.sh --target=/proj/Plone-3.1 --with-python=/usr/bin/python standalone Stand-Alone Zope Instance selected Detailed installation log being written to /home/tosshi/plone/Plone-3.1.7ex-UnifiedInstaller/install.log \\nTesting /usr/bin/python for Zope/Plone requirements.... Warning: the Python Imaging Library is missing. We'll try to build it, but watch for problems. /usr/bin/python looks OK. We'll try to use it. Root install method chosen Installing Plone 3.1.6 at /proj/Plone-3.1 Creating python virtual environment... New python executable in /proj/Plone-3.1/Python-2.4/bin/python Installing setuptools.............done. Skipping zlib compile and install Skipping libjpeg compile/install Skipping readline compile/install Python found at /proj/Plone-3.1/Python-2.4/bin/python; Skipping Python install. Installing PIL Installing Cheetah template engine Unpacking buildout cache to /proj/Plone-3.1/buildout-cache Compiling .py files in egg cache id: plone: そのようなユーザは存在しません Adding user account 'plone' to system ... Generating random password ... Copying standalone buildout template Running buildout Creating directory '/proj/Plone-3.1/zinstance/parts'. Creating directory '/proj/Plone-3.1/zinstance/develop-eggs'. Installing plone. Installing zope2. running build_ext creating zope.proxy copying zope/proxy/proxy.h -> zope.proxy building 'AccessControl.cAccessControl' extension creating build creating build/temp.linux-i686-2.4 creating build/temp.linux-i686-2.4/AccessControl (省略) running build_ext Installing productdistros. Installing instance. Generated script '/proj/Plone-3.1/zinstance/bin/instance'. Generated script '/proj/Plone-3.1/zinstance/bin/repozo'. Installing zopepy. Generated interpreter '/proj/Plone-3.1/zinstance/bin/zopepy'. Installing zopeskel. Generated script '/proj/Plone-3.1/zinstance/bin/paster'. Installing chown. chown: Running chmod 600 .installed.cfg find /proj/Plone-3.1/zinstance -type d -name var -exec chown -R plone \\{\\} \\; find /proj/Plone-3.1/zinstance -type d -name LC_MESSAGES -exec chown -R plone \\{\\} \\; find /proj/Plone-3.1/zinstance -name runzope -exec chown plone \\{\\} \\; Unused options for chown: 'update-command'. Installing unifiedinstaller. Generated script '/proj/Plone-3.1/zinstance/bin/plonectl'. Installing precompile. precompiling python scripts in /proj/Plone-3.1/zinstance/products precompiling python scripts in /proj/Plone-3.1/zinstance/parts/productdistros precompiling python scripts in /proj/Plone-3.1/zinstance/parts/plone Creating Plone site... This is the first start of this instance. Creating Data.fs and a Plone site. We only need to do this once, but it takes some time. Creating Plone site at /Plone in ZODB... Installed Plone standard content Finished adding Plone site ##################################################################### ###################### Installation Complete ###################### Plone successfully installed at /proj/Plone-3.1 See /proj/Plone-3.1/zinstance/README.txt for startup instructions Use the account information below to log into the Zope Management Interface The account has full 'Manager' privileges. Username: admin Password: xxxxxxxxx This account is created when the object database is initialized. If you change the password later, you'll need to use the new password. Ask for help on plone-users list or #plone Submit feedback and report errors at http://dev.plone.org/plone . For install problems, specify component "Installer (Unified)." 上記のとおり、Zope の初期アカウントの Username と Password が表示されます。/proj/Plone-3.1/zinstance/adminPassword.txt にあるのでメモし忘れても平気です。 /proj/Plone-3.1/zinstance/README.txt を見ろとある。 ...

2009年1月12日 · Toshimitsu Takahashi

CentOS に慣れた人が Ubuntu を使うときの管理コマンドの対応メモ

Ubuntu の VMWare 版を使う機会があったので、メモを書いておく。 要するに Fedora (Redhat) と Debian の対応の話です。 パッケージ管理 Redhat の yum は、Debian では apt なお、Redhat 系でも apt を使うことはできる。http://ayo.freshrpms.net/ サービスのランレベルに応じた起動管理 Redhat の chkconfig は、Debian では sysv-rc-conf Ubuntu (VMWare) には sysv-rc-conf が入っていなかったのでインストール。 # apt-get install system-rc-conf sysv-rc-conf は chkconfig と異なり、コマンドベースではなく表を直接編集できる。 # sysv-rc-conf サービスの操作 もちろん、/etc/init.d/service で扱える。 Debian で Redhat の service を使うには、debian-helper-scripts をインストールすると使える。 # apt-get install debian-helper-scripts

2009年1月9日 · Toshimitsu Takahashi

CentOS 5 で NFS デーモンのプロセス数を変えるには

VMWare で動かしている CentOS 上で NFS を起動しているが、たまに Mac から接続するときくらいしか使わない。 一般的にどの OS も NFS は起動スクリプトで 8 個のプロセス(インスタンス)を起動する。こんなにいらないので減らすことにした。 /etc/sysconfig/nfs の RPCNFSDCOUNT でスタート時のプロセス数を設定できる。とりあえず半分にしてみる。 /etc/sysconfig/nfs # Number of nfs server processes to be started. # The default is 8. RPCNFSDCOUNT=4 反映 # service nfs restart # ps -ef | grep nfs root 2422 7 0 16:43 ? 00:00:00 \[nfsd4\] root 2423 1 0 16:43 ? 00:00:00 \[nfsd\] root 2424 1 0 16:43 ? 00:00:00 \[nfsd\] root 2425 1 0 16:43 ? 00:00:00 \[nfsd\] root 2426 1 0 16:43 ? 00:00:00 \[nfsd\] ということで減りました。

2009年1月6日 · Toshimitsu Takahashi

手軽に QR コードの画像ファイルを生成できる Ruby ライブラリ rqr を試す

「ruby qrcode」でググると Y.Swetake さんの QRコードクラスライブラリ for Ruby - QRcode encode class library for Ruby が真っ先にヒットする。だが、単に php 版から移植したと説明されているのと beta 版ということもあって躊躇っていた。 RubyForge にないのかと探していたところ rqr - http://rqr.rubyforge.org/ が見つかった。 バイナリ出力をするのではなくファイルに書き出すだけの簡単な仕様になっている。また、libjpeg, libpng, libtiff を使用しているので予めインストールしておく必要がある。 yum で依存ライブラリをインストール # yum install libjpeg.i386 # yum install libpng.i386 # yum install libtiff.i386 rubygems でインストール # gem install rqr CGI を作ってみる パラメータのテキストを QRコード で返す CGI を作成してみる。 #!/usr/bin/env ruby require “rubygems” require “rqr” require “cgi” # QRcode を PNG 形式のバイナリで返す def get_qrcode_bytes(text) filepath = “/tmp/qrcode” + $$.to_s + “.png” RQR::QRCode.create do |qr| qr.save(text, filepath) end bytes = File.read(filepath) File.delete(filepath) return bytes end cgi = CGI.new text = cgi[“text”] cgi.out(“image/png”) { get_qrcode_bytes(text) } ...

2008年12月16日 · Toshimitsu Takahashi

CentOS 5 で増設したハードディスクをマウントするには

CentOS 5.2 において IDE 接続した二番目の HDD を /storage としてマウントするまでの手順をまとめた。 fdisk で領域作成 二番目の IDE 接続しているディスク /dev/hdb を指定する。 # fdisk /dev/hdb デバイスは正常な DOS 領域テーブルも、Sun, SGI や OSF ディスクラベルも 含んでいません 新たに DOS ディスクラベルを作成します。あなたが書き込みを決定するまで、変更は メモリ内だけに残します。その後はもちろん以前の内容は修復不可能になります。 このディスクのシリンダ数は 26630 に設定されています。 間違いではないのですが、1024 を超えているため、以下の場合 に問題を生じうる事を確認しましょう: ブート時に実行するソフトウェア (例. バージョンが古い LILO) 別の OS のブートやパーティション作成ソフト (例. DOS FDISK, OS/2 FDISK) 警告: 領域テーブル 4 の不正なフラグ 0x0000 は w(書き込み)によって 正常になります コマンド (m でヘルプ): p Disk /dev/hdb: 12.8 GB, 12884901888 bytes 15 heads, 63 sectors/track, 26630 cylinders Units = シリンダ数 of 945 * 512 = 483840 bytes デバイス Boot Start End Blocks Id System コマンド (m でヘルプ): n コマンドアクション e 拡張 p 基本領域 (1-4) p 領域番号 (1-4): 1 最初 シリンダ (1-26630, default 1): Using default value 1 終点 シリンダ または +サイズ または +サイズM または +サイズK (1-26630, default 26630): Using default value 26630 コマンド (m でヘルプ): p Disk /dev/hdb: 12.8 GB, 12884901888 bytes 15 heads, 63 sectors/track, 26630 cylinders Units = シリンダ数 of 945 * 512 = 483840 bytes デバイス Boot Start End Blocks Id System /dev/hdb1 1 26630 12582643+ 83 Linux コマンド (m でヘルプ): w 領域テーブルは交換されました! ioctl() を呼び出して領域テーブルを再読込みします。 ディスクを同期させます。 ext3 形式でファイルシステムの作成 mkfsを使用してext3形式で領域 /dev/hdb1 のファイルシステムを作成する。 ...

2008年11月22日 · Toshimitsu Takahashi

CentOS 5.2 で yum の対象リポジトリに RPMforge を追加するには

RPMforge (http://rpmrepo.org/RPMforge) はサードパーティ製のRPMパッケージ群のリポジトリである。lighttpd を試したかったので、yum で RPMforge を扱えるようにしたときのメモ。 http://wiki.centos.org/AdditionalResources/Repositories/RPMForge を見ると手順が書かれている。 Priorities のインストール これをインストールするのはリポジトリに優先度を付加して通常の update / upgrade 時には RPMforge などを含まないようにしておくためである。 # yum install yum-priorities cat /etc/yum/pluginconf.d/priorities.conf で確認するとデフォルトで次のようになっているはず、なっていなかったらこのとおりに修正する。 [main] enabled=1 RPMforge のパッケージをインストール 以下はテンポラリなディレクトリで行う。 パッケージをダウンロード アーキテクチャに合わせて i386 もしくは x86_64 のパッケージをダウンロードする。 $ wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm GPG key をインポート # rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt パッケージの認証 # rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm パッケージをインストール # rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm リポジトリファイルに優先度を付加 /etc/yum.repos.d/*.repo にマッチするファイルを開いて各セクションに priority=Nを定義していく。 CentOS-Base.repo # CentOS-Base.repo # This file uses a new mirrorlist system developed by Lance Davis for CentOS. # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. ...

2008年10月9日 · Toshimitsu Takahashi

CentOS 5.2 に Dovecot で POP3 / IMAP サーバをセットアップする

昨日のエントリの続き、Dovecot を使って POP3 や IMAP でメールを読めるようにしたときのメモ。 パッケージのインストール # yum install dovecot.i386 設定 /etc/dovecot.conf プロトコルの設定 imaps pop3s は設定しているものの、SSLが未設定なので LISTEN されない。imap pop3 は多少セキュリティを高めるためにポート番号を通常から変更している。必要無ければ2行目以降は不要である。 protocols = imap imaps pop3 pop3s protocol imap { listen = *:10143 } protocol pop3 { listen = *:10110 } ログイン用の常駐プロセスの設定 メモリに余力もなく接続をどんどんするわけでもないので、キープするのは 3 から 1つに減らした。合わせてプロセスと接続の最大数も減らした。 login_processes_count = 1 login_max_processes_count = 16 login_max_connections = 32 Maildir を使用 mail_location = maildir:~/Maildir ファイアウォールの設定 /etc/sysconfig/iptables ※この例では POP は 10110番、IMAP は 10143番としている(普通は 110, 143)。 -A INPUT -p tcp -m tcp –dport 10110 -j ACCEPT -A INPUT -p tcp -m tcp –dport 10143 -j ACCEPT ...

2008年10月8日 · Toshimitsu Takahashi