vSphere Remote CLI on CentOS 5.3

CentOS 5.3にvSphere Remote CLIを入れてみたが動かない。

$ vmware-cmd --server vir.example.jp --user root -l
Enter password:
Error: Server version unavailable at 'https://vir.example.jp/sdk/vimService.wsdl'

$

PerlモジュールのCrypt::SSLeayのバージョンが低かった模様。
perl-Crypt-SSLeayパッケージを入れていたが、こちらをCPANから入れなおす。

# yum remove perl-Crypt-SSLeay
# yum -y install openssl-devel.x86_64 gcc
# perl -MCPAN -e shell
cpan> install Crypt::SSLeay
:
cpan> exit

そしてvSphere Remote CLIを再度インストール。

# ./vmware-vsphere-cli-distrib/vmware-install.pl

Debianでiptables設定

Debianでiptablesを設定する方法。
iptables - Debian Wiki
Red Hat等と違って設定用のパッケージを何かしら入れるか、手動で設定してあげる必要があります。

Oracle Express Editionインストール

Oracle Express EditionをCentOS 5.3(x86_64,最小構成インストール)にインストールした際のメモ。
Oracle 11g R2も出荷されたことだし、XEも11gになることを期待。

前提パッケージの導入

# yum -y install libaio.i386 bc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
 * addons: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
base                                                                                             | 1.1 kB     00:00
updates                                                                                          |  951 B     00:00
addons                                                                                           |  951 B     00:00
extras                                                                                           | 1.1 kB     00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package libaio.i386 0:0.3.106-3.2 set to be updated
---> Package bc.x86_64 0:1.06-21 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                    Arch                       Version                           Repository                Size
========================================================================================================================
Installing:
 bc                         x86_64                     1.06-21                           base                     110 k
 libaio                     i386                       0.3.106-3.2                       base                      19 k

Transaction Summary
========================================================================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 129 k
Downloading Packages:
(1/2): libaio-0.3.106-3.2.i386.rpm                                                               |  19 kB     00:00
(2/2): bc-1.06-21.x86_64.rpm                                                                     | 110 kB     00:00
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   275 kB/s | 129 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : bc                                                [1/2]
  Installing     : libaio                                            [2/2]

Installed: bc.x86_64 0:1.06-21 libaio.i386 0:0.3.106-3.2
Complete!
#

※bcはpost-installスクリプトで使われている

oracle-xe-univパッケージの導入

# rpm -Uvh oracle-xe-univ-10.2.0.1-1.0.i386.rpm
Preparing...                ########################################### [100%]
   1:oracle-xe-univ         ########################################### [100%]
Executing Post-install steps...

You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

#

Oracle XE設定

# /etc/init.d/oracle-xe configure

Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g Express
Edition.  The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts.  Press  to accept the defaults.
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:

Specify a port that will be used for the database listener [1521]:

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of
different passwords for each database account.  This can be done after
initial configuration:
Confirm the password:

Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:

Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8080/apex"
#

Database Home Pageにloclhost以外からもアクセスできるようにする

# . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
# sqlplus system

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Sep 27 13:11:58 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

PL/SQL procedure successfully completed.

SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
#

参考資料
Oracle® Database Express Edition Installation Guide 10g Release 2 (10.2) for Linux

削除してしまったSSL秘密鍵をhttpdプロセスから復元

[Apache-Users 7417] 誤消去してしまった秘密鍵の復元
から始まるスレッドでの話題です。
そんなの無理だろうと思っていたら、gdbでhttpdプロセスにcore吐かせて、その中に秘密鍵らしき部分をみつけたとのこと。

Boot Options

Debianではブート時のboot:プロンプトなりgrub menu.lstのkernel行で、起動時のオプションをいろいろ指定できる。

Debian公式のドキュメントは見つけられなかったが、Ubuntuのドキュメントではこちらに記載があった。
BootOptions - Community Ubuntu Documentation
Ubuntuではkernel自身へのオプション(Kernel Options)とinit実行時にbreak pointが設定できること(Initrd break points)が書かれている。

initrd組み込みのinit実行時に指定できるオプションは他にもあって、これは元になる/usr/share/initramfs-tools/initをみるのが手っ取り早い。
たとえばroot=の指定はrootファイルシステムとしてマウントする対象を判定するために使われる、ということがわかる。

WordPressのアップロード先を「年/月/日/post_id」にしてみる

久しぶりにWordPressを触ってる。
で、画像ファイルのアップロード先を記事別に分類しようと思ったのだが、うまい方法が思いつかない。

Custom Upload Dirプラグインを使えば、
wp-content/uploads/%year%/%month%/%date%/%post_title%/
の形式にはできるのだが、日本語タイトルだとデフォルトのポストスラグがUTF-8にエンコードされた形式になってしまい、アップロードはうまくいくものの画像表示ができなくなってしまう。

