首先需要安装rhel6.5的镜像,我这是从服务器上直接安装的,可以先下载一个镜像到本地
URL : //172.25.254.250/rhel6.5
RAM : 512
安装是注意取掉IPV6选项
(1)gentenforce 获取selinux状态
iptables -L 获取防火墙策略
(2)vi /etc/sysconfig/selinux
SELINUX=disabled ##关闭selinx
(3)cd /etc/init.d
ls
/etc/init.d/iptablesstop ##关闭防火墙
(4)chkconfig --list iptables ##查看iptables的运行等级
runlevel ##查看当前运行等级
chkconfig iptablesoff ##将所有等级都关闭,不自启动
(5)cd ~
rm -f *
cd /etc/udev/rhles.d/
ls
60-raw.rules 70-persistent-net.rules
rm -fr70-persistent-net.rules ##必须删除,否则一次创建的虚拟机没有网卡
(6)cd /etc/sysconfig/network
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
#IPADDR=172.25.6.1
#PREFIX=24
(7)cd /etc/yum.repo.d
vi rhel-source
[rhel-source]
name=Red HatEnterprise Linux $releasever - $hasearch - Sorce
baseurl=//172.25.254.6/rhel6.5
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
(8)yum repolist ##查看yum源是否配置好
yum install -y vim lftpopenssh-clients
vi rhel-source
[rhel-source]
name=Red HatEnterprise Linux $releasever - $hasearch - Sorce
baseurl=//172.25.6.250/rhel6.5
##172.25.6.250主机上需要挂在6.5的镜像
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
(9)cd /etc/ssh
ls
rm -fr ssh_host_*
(10)service sshd start
(11)hostname server1.example.com
vim/etc/syscomfig/network
HOSTNAME=server1.example.com
(12)vim /etc/hosts
172.25.6.1 server1.example.com
172.25.6.2 server2.example.com
172.25.6.3 server3.example.com
172.25.6.4 server4.example.com
172.25.6.5 server5.example.com
172.25.6.6 server6.example.com
(13)reboot
(14)删除
(15)cd /var/lib/libvirt
cdimages
qemu-imgcreate -f qcow2 -b rhel6.5.qcow2 server1
qemu-imgcreate -f qcow2 -b rhel6.5.qcow2server2 ##快照
(16)安装虚拟机时选择import existing disk image
安装完成后
cd /etc/sysconfig/network-scripts
DEVICE="eth0"
BOOTPROTO="none"
ONBOOT="yes"
IPADDR=172.25.6.1
PREFIX=24
cd /etc/hosts
HOSTNAME=server1.example.com
(17)如果用ssh连接时,显示key错误,只需
vim.ssh/known_hosts
删除含有0.1的那一行
URL : //172.25.254.250/rhel6.5
RAM : 512
安装是注意取掉IPV6选项
(1)gentenforce 获取selinux状态
iptables -L 获取防火墙策略
(2)vi /etc/sysconfig/selinux
SELINUX=disabled ##关闭selinx
(3)cd /etc/init.d
ls
/etc/init.d/iptablesstop ##关闭防火墙
(4)chkconfig --list iptables ##查看iptables的运行等级
runlevel ##查看当前运行等级
chkconfig iptablesoff ##将所有等级都关闭,不自启动
(5)cd ~
rm -f *
cd /etc/udev/rhles.d/
ls
60-raw.rules 70-persistent-net.rules
rm -fr70-persistent-net.rules ##必须删除,否则一次创建的虚拟机没有网卡
(6)cd /etc/sysconfig/network
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
#IPADDR=172.25.6.1
#PREFIX=24
(7)cd /etc/yum.repo.d
vi rhel-source
[rhel-source]
name=Red HatEnterprise Linux $releasever - $hasearch - Sorce
baseurl=//172.25.254.6/rhel6.5
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
(8)yum repolist ##查看yum源是否配置好
yum install -y vim lftpopenssh-clients
vi rhel-source
[rhel-source]
name=Red HatEnterprise Linux $releasever - $hasearch - Sorce
baseurl=//172.25.6.250/rhel6.5
##172.25.6.250主机上需要挂在6.5的镜像
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
(9)cd /etc/ssh
ls
rm -fr ssh_host_*
(10)service sshd start
(11)hostname server1.example.com
vim/etc/syscomfig/network
HOSTNAME=server1.example.com
(12)vim /etc/hosts
172.25.6.1 server1.example.com
172.25.6.2 server2.example.com
172.25.6.3 server3.example.com
172.25.6.4 server4.example.com
172.25.6.5 server5.example.com
172.25.6.6 server6.example.com
(13)reboot
(14)删除
(15)cd /var/lib/libvirt
cdimages
qemu-imgcreate -f qcow2 -b rhel6.5.qcow2 server1
qemu-imgcreate -f qcow2 -b rhel6.5.qcow2server2 ##快照
(16)安装虚拟机时选择import existing disk image
安装完成后
cd /etc/sysconfig/network-scripts
DEVICE="eth0"
BOOTPROTO="none"
ONBOOT="yes"
IPADDR=172.25.6.1
PREFIX=24
cd /etc/hosts
HOSTNAME=server1.example.com
(17)如果用ssh连接时,显示key错误,只需
vim.ssh/known_hosts
删除含有0.1的那一行