おもちゃ環境備忘録 その4 (さくらのVPS 512にCentoOS 6をインストールしてみた。)

前回までCentOS 5.4を色々設定していたんですが
もう本当にただの思いつきでCentOS 6にしました。

一応起動して動いてますが、
多分(執筆時点で)さくらはサポートしてくれないので注意してください。

準備

最低限ネットワーク周りの情報を抑えます。
・IP/Subnet
デフォルトゲートウェイ
DNS

CentOSのネットワークインストールイメージをダウンロード

今回は理研からダウンロードします。

# curl -O http://ftp.riken.jp/Linux/centos/6.0/isos/x86_64/CentOS-6.0-x86_64-netinstall.iso

ISOイメージをマウントしてコピー

起動に必要なファイルを/boot配下にコピーします。

# mount -t iso9660 -o ro,loop CentOS-6.0-x86_64-netinstall.iso /mnt/
# cp /mnt/images/pxeboot/vmlinuz /mnt/images/pxeboot/initrd.img /boot 

grub.confへ追記する。

# cat /boot/grub/grub.conf 
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/vda2
#          initrd /initrd-version.img
#boot=/dev/vda
default=0
timeout=5
#splashimage=(hd0,0)/grub/splash.xpm.gz
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 
terminal --timeout=10 serial console
hiddenmenu
title CentOS6 Installation
	root (hd0,0)
	kernel /vmlinuz ro root=LABEL=/ console=tty0 console=ttyS0,115200n8r
	initrd /initrd.img
title CentOS (2.6.18-238.19.1.el5)
	root (hd0,0)
	kernel /vmlinuz-2.6.18-238.19.1.el5 ro root=LABEL=/ console=tty0 console=ttyS0,115200n8r
	initrd /initrd-2.6.18-238.19.1.el5.img
title CentOS (2.6.18-194.26.1.el5)
	root (hd0,0)
	kernel /vmlinuz-2.6.18-194.26.1.el5 ro root=LABEL=/ console=tty0 console=ttyS0,115200n8r
	initrd /initrd-2.6.18-194.26.1.el5.img

再起動する

再起動後ネットワークインストールが始まります。

# reboot

OSインストール

ここからリモートコンソールをコピペしたので
がっつり体裁が崩れてます。

治すのに面倒だったからこのままで。。。w

言語を選ぶ

英語を選びました。

───────┤ Choose a Language ├────────┐
                    │                                     │
                    │ What language would you like to use │
                    │ during the installation process?    │
                    │                                     │
                    │      Catalan                ↑       │
                    │      Chinese(Simplified)    ▮       │
                    │      Chinese(Traditional)   ▒       │
                    │      Croatian               ▒       │
                    │      Czech                  ▒       │
                    │      Danish                 ▒       │
                    │      Dutch                  ▒       │
                    │      English                ↓                                                                                                            
                    │ 
                    │                                     │
                    │               ┌────┐                │
                    │               │ OK │                │
                    │               └────┘                │
                    │                                     │
                    │                                     │
どのメディアからインストールするか選ぶ

URLを選びます。

                        ┌───┤ Installation Method ├───┐
                        │                             │
                        │ What type of media contains │
                        │ the installation image?     │
                        │                             │
                        │        Local CD/DVD         │
                        │        Hard drive           │
                        │        NFS directory        │
                        │        URL                  │
                        │                             │
                        │   ┌────┐       ┌──────┐     │
                        │   │ OK │       │ Back │     │
                        │   └────┘       └──────┘     │
                        │                             │
                        │                             │
TCP/IPの設定

IPv4はManualを選択します。
IPv6は遊んでみたいのでそのまま有効にしました。

─────────────┤ Configure TCP/IP ├─────────────┐
                │                                              │
                │ [*] Enable IPv4 support                      │
                │        ( ) Dynamic IP configuration (DHCP)   │
                │        (*) Manual configuration              │
                │                                              │
                │ [*] Enable IPv6 support                      │
                │        (*) Automatic neighbor discovery      │
                │        ( ) Dynamic IP configuration (DHCPv6) │
                │        ( ) Manual configuration              │
                │                                              │
                │        ┌────┐               ┌──────┐         │
                │        │ OK │               │ Back │         │
                │        └────┘               └──────┘         │
                │                                              │
                │                                              │

