1187 文字
6 分
YMCのVPSサービスをフルに使う!
@YMCのVPSを借りました。
カスタマイズドなので、root権限でやりたい放題できます。
Xenで動いています。ゲストOSはCentOS 4.5 です。
しかしながら、初期状態ではいくつかいらないアプリケーションが元から入っているので削除します。
以下は、コマンドの意味がわかる方のみ実行してください!かなーり危険です。
以下のコマンドを実行。
このコマンドを実行すると、デーモンはsshd,syslogd,cronぐらいしか動いていない状態となり、
スッキリする。
# yum remove sendmail dhclient squid httpd isdn4k-utils pcmcia-cs mysql bind xinetd at# yum install subversion rcs bison gccこのコマンドを実行すると、DNSのキャッシュサーバが無くなります。
DNSサーバの指定を買えましょう。
/etc/resolve.conf を編集して適当なDNSキャッシュサーバを指定する。
VPSでは
・プロセス数の制限
・RAMの制限
・CPU計算時間の制限
・ディスク容量
がきっついのでいらないモノはどんどん削除。
もっとプロセス数を減らしたければ、
/etc/inittab を変更してrebootすればコンソール用のプロセスを5つ消せる。
$ rcsdiff inittab===================================================================RCS file: RCS/inittab,vretrieving revision 1.1diff -r1.1 inittab46,50c46,50< 2:2345:respawn:/sbin/mingetty tty2< 3:2345:respawn:/sbin/mingetty tty3< 4:2345:respawn:/sbin/mingetty tty4< 5:2345:respawn:/sbin/mingetty tty5< 6:2345:respawn:/sbin/mingetty tty6---> #2:2345:respawn:/sbin/mingetty tty2> #3:2345:respawn:/sbin/mingetty tty3> #4:2345:respawn:/sbin/mingetty tty4> #5:2345:respawn:/sbin/mingetty tty5> #6:2345:respawn:/sbin/mingetty tty6比較はこんな感じ。
before
[admin@www ~]$ ps axuUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.0 0.3 1704 552 ? S Jun11 0:00 init [3]root 2 0.0 0.0 0 0 ? S Jun11 0:00 [migration/0]root 3 0.0 0.0 0 0 ? SN Jun11 0:00 [ksoftirqd/0]root 4 0.0 0.0 0 0 ? S Jun11 0:00 [watchdog/0]root 5 0.0 0.0 0 0 ? S> Jun11 0:00 [events/0]root 6 0.0 0.0 0 0 ? S> Jun11 0:00 [khelper]root 7 0.0 0.0 0 0 ? S> Jun11 0:00 [kthread]root 8 0.0 0.0 0 0 ? S> Jun11 0:00 [xenwatch]root 9 0.0 0.0 0 0 ? S> Jun11 0:00 [xenbus]root 16 0.0 0.0 0 0 ? S> Jun11 0:00 [kblockd/0]root 40 0.0 0.0 0 0 ? S Jun11 0:00 [pdflush]root 41 0.0 0.0 0 0 ? S Jun11 0:00 [pdflush]root 43 0.0 0.0 0 0 ? S> Jun11 0:00 [aio/0]root 42 0.0 0.0 0 0 ? S Jun11 0:00 [kswapd0]root 559 0.0 0.0 0 0 ? S> Jun11 0:00 [kseriod]root 589 0.0 0.0 0 0 ? S Jun11 0:00 [kjournald]root 1851 0.0 0.0 0 0 ? S Jun11 0:00 [kjournald]root 1859 0.0 0.2 1600 472 ? S>s Jun11 0:00 udevdroot 2184 0.0 0.3 1616 540 ? Ss Jun11 0:00 syslogd -m 0root 2188 0.0 0.2 1560 380 ? Ss Jun11 0:00 klogd -xnamed 2203 0.0 1.6 30172 2680 ? Ssl Jun11 0:00 /usr/sbin/named -u named -t /var/named/chrootrpc 2221 0.0 0.3 1696 524 ? Ss Jun11 0:00 portmaproot 2234 0.0 0.6 4096 1140 ? Ss Jun11 0:00 /usr/sbin/sshdroot 2249 0.0 0.4 2160 760 ? Ss Jun11 0:00 xinetd -stayalive -pidfile /var/run/xinetd.pidroot 2271 0.0 1.2 7388 2000 ? Ss Jun11 0:00 sendmail: accepting connectionssmmsp 2282 0.0 0.9 6492 1624 ? Ss Jun11 0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueroot 2292 0.0 0.5 4540 924 ? Ss Jun11 0:00 crondroot 2309 0.0 0.2 1788 428 ? Ss Jun11 0:00 /usr/sbin/atdroot 2316 0.0 0.2 1548 436 tty1 Ss+ Jun11 0:00 /sbin/mingetty tty1root 2317 0.0 0.2 1548 440 tty2 Ss+ Jun11 0:00 /sbin/mingetty tty2root 2318 0.0 0.2 1552 444 tty3 Ss+ Jun11 0:00 /sbin/mingetty tty3root 2319 0.0 0.2 1552 440 tty4 Ss+ Jun11 0:00 /sbin/mingetty tty4root 2320 0.0 0.2 1552 444 tty5 Ss+ Jun11 0:00 /sbin/mingetty tty5root 2321 0.0 0.2 1552 444 tty6 Ss+ Jun11 0:00 /sbin/mingetty tty6root 4087 0.0 1.5 6972 2596 ? Ss 01:45 0:00 sshd: admin [priv]admin 4097 0.0 1.0 6972 1788 ? S 01:46 0:00 sshd: admin@pts/0admin 4104 0.0 0.8 4308 1396 pts/0 Ss 01:46 0:00 -bashadmin 4130 0.0 0.4 2388 784 pts/0 R+ 01:46 0:00 ps axuafter
[admin@www ~]$ ps axuUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.0 0.3 1704 552 ? S Jun11 0:00 init [3]root 2 0.0 0.0 0 0 ? S Jun11 0:00 [migration/0]root 3 0.0 0.0 0 0 ? SN Jun11 0:00 [ksoftirqd/0]root 4 0.0 0.0 0 0 ? S Jun11 0:00 [watchdog/0]root 5 0.0 0.0 0 0 ? S> Jun11 0:00 [events/0]root 6 0.0 0.0 0 0 ? S> Jun11 0:00 [khelper]root 7 0.0 0.0 0 0 ? S> Jun11 0:00 [kthread]root 8 0.0 0.0 0 0 ? S> Jun11 0:00 [xenwatch]root 9 0.0 0.0 0 0 ? S> Jun11 0:00 [xenbus]root 16 0.0 0.0 0 0 ? S> Jun11 0:00 [kblockd/0]root 40 0.0 0.0 0 0 ? S Jun11 0:00 [pdflush]root 41 0.0 0.0 0 0 ? S Jun11 0:00 [pdflush]root 43 0.0 0.0 0 0 ? S> Jun11 0:00 [aio/0]root 42 0.0 0.0 0 0 ? S Jun11 0:00 [kswapd0]root 559 0.0 0.0 0 0 ? S> Jun11 0:00 [kseriod]root 589 0.0 0.0 0 0 ? S Jun11 0:00 [kjournald]root 1851 0.0 0.0 0 0 ? S Jun11 0:00 [kjournald]root 1859 0.0 0.2 1600 472 ? S>s Jun11 0:00 udevdroot 2184 0.0 0.3 1616 540 ? Ss Jun11 0:00 syslogd -m 0root 2188 0.0 0.2 1560 380 ? Ss Jun11 0:00 klogd -xroot 2234 0.0 0.6 4096 1140 ? Ss Jun11 0:00 /usr/sbin/sshdroot 2292 0.0 0.5 4540 924 ? Ss Jun11 0:00 crondroot 2316 0.0 0.2 1548 436 tty1 Ss+ Jun11 0:00 /sbin/mingetty tty1root 4087 0.0 1.5 6972 2596 ? Ss 01:45 0:00 sshd: admin [priv]admin 4097 0.0 1.1 7124 1804 ? R 01:46 0:00 sshd: admin@pts/0admin 4104 0.0 0.8 4308 1420 pts/0 Ss 01:46 0:00 -bashadmin 5076 0.0 0.4 2392 788 pts/0 R+ 02:00 0:00 ps axuスッキリしました!
起動直後のRAM使用量は30MB。
top - 02:13:53 up 0 min, 1 user, load average: 0.17, 0.06, 0.02Tasks: 28 total, 2 running, 26 sleeping, 0 stopped, 0 zombieCpu(s): 0.0% us, 0.0% sy, 0.0% ni, 100.0% id, 0.0% wa, 0.0% hi, 0.0% siMem: 163976k total, 32036k used, 131940k free, 3432k buffersSwap: 1048568k total, 0k used, 1048568k free, 13908k cached YMCのVPSサービスをフルに使う!
https://blog.teraren.com/posts/ymcのvpsサービスをフルに使う/