wp-content/uploads/%year%/%month%/%date%/%post_id%/
の形式に設定できればいいのにと、以下のパッチをあてて、post_title部分がpost_idになるように強制してしまった。

--- custom_upload_dir.php.orig  2009-01-31 21:19:00.000000000 +0900
+++ custom_upload_dir.php       2009-01-31 22:23:02.437500000 +0900
@@ -161,13 +161,7 @@
        $customdir = '';
        $cur_post = get_post($post_id);
        $postGotDate = ($cur_post->post_date != "0000-00-00 00:00:00" && $cur_post->post_date);
-       $name = $cur_post->post_name;//post_name == slug
-       if(empty($name)){
-               $name = sanitize_title($cur_post->post_title);
-       }
-       if(empty($name)){
-               $name = $cur_post->ID;
-       }
+       $name = $cur_post->ID;
        if($postGotDate) { //only use the post_date if it has been defined (ie. published or manually altered)
                $time = strtotime($cur_post->post_date);
                if($use_yearmonth){ //custom upload dir put stuff according to the post's timestamp. If yearmonth is on, we need to override it.

これでプラグインの設定でpost_titleに設定したフィールドにはpost_idが代入されるようになる。
本当はプラグイン設定でpost_idを選択できるようにするのがよいとは思いつつ、当面これでごまかすつもり。

zillaの意味

某巨大掲示板にて。
zillaってのはアルメニア語でオープンソースって意味。

本当か?、と思いつつzillaと名前のついたオープンソースプロジェクトは、Mozilla、ChatZilla、FileZilla、Clonezillaなどがあるので信憑性高いかも。
Clonezillaは最近知ったのだが、Symantec Ghostのようなディスククローニングツール。

最近はぜんぜんオープンソースとゆかりのないソフトやサービスに"うんちゃらzilla"といった名前がついたりしていて嘆かわしい。

CORESERVER.JPのDrupalをCGIモードで動かす

safe modeの制約で動かないモジュールがあったり不便なので、CGIモードに変更した。

.htaccessに以下を追記。

AddHandler application/x-httpd-phpcgi .php

.htaccessのPHP関連設定はCGIだと効かなくなってしまうので、php.iniを作成して設定。

magic_quotes_gpc              = Off
register_globals              = Off
session.auto_start            = Off
mbstring.http_input           = pass
mbstring.http_output          = pass
mbstring.encoding_translation = Off

最初sites/default/settings.phpにini_set()で設定しようと思ったが、register_globalsは無理だったのでphp.iniにした。

参考:
PHPをCGIとして動かす方法について - CORESERVER.JP:コアサーバー

Debian sidのzabbixでlocalhostがモニタできない

Debian sidにzabbixを一式入れて動かそうと思ったらlocalhostのモニタが開始できない。
Web画面上はConfiguration -> Hostsで以下のErrorが表示されている。

Got empty string from [localhost] IP [127.0.0.1] Parameter [agent.ping]

/etc/zabbix/zabbix_agentd.confをDebugLevel=5に変更してみたところ、/var/log/zabbix-agent/zabbix-agentd.logに以下のエラーメッセージが記録されていた。

Listener error: Connection from [::ffff:127.0.0.1] rejected. Allowed server is [127.0.0.1]

あー、そういうことか。解決策は以下のいずれか。

  • 接続許可のIPアドレスを追加する。
    /etc/zabbix/zabbix_agentd.confで
    Server=127.0.0.1,::ffff:127.0.0.1
    

    のように接続元サーバのIPアドレスを追加する。

  • ListenするIPアドレスをIPv4アドレスに限定する。
    /etc/zabbix/zabbix_agentd.confで
    ListenIP=127.0.0.1
    

    に設定する。

  • IPv6自体を無効化する。

今回は接続許可IPを追加して解決。

CentOS 5.2にmunin-nodeをインストール

CentOS 5.2にmunin-nodeをインストールした際の記録。Muninのサーバー自体は別マシン(Debian)で動作している。
CentOS 5(RHEL5)用のRPMパッケージはRPMforgeで提供されているので、そちらを使う。

OS標準パッケージで導入

前提パッケージのうち、CentOS標準で提供されているものをインストール。

# yum install perl.x86_64 perl-libwww-perl perl-Digest-SHA1 perl-Socket6

RPMforgeからmuni-nodeをインストール

RPMforgeのリポジトリを追加する。

# wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

デフォルトでは使われないように無効化しておく(enabled = 0)。

# vi /etc/yum.repo.d/rpmforge.repo

munin-nodeパッケージをインストールする。

# yum --enablerepo=rpmforge install munin-node

munin-nodeの設定

munin-node.confにMuninが動作するサーバーのIPアドレスを追加(同一ホストで動かす場合は不要)。

# vi /etc/munin/munin-node.conf

サービス有効化、起動。

# chkconfig munin-node on
# service munin-node start
Starting Munin Node:                                       [  OK  ]