1.安装rhel6.5
在真机中输入virt-manager 命令,选择本地镜像安装
安装完成后进行重启操作
2.配置虚拟机
虚拟机重启登陆后:
修改主机名:
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server1 #修改主机名
修改解析:
vi /etc/hosts
写入解析:
172.25.63.1 server1
172.25.63.2 server2
172.25.63.3 server3
172.25.63.4 server4
172.25.63.5 server5
172.25.63.6 server6
172.25.63.6 server6
删除网络记录文件(若不删除此文件以后快照的虚拟机网络会有问题):
cd /etc/udev/rules.d
rm -rf 70-persistent-net.rules
配置网络:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.63.1
PREFIX=24
重启网络
/etc/init.d/network restart
配置yum源:
vi /etc/yum.repos.d/rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=http://172.25.63.250/rhel6.5
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
配置好后测试:
[root@server1 ~]# yum clean all
[root@server1 ~]# yum repolist
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id repo name status
rhel-source Red Hat Enterprise Linux 6Server - x86_64 - Source 3,690
repolist: 3,690
安装软件:
yum install vim lftp openssh-clients -y
关闭selinux:
vim /etc/sysconfig/selinux
SELINUX=disabled
关闭iptables并使开即不自启:
/etc/init.d/iptables stop
/etc/init.d/ip6tables stop
chkconfig iptables off
chkconfig ip6tables off
poweroff #关机
此时虚拟机封装配置完成
3.快照虚拟机
在真机中快照虚拟机
cd /var/lib/libvirt/images/
qemu-img create -f qcow2 -b rhel6.5-ddpp.qcow2 pp1