最初に控えたネットワーク値を入力

       ┌────────────┤ Manual TCP/IP Configuration ├─────────────────┐
       │                                                                │
       │ Enter the IPv4 and/or the IPv6 address and prefix (address /   │
       │ prefix).  For IPv4, the dotted-quad netmask or the CIDR-style  │
       │ prefix are acceptable. The gateway and name server fields must │
       │ be valid IPv4 or IPv6 addresses.                               │
       │                                                                │
       │ IPv4 address: 49.212.0.xxx____ / 255.255.254.0___              │
       │ Gateway:      49.212.0.1_______________________________        │
       │ Name Server:  210.224.163.4____________________________        │
       │                                                                │
       │             ┌────┐                        ┌──────┐             │
       │             │ OK │                        │ Back │             │
       │             └────┘                        └──────┘             │
       │                                                                │
       │                                                                │
ミラーサーバを指定

やっぱり理研を使いました。

        ┌────────────────────────┤ URL Setup ├─────────────────────────┐
        │
        │          Please enter the URL containing the CentOS
        │          installation image on your server. 
        │
        │ http://ftp.riken.go.jp/Linux/centos/6.0/os/x86_64
        │
        │ [ ] Enable HTTP proxy
        │
        │ Proxy URL        ___________________________________
        │ Username         _______________
        │
        │ Password         _______________
        │
        │            ┌────┐                       ┌──────┐
        │            │ OK │                       │ Back │             │
        │            └────┘                       └──────┘
        │
        │
タイムゾーンの指定

普通にAsia/Tokyo(GMT+9)を使います。
UTCは使いません。

                    ┌───────┤ Time Zone Selection ├───────┐
                    │                                     │
                    │ In which time zone are you located? │
                    │                                     │
                    │ [ ] System clock uses UTC           │
                    │                                     │
                    │  Asia/Tehran                     ↑  │
                    │  Asia/Thimphu                    ▒  │
                    │  Asia/Tokyo                      ▮  │
                    │  Asia/Ulaanbaatar                ▒  │
                    │  Asia/Urumqi                     ↓  │
                    │                                     │
                    │      ┌────┐          ┌──────┐       │
                    │      │ OK │          │ Back │       │
                    │      └────┘          └──────┘       │
                    │                                     │
                    │                                     │
パスワード設定
                ┌──────────────┤ Root Password ├───────────────┐
                │                                              │
                │    Pick a root password. You must type it    │
                │    twice to ensure you know it and do not    │
                │    make a typing mistake.                    │
                │                                              │
                │ Password:           ********________________ │
                │ Password (confirm): *********_______________ │
                │                                              │
                │        ┌────┐               ┌──────┐         │
                │        │ OK │               │ Back │         │
                │        └────┘               └──────┘         │
                │                                              │
                │                                              │
パーティション設定

ドライブ全体を使います。

       ┌─────────────────────┤ Partitioning Type ├─────────────────────┐
       │                                                               │
       │ Installation requires partitioning of your hard drive.  The   │
       │ default layout is suitable for most users.  Select what space │
       │ to use and which drives to use as the install target.         │
       │                                                               │
       │                 Use entire drive                     │
       │                 Replace existing Linux system                 │
       │                 Use free space                                │
       │                                                               │
       │   Which drive(s) do you want to use for this installation?    │
       │         [*]    sda    20480 MB (ATA QEMU HARDDISK) ↑          │
       │                                                    ▮          │
       │                                                               │
       │                      ┌────┐   ┌──────┐                        │
       │                      │ OK │   │ Back │                        │
       │                      └────┘   └──────┘                        │
       │                                                               │
       │                                                               │

この後警告が出るのでOKすると
フォーマットが始まってインストールして再起動を促されます。
再起動が終われば普通に完了。

初期設定

スターウォーズみたいにエピソードが逆になったですが、
このエントリーもよかったら見てください。

おもちゃ環境備忘録 その1 - げんろぐ
おもちゃ環境備忘録 その2 - げんろぐ
おもちゃ環境備忘録 その3 - げんろぐ


