今年 2月から使っている Linode (VPS, 仮想サーバ) は、 月額 $19.95 の最小プラン Linode 360 だと RAM 360MB なので WordPress を動かす (Apache+PHP+MySQL) には若干足らない (稀に スラッシング 状態に陥って無反応になる)。 もちろん、 一つ上のプラン Linode 540 (RAM 540MB) にすればいいのであるが、 これだと月額 $29.95 でちょっと高い (私の感覚だと月額 $20 あたりに心理的な壁がある)。
prgmr.com ならば、 RAM 512MB, ディスク 12GB が月額 $12 (年一括払いなら $115.2) で済むので乗り換えてみた。 Linode のようなユーザフレンドリーな Web ユーザインタフェースは無いし、 時々新規申込みの受付を中止したりする (今も RAM 1024MB 以上のプランは受付けていない) が、 逆に言えば Web インタフェースが不要な人 (含む私) にとっては prgmr.com のシンプルさがむしろ望ましく、 レスキュー用のブートイメージなど必要最低限のものは揃っているので、 不便と感じることはない。 また、 いったん申込みが完了してしまえば受付の一時停止は関係ないわけで、 むしろサーバリソースに見合ったユーザ数しか受付けない姿勢は好感が持てる。
Web から Signup すると、 以下のようなメールが届く。
you ordered a xen vps, 512MiB ram, 12GiB Disk 80 GiB transfer Xen VPS, $12/month username sengoku Before I can set you up, I need to know what distro you would like and an OpenSSH format public key (on a *NIX, run ssh-keygen and send me either the id_dsa.pub or id_rsa.pub file in an attachment) on putty/windows, see http://www.unixwiz.net/techtips/putty-openssh.html#keypair and scroll down to the screen shot where it says 'openssh format public key for pasting into authorized_keys' - that is what I need. thanks.
OpenSSH の公開鍵くらい Web から登録させればいいのにと思いつつ、 「I need to know what distro you would like」 などと聞いてくるということは多少の融通は聞くのかと思い、 パーティションの切り方をついでにリクエストしてみた (6/4 15:46)。 つまり、 自分で作った Linux distro (配布していないから 「distribution」 と呼ぶのは正確性に欠けるのだが、 それなら何て呼んだらいいのだろう?) をインストールしたいから、 最小のパーティション (例えば 2GB) に ubuntu をインストールしておいてもらえるか? などとリクエストしてみた:
Hi, At Fri, 04 Jun 2010 05:48:05 +0000, support@prgmr.com wrote: > Before I can set you up, I need to know what distro you would like and > an OpenSSH format public key (on a *NIX, run ssh-keygen and send me > either the id_dsa.pub or id_rsa.pub file in an attachment) I'd like to use my own linux-based image that is running on fremont.gcd.org (linode) now. Is it possible to make two partitions (plus swap partition) ? One is for a normal ubuntu, and the other is for my own image. I'd like to switch these two OSs by pv-grub. Please minimize the ubuntu partition in order to maximize my own image. For example, 2GiB for ubuntu, 1GiB for swap, and 9GiB for me. I've attached my public key id_dsa.pub at the end of this mail. #9860. http://www.gcd.org/sengoku/ Hiroaki Sengoku <sengoku@gcd.org>
すると、 4日後の 6/8 09:03 に返事が来た。 リクエストはあっさり無視されて、 ディスク一杯に ubuntu をインストールした状態の VPS が提供されただけ。 個別対応しないのであれば、 自動化したほうがいいような。
Your vps is setup now, your host server is whetstone.prgmr.com. Login with your username and ssh key and follow the instructions at http://book.xen.prgmr.com/mediawiki/index.php/Quickstart For more information about repartitioning, see http://book.xen.prgmr.com/mediawiki/index.php/Repartition The default root password for the vps is password, and you should receive a bill soon by email. If you have any questions please email support@prgmr.com. Thanks very much. Nick Schmalenberger
言われた通り ssh でログインしてみる:
senri:/home/sengoku % ssh whetstone.prgmr.com The authenticity of host 'whetstone.prgmr.com (65.49.73.105)' can't be established. RSA key fingerprint is 97:52:07:d4:52:8d:c0:cc:13:c7:fb:5d:5d:1b:ab:b4. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'whetstone.prgmr.com,65.49.73.105' (RSA) to the list of known hosts. Name ID Mem VCPUs State Time(s) sengoku xxx 512 1 -b---- 11.5 Options for sengoku 1. console 2. create/start 3. shutdown 4. destroy/hard shutdown 5. reboot 6. swap i386/amd64 bootloaders (pvgrub) 7. exit press the number>
「6. swap i386/amd64 bootloaders (pvgrub)」 が目を引くが、 PV-GRUB は DomainU 側で実行されるので、 PV-GRUB にて 32bit/64bit の両方のカーネルを立ち上げることができず、 PV-GRUB を実行する前にどちらか一方に決めておく必要がある、 ということのようだ。 デフォルトは (残念なことに) 32bit になっていて、 セットアップしてもらった ubuntu も 32bit 版だった。
「1」 を入力して VPS のコンソールを表示させてみる:
press the number> 1 Ubuntu 10.04 LTS sengoku.xen.prgmr.com hvc0 sengoku.xen.prgmr.com login: root Password: Last login: Mon May 31 23:51:42 UTC 2010 on hvc0 Linux sengoku.xen.prgmr.com 2.6.32-22-generic-pae #33-Ubuntu SMP Wed Apr 28 14:57:29 UTC 2010 i686 GNU/Linux Ubuntu 10.04 LTS Welcome to Ubuntu! * Documentation: https://help.ubuntu.com/ root@sengoku:~# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 11812024 1068124 10143876 10% / none 249488 136 249352 1% /dev none 253744 0 253744 0% /dev/shm none 253744 28 253716 1% /var/run none 253744 0 253744 0% /var/lock none 253744 0 253744 0% /lib/init/rw none 11812024 1068124 10143876 10% /var/lib/ureadahead/debugfs root@sengoku:~#
前掲のメールに書いてあった通り、 ユーザ 「root」 パスワード 「password」 でログインできた。 初めてログインしたのに 「Last login: Mon May 31 23:51:42 UTC 2010 on hvc0」 などと出ているが、 この ubuntu イメージを作ったとき試しに root でログインしたのが残ってしまったのだと思われる。 新規ユーザのセットアップのたびに、 5/31 に作ったイメージを使いまわしているのだろう。
ディスク 12GB のプランのはずなのに 1GB ほど足りないのは swap パーティションがあるから?と思い、 fdisk で確認してみる:
root@sengoku:~# fdisk -l /dev/xvda Disk /dev/xvda: 12.8 GB, 12884901888 bytes 255 heads, 63 sectors/track, 1566 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/xvda1 1 1494 12000523+ 83 Linux root@sengoku:~#
シリンダの最大値は 1566 なので、 72 (=1566-1494) シリンダが使われずに余っている。 試しにパーティションを割当ててみたら普通に使えた。
自前 distro 10GB, swap 1GB, ubuntu 1GB といった切り分けかたにするため、 レスキュー用のカーネル 「CentOS 5.5 rescue」 をブートしてみる:
GNU GRUB version 0.97 (65536K lower / 0K upper memory) +-------------------------------------------------------------------------+ | user bootloader configuration | | CentOS 5.5 rescue (2.6.18-194.3.1.el5xen) | | CentOS 5.5 installer | | NetBSD 5.0.2 installer | | Ubuntu 10.04 LTS installer | | | | | | | | | | | | | | | +-------------------------------------------------------------------------+ Use the ^ and v keys to select which entry is highlighted. Press enter to boot the selected OS, 'e' to edit the commands before booting, or 'c' for a command-line.
二行目の 「CentOS 5.5 rescue (2.6.18-194.3.1.el5xen)」 を選択してブート。 root でログイン (パスワードは無し) して fdisk を使ってパーティションを切り直した。 せっかくセットアップしてもらった Ubuntu も、 3分と使わずにお別れ。
CentOS release 5.5 (Final) Kernel 2.6.18-194.3.1.el5xen on an x86_64 sengoku.xen.prgmr.com login: root [root@sengoku ~]# ... [root@sengoku ~]# fdisk -l /dev/xvda Disk /dev/xvda: 12.8 GB, 12884901888 bytes 255 heads, 63 sectors/track, 1566 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/xvda1 1 1306 10490413+ 83 Linux /dev/xvda2 1307 1438 1060290 82 Linux swap / Solaris /dev/xvda3 1439 1566 1028160 83 Linux [root@sengoku ~]# mount /dev/xvda1 /mnt [root@sengoku ~]#
私は個人で管理している Linux マシン (自宅と職場と VPS 合わせて十数台, もちろん商用サービスを行なっているサーバではない) のディスクの内容を、 コマンド一発で同一に保てるようにしている (つまりマスタで変更/追加/削除したファイルを各マシンへコピー/各マシンで削除)。
もちろん、 各マシンの性能や 32bit/64bit などの CPU 種別、 ディスクの容量に応じて違う部分もあるわけで、 この同期コマンドは同期先の各マシンに合わせてコピーしないファイルのリストを生成した上で rsync を実行している。 なので、 新しくマシンを増やすときもマスタ上で同期コマンドを実行するだけで、 インストールが完了するはずだが...
More...