KDDIのVPSサービスであるCloudCore VPSに申し込んだので、とりあえず設定を行う。
基本的には、さくらのVPS 512と同じように、まずはセキュリティの強化からである。
もちろん、ssh用のポート番号も同様に変更する。
rootのパスワード変更後、通常のユーザアカウントおよびグループを作成。
その後、iptablesの設定である。
ところが、CloudCore VPSにはiptablesがない。
このため、yumによりiptalesをインストール。
# which iptables iptables: コマンドが見つかりません # yum install iptables # vi /etc/sysconfig/iptables
iptablesの設定はさくらのVPS 512で設定したものと同じで設定。
iptablesを適用後、自動起動するようにchkconfigでセット。
# /etc/rc.d/init.d/iptables start ファイアウォールルールを適用中: [ OK ] チェインポリシーを ACCEPT に設定中filter [ OK ] iptables モジュールを取り外し中 [ OK ] iptables ファイアウォールルールを適用中: [ OK ] # chkconfig iptables on # chkconfig --list iptables iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
最終的な設定状況はこんな感じ。
# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- anywhere anywhere Chain FORWARD (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- anywhere anywhere Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain RH-Firewall-1-INPUT (2 references) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT icmp -- anywhere anywhere icmp any ACCEPT esp -- anywhere anywhere ACCEPT ah -- anywhere anywhere ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns ACCEPT udp -- anywhere anywhere udp dpt:ipp ACCEPT tcp -- anywhere anywhere tcp dpt:ipp ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:XXXXX ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp-data ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:mysql REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
とりあえずのセキュリティが行えたところで、必要なパッケージをインストール。
インストールしたのは、マニュアル、sudo、gcc-4.6.2、Ruby-1.8.7、RubyGems-1.8.12.
# yum update # yum install man man-page # yum install sudo # yum -y install man man-pages-ja
gcc-4.6.2は以下の手順でインストール。
作業は全てrootで実施。
まずは準備と必要なパッケージをインストール。
# sudo yum install gcc gcc-c++ m4 glibc-devel zip bzip2 # mkdir /tmp/work
続いてgmpのインストール。
gmpってGNU Multiple Precision libraryの略で、任意精度計算ライブラリの一つ。
# cd /tmp/work # wget ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.bz2 # tar jxf gmp-5.0.2.tar.bz2 # cd gmp-5.0.2 # ./configure --prefix=/usr --enable-cxx # make # make check # maek install # /sbin/ldconfig
続いてmpfrのインストール。
mpfrはMultiple. Precision Floating-Point Reliable Libraryの略で、高品質多倍長浮動小数点ライブラリってやつです。
# cd /tmp/work # wget http://www.mpfr.org/mpfr-current/mpfr-3.1.0.tar.bz2 # tar jxf mpfr-3.1.0.tar.bz2 # cd mpfr-3.1.0 # ./configure --prefix=/usr --with-gmp=/usr # make # make check # maek install # /sbin/ldconfig
さらにmpcのインストール。
mpcはMultiple Precision Complex Libraryの略で、複素数ライブラリです。
# cd /tmp/work # wget http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz # tar zxf mpc-0.9.tar.gz # cd mpc-0.9 # ./configure --prefix=/usr --with-gmp=/usr --with-mpfr=/usr # make # make check # maek install # /sbin/ldconfig
そしてgcc-4.6.2のインストール。
# cd /tmp/work # wget http://ftp.gnu.org/gnu/gcc/gcc-4.6.2/gcc-4.6.2.tar.bz2 # tar jxf gcc-4.6.2.tar.bz2 # cd gcc-4.6.2 # ./configure --prefix=/usr --with-gmp=/usr --with-mpfr=/usr --with-mpc=/usr --program-suffix=-4.6 # make bootstrap # make install
make bootstrapはえらく時間がかかる。
実はmakeをやっている最中、作業しているマシンがハングしてしまい、作業がkillされてしまうという事態に陥った。
このため、再度makeする際にはバックグラウンドでmakeすることにした。(笑)
# cd /bin # mv gcc gcc-... # ln -s gcc-4.6 gcc
ということで、gccのインストールが終了。
続いて、RubyとRubyGemsのインストール。
# yum install zlib-devel # cd /tmp/work # wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz # tar zxf ruby-1.8.7-p72.tar.gz # cd ruby-1.8.7-p72 # ./configure --prefix=/usr/local/ruby187 # make # make install # cd /tmp/work # wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.12.tgz # tar zxf rubygems-1.8.12.tgz # cd rubygems-1.8.12 # /usr/local/ruby187/bin/ruby setup.rb # gem update --system
さくらのVPS 512で、はまったのが嘘のように、あっさりインストールできた。
Leave your Comment