CentOS6.4インストールXEN 4.2.4システムのインストール詳細構成
# cpu i3-4130 4G 1T
#vmware,virtualbox http://bbotte.blog.51cto.com/6205307/1539484
# cat /etc/centos-release
CentOS release 6.4 (Final)
# uname -a # kernel, 2.6.32
Linux localhost.localdomain 3.14.16-1.el6xen.x86_64 #1 SMP Fri Aug 8 16:33:18 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
Xenのインストール:
SELINUX=disabled # selinux
yum install bridge-utils
yum install -y http://au1.mirror.crc.id.au/repo/kernel-xen-release-6-5.noarch.rpm
yum install -y xen
rpm -e xorg-x11-drv-ati-firmware-6.99.99-1.el6.noarch #
yum install kernel-xen
インストール手順は上記の手順にすぎませんが、インストール中にどのパッケージをインストールするかは注意してください.
grub自動修正済み
grep -v ^\#/boot/grub/grub.conf
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.14.16-1.el6xen.x86_64)
root (hd0,0)
kernel/xen.gz dom0_mem=1024M cpufreq=xen dom0_max_vcpus=1 dom0_vcpus_pin
module/vmlinuz-3.14.16-1.el6xen.x86_64 ro root=UUID=39d75778-b819-4ea3-a42b-fc08cbc2a73e rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
module/initramfs-3.14.16-1.el6xen.x86_64.img
title CentOS (2.6.32-358.el6.x86_64)
root (hd0,0)
kernel/vmlinuz-2.6.32-358.el6.x86_64 ro root=UUID=39d75778-b819-4ea3-a42b-fc08cbc2a73e rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd/initramfs-2.6.32-358.el6.x86_64.img
chkconfig xend on
reboot
# service xend start
# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 1024 1 r----- 82.7
# xm info
host : localhost.localdomain
release : 3.14.16-1.el6xen.x86_64
version : #1 SMP Fri Aug 8 16:33:18 EST 2014
machine : x86_64
nr_cpus : 4
nr_nodes : 1
cores_per_socket : 2
threads_per_core : 2
cpu_mhz : 3392
hw_caps : bfebfbff:2c100800:00000000:00007f40:77dafbbf:00000000:00000021:000027ab
virt_caps : hvm
total_memory : 4012
free_memory : 2937
free_cpus : 0
xen_major : 4
xen_minor : 2
xen_extra : .4
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
xen_commandline : dom0_mem=1024M cpufreq=xen dom0_max_vcpus=1 dom0_vcpus_pin
cc_compiler : gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
cc_compile_by : mockbuild
cc_compile_domain : crc.id.au
cc_compile_date : Wed Jun 18 01:34:43 EST 2014
xend_config_format : 4
インストールguest:
yum install gcc gcc-c++vim wget lrzsz ntpdate sysstat dstat wget man unzip-y#インストール常用パッケージ
mkdir/data
cd/data/xshellのXftpでisoをアップロード(4 Gより大きい場合はXftp、4 Gより小さい場合はlrzsz)
mount -o loop -t iso9660/data/CentOS-6.5-x86_64-bin-DVD1.iso/mnt
NICの設定:
cp/etc/sysconfig/network-scripts/ifcfg-p3p1/etc/sysconfig/network-scripts/ifcfg-br0
# cat /etc/sysconfig/network-scripts/ifcfg-p3p1
DEVICE=p3p1
TYPE=Ethernet
UUID=875acb88-19d4-457f-967f-5979f39930bf
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=C8:1F:66:44:09:EB
#IPADDR=192.168.22.209
#PREFIX=24
#GATEWAY=192.168.22.253
DNS1=114.114.114.114
DOMAIN=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System p3p1"
BRIDGE=br0
# cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.22.209
PREFIX=24
GATEWAY=192.168.22.253
DNS1=114.114.114.114
DOMAIN=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System br0"
guestプロファイルを作成してインストールを開始
# service network restart
Shutting down interface p3p1: bridge br0 does not exist!
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface p3p1: [ OK ]
Bringing up interface br0: [ OK ]
# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.c81f664409eb no p3p1
cd /data #
# qemu-img create -f raw centos65.img 40G
Formatting 'centos65.img', fmt=raw size=42949672960
# qemu-img create -f raw centos65.swp 512M
Formatting 'centos65.swp', fmt=raw size=536870912
# cp /mnt/isolinux/initrd.img /data/
# cp /mnt/isolinux/vmlinuz /data/
# vim centos65 #
kernel = "/data/vmlinuz"
ramdisk = "/data/initrd.img"
name = "centos1"
memory = "1024"
disk = [ "file:/data/centos65.img,xvda,w","file:/data/centos65.swp,xvdb,w" ]
vif = [ "bridge=br0" ]
vcpus = 2
on_reboot = "destroy"
on_crash = "destroy"
cp -r /mnt/ /data/centosiso
yum install httpd
vim /etc/httpd/conf/httpd.conf # 292,318
292 DocumentRoot "/data/centosiso"
293 #DocumentRoot "/var/www/html"
318 <Directory "/data/centosiso">
319 #<Directory "/var/www/html">
vim /etc/httpd/conf.d/welcome.conf # 8 ,- +
8 Options +Indexes
service httpd start
, wq!
vim /root/centos/.treeinfo
[images-x86_64]
initrd = images/pxeboot/initrd.img
[images-x86_64]
kernel = isolinux/vmlinuz
initrd = isolinux/initrd.img
vim /etc/sysconfig/iptables # 80 ,
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
service iptables restart
# xm create centos65 -c # centos65 ,-c console DomU
Using config file "./centos65".
Started domain centos1 (id=3)
# xm console centos1 # ,
┌────────┤ 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 directoryy │
│ URL │
│ │
│ ┌────┐ ┌──────┐ │
│ │ OK │ │ Back │ │
│ └────┘ └──────┘
ip ,xen ip 192.168.22.209
───. │ Please enter the URL containing the CentOS │
│ installation image on your server. │
│ │
│http://192.168.22.209________________________________________ │
│ │
│ [ ] Enable HTTP proxy │────│. │
│ Proxy URL ___________________________________ │
│ Username _______________ │
│ │────│ Password.────_______________ │
│ │
│ ┌────┐ ┌──────┐ │
│ │ OK │ │ Back │ │
│ └────┘ └──────┘
vnc "Start VNC",( , ) KVM
ここで一歩ずつインストールすると、再起動時にシャットダウンします(プロファイルon_reboot="destroy")
プロファイルを変更します
# cat centos65
#kernel = "/data/vmlinuz"
#ramdisk = "/data/initrd.img"
name = "centos1"
memory = "1024"
disk = [ "file:/data/centos65.img,xvda,w","file:/data/centos65.swp,xvdb,w" ]
vif = [ "bridge=br0" ]
#bootloader = "/usr/bin/pygrub"
vcpus = 2
on_reboot = "restart"
on_crash = "destroy"
# xm create centos65
Using config file "./centos65".
Started domain centos1 (id=8)
# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 1024 1 r----- 496.5
centos1 8 1024 2 r----- 2.9
# xm console centos1
root
Password:
Last login: Sat Aug 9 15:59:32 on hvc0
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 40G 3.8G 34G 11% /
tmpfs 497M 0 497M 0% /dev/shm
/dev/xvda1 194M 30M 155M 16% /boot
現在のステータスの表示
# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 1024 1 r----- 500.2
centos1 8 1024 2 -b---- 6.5
xm list#既存guestを表示
xm destroy centos 1#停止
xm shutdown centos 1#電源を切る
xm start centos 1#起動