このエントリーはid:kaigaiさんのエントリーを参考にさせて頂きました。
READ : さくらのVPSにFedoraをインスコ - KaiGaiの俺メモ

おもちゃ環境備忘録 その3

今日きづいたんだけどログ見たらブルートフォースでめっちゃアタックされてたw
そのうち何かしら対策しよう。。。。

不要デーモンの停止

もっと早くやればよかったんだけど
使わないデーモンを止めます。

atd

# chkconfig atd off

iscsi

# chkconfig iscsi off
# chkconfig iscsid off

うん。僕もう眠いんだ。。。。。

おもちゃ環境備忘録 その2

さっそくブログ書くのもめんどくなってきた今日この頃ですが
アルコール飲んだ勢いで書き残します。

ファイアウォールの設定

さくらVPSはF/W無しですので
(本当はおもちゃ環境なので全部開けておきたいのですが)
念のため設定することにします。

現在の設定確認

CentOS 5.xの場合

# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

CentOS 6.0の場合

hain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  405 35807 ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED ←既存コネクションに関連するパケットを許可
    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere ←icmpの着信を全て許可
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere ←loインターフェースからの接続を全て許可
    3   192 ACCEPT     tcp  --  any    any     anywhere             anywhere            state NEW tcp dpt:sshsshの新規接続を許可
   49  6616 REJECT     all  --  any    any     anywhere             anywhere            reject-with icmp-host-prohibited ←拒否されたパケットとしてICMPエラーパケットを返す(REJECT)

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 REJECT     all  --  any    any     anywhere             anywhere            reject-with icmp-host-prohibited ←拒否されたパケットとしてICMPエラーパケットを返す(REJECT)

Chain OUTPUT (policy ACCEPT 246 packets, 30139 bytes)
 pkts bytes target     prot opt in     out     source               destination 
(CentOS6のみ)既存のルールが邪魔なので消す
# iptables -F
# iptables -t nat -F
# iptables -X
# iptables -Z
# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
用途が決まってないので適当に使いそうなポート追加

local

# iptables -A INPUT -i lo -j ACCEPT

ssh

# iptables -A INPUT -p tcp --dport 22 -j ACCEPT -m state --state NEW

dns

# iptables -A INPUT -p tcp --dport 53 -j ACCEPT -m state --state NEW
# iptables -A INPUT -p udp --dport 53 -j ACCEPT -m state --state NEW

応答パケットの許可

#iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
INPUTとFORWARDをDROPするように変更する

INPUTチェーンとFORWARDチェーンは意図してないパケットが飛んできた時にドロップするようにします。

# iptables -P INPUT DROP
# iptables -P FORWARD DROP
せーぶ
# /etc/init.d/iptables save
Saving firewall rules to /etc/sysconfig/iptables:          [  OK  ]
設定確認
# iptables -L -v
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere            
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh state NEW 
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:domain state NEW 
    0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:domain state NEW 
  111  8412 ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED 

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 39 packets, 3884 bytes)
 pkts bytes target     prot opt in     out     source               destination    

いじょー

おもちゃ環境備忘録 その1

言わずと知れたさくらのVPSですが、契約してずっとほったらかしてたので自分の勉強用に再セットアップしました。このエントリーは物忘れがひどい僕の個人的な備忘録です。

続きを読む

Inkscapeのショートカットをコマンドキーで使える様にする。


http://www.sxc.hu/pic/l/n/ni/nintaro/976083_74231444.jpg


InkscapeX11で動作するLinuxアプリケーションのため
Macで使うとコマンドキーベースのショートカットが使えないのでびっくりします。
面倒だったのでそのまま使っていたのですが、あまりの使いづらさに変更する事にしました。


あとイラレユーザには嬉しいオプションキーも使える様にします!
(公式ヘルプの近いところに書いてあったのでついでに解説します)

続きを読む

Google公式!Googleの「New」がまとめられてるサイト


Deliciousで話題になってたんですが
百聞は一見にしかず下記リンクをクリックしてみてください。


About | Google


これ以上無いほど簡潔に伝わったかと思います。
つまりGoogleのニュープロダクトがまとまって見れるページが出来た様です。


Googlerに取っては垂涎モノですよね!!!
是非活用していきたいと思います!