忍者ブログ
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

いろいろ調べたんだけど、どうもCentOS6.2とi386でKVMやXenを動かすのは辛そうということがわかってきたので昔使用していたOpenVZをいれてみることにした。

OpenVZのインストール

レポジトリの追加
# cd /etc/yum.repos.d/
# wget http://download.openvz.org/openvz.repo
# rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ

vzカーネルを探してvzkernelをインストールする
# yum search vzkernel

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * openvz-kernel-rhel6: ftp.iij.ad.jp
 * openvz-utils: ftp.iij.ad.jp
 * updates: www.ftp.ne.jp
base                                                     | 3.7 kB     00:00
extras                                                   | 3.5 kB     00:00
openvz-kernel-rhel6                             |  951 B     00:00
openvz-utils                                          | 1.2 kB     00:00
updates                                                | 3.5 kB     00:00
============================ N/S Matched: vzkernel =============================
vzkernel.i686 : The Linux kernel
vzkernel-devel.i686 : Development package for building kernel modules to match
                    : the kernel
vzkernel-firmware.noarch : Firmware files used by the Linux kernel
vzkernel-headers.i686 : Header files for the Linux kernel for use by glibc

  Name and summary matches only, use "search all" for everything.

vzkernel.i686をインストールする
# yum install vzkernel.i686

grubに書き込まれたことを確認(青字のところが追加されたことを確認)
# less /etc/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/mapper/vg_canon-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-042stab049.6)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-042stab049.6 ro root=/dev/mapper/vg_canon-lv_root rd_NO_LUKS rd_NO_MD quiet rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=jp106 LANG=ja_JP.UTF-8 rd_LVM_LV=vg_canon/lv_root rd_LVM_LV=vg_canon/lv_swap rd_NO_DM
        initrd /initramfs-2.6.32-042stab049.6.img

title CentOS (2.6.32-220.7.1.el6.i686)
        root (hd0,0)


/etc/sysctl.confの修正(青字のところを修正と追加)
# vi /etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 1

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.conf.default.forwarding=1

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456

iptablesの修正
# vi /etc/sysconfig/iptables
:FORWARD ACCEPT [0:0]
-A FORWARD -i venet0 -o eth0 -j ACCEPT
-A FORWARD -i eth0 -o venet0 -j ACCEPT


ここで1回リブート実施
# reboot

リブートするとdhcpで立ち上がってくるので、setup等でIPアドレスを固定のものに変更。
再度リブート。

vzpkg vzyum vzrpm43-python vzrpm44-python vzrpm43-4.3.3 vzrpm44-4.4.1をインストールする
まずはダウンロード
wget http://download.openvz.org/template/utils/vzpkg/2.7.0-18/vzpkg-2.7.0-18.noarch.rpm
wget http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm
wget http://download.openvz.org/template/utils/vzrpm43/4.3.3-7_nonptl.6/vzrpm43-4.3.3-7_nonptl.6.i386.rpm
wget http://download.openvz.org/template/utils/vzrpm43/4.3.3-7_nonptl.6/vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm
wget http://download.openvz.org/template/utils/vzrpm44/4.4.1-22.5/vzrpm44-4.4.1-22.5.i386.rpm
wget http://download.openvz.org/template/utils/vzrpm44/4.4.1-22.5/vzrpm44-python-4.4.1-22.5.i386.rpm

procmailが入っていないとインストールできないようなので、procmailをインストール
# yum install procmail

vzyumの依存関係でcElementTree.soがインストールされていないとダメと怒られるが
OpenVZのwikiのここを見ると、間違って要求しているだけだから無理やりインストールするように書いてある。
なのでnodepsでインストール
# rpm --nodeps -Uvh vzyum-2.4.0-11.noarch.rpm

さらに残りのパッケージをインストール
# vzpkg-2.7.0-18.noarch.rpm vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm vzrpm44-python-4.4.1-22.5.i386.rpm vzrpm44-4.4.1-22.5.i386.rpm vzrpm43-4.3.3-7_nonptl.6.i386.rpm

ここで本来であればテンプレートをyumでインストールするが、テンプレートはCentOS4のものしかないので別の方法を実施。CentOS6のテンプレートをダウンロード。

# cd /vz/template/cache/
# wget http://download.openvz.org/template/precreated/centos-6-x86.tar.gz

これでとりあえずVEを作成する準備が整った。
 

PR
この記事にコメントする
お名前
タイトル
文字色
メールアドレス
URL
コメント
パスワード   Vodafone絵文字 i-mode絵文字 Ezweb絵文字
カレンダー
08 2024/09 10
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
ブログ内検索
VEの作成  HOME  すべてやり直し

material:web*citron  template:ゆずろぐ

忍者ブログ [PR]