One, virtual machine installation 1. Start the virtual Plus Manager
2. Create a new virtual machine
- Click File->new Virtual Machine in the upper left corner, select Local Install media (ISO image or CDROM), and click Forward
- Select Use ISO image, click Browse to select an OS image from the local, I choose Rhel-server-6.5-x86_64-dvd.iso, click Forward
- Memory (RAM) Fill 512MB, this can be minimized (no GUI) installation, CPUs default to assign a core, click Forward
- Fill in 20GiB as the virtual machine disk space, click Forward
- Name Fill Rhel-6.5-server, click Finish
Virtual Machine Creation Complete
3. Install OS image to virtual machine
- Click Begin installation, enter to start the installation
- Space bar Select OK
- Space Bar Select test
- Wait for test to complete, space bar Select OK, and then select OK
- TAB key to select Continue, spacebar to confirm
- Space bar Select OK
- Default English,tab key Select OK, SPACEBAR confirm
- Default Us,tab key Select OK, SPACEBAR confirm
- TAB key Select Re-initialize all, format all, space key confirmation
- TAB select Asia/shanghai,tab key to select OK, spacebar to confirm
- Enter the root password and confirm the password, the completion of the tab to select OK, the space bar confirmation (if the password is relatively simple, will prompt password strength, select Use anyway to take effect)
- Default Replace existing Linux system,tab key Select OK, spacebar to confirm
- TAB key to select Write changes to disk, space bar to confirm
- Wait for the installation to complete, space bar select reboot
Virtual Machine Installation Complete
Second, encapsulate the virtual machine image 1. Virtual Machine Mirroring
Create a virtual machine image file with a suffix of. Qcow2 using virtual machines created by the Vsan manager in Rhel
Virtual Machine Manager supports the creation of VMS from. Qcow2 Virtual machine image files so that we can easily create and manage Linux virtual machines by managing the images.
# # # # #2. Configuring virtual Machines
You need to encapsulate a virtual machine parent image using the virtual machine you just installed, so let's configure this virtual machine for later use
Turn on the virtual machine, log in to the system with root, configure it, and then shut down (note to shut down instead of restart)
My configuration is:
1. Modify the host name:
[[email protected] ~]# hostname server1 [[email protected] ~]# vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=server1
2. Turn off the firewall
[[email protected] ~]# chkconfig iptables off
3. Turn off SELinux
[[email protected] ~]# vi /etc/selinux/config ... SELINUX=disabled ...
4. Configure the Network
[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0" BOOTPROTO="dhcp" ONBOOT="yes" IPADDR=172.25.29.1 PREFIX=24 [[email protected] ~]# cd /etc/udev/rules.d/ [[email protected] rules.d]# ls 60-raw.rules 70-persistent-net.rules [[email protected] rules.d]# rm -f 70-persistent-net.rules [[email protected] rules.d]# /etc/init.d/network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Determining if ip address 172.25.29.1 is already in use for device eth0... [ OK ]
5. Host name resolution
[[email protected] ~]# vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.25.29.1 server1 172.25.29.2 server2 172.25.29.3 server3 172.25.29.4 server4 172.25.29.5 server5 172.25.29.6 server6
6. Configure the Yum source
[[email protected] ~]# vi /etc/yum.repos.d/rhel-source.repo [rhel-dvd] name=rhel6.5-dvd baseurl=http://172.25.29.250/rhel6.5 gpgcheck=0 [HighAvailability] name=HighAvailability baseurl=http://172.25.29.250/rhel6.5/HighAvailability gpgcheck=0 [LoadBalancer] name=LoadBalancer baseurl=http://172.25.29.250/rhel6.5/LoadBalancer gpgcheck=0 [ResilientStorage] name=ResilientStorage baseurl=http://172.25.29.250/rhel6.5/ResilientStorage gpgcheck=0 [ScalableFileSystem] name=ScalableFileSystem baseurl=http://172.25.29.250/rhel6.5/ScalableFileSystem gpgcheck=0
7. Install common software and services
[[email protected] ~]# yum clean all Loaded plugins: product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cleaning repos: HighAvailability LoadBalancer ResilientStorage : ScalableFileSystem rhel-dvd Cleaning up Everything [[email protected] ~]# yum install -y vim man lftp ...
8. Turn off the machine
[[email protected] ~]# poweroff
3. Create a virtual machine using the Qcow2 file
1. Initializing domains
[[email protected] ~]# cd/var/lib/libvirt/images/[[email protected] images]# virt-sysprep-d Rhel-6.5-server [0.0] examining the guest ... [69.0] performing "Abrt-data" ... [69.0] performing "bash-history" ... [69.0] performing "Blkid-tab" ... [69.0] performing "Crash-data" ... [69.0] performing "Cron-spool" ... [69.0] performing "dhcp-client-state" ... [69.0] performing "dhcp-server-state" ... [69.0] performing "Dovecot-data" ... [69.0] performing "logfiles" ... [69.0] performing "Machine-id" ... [69.0] performing "Mail-spool" ... [69.0] performing "Net-hostname" ... [69.0] performing "net-hwaddr" ... [69.0] performing "Pacct-log" ... [69.0] performing "Package-manager-cache" ... [69.0] performing "Pam-data" ... [69.0] performing "Puppet-data-log" ... [69.0] performing "Rh-subscription-manager" ... [69.0] performing "Rhn-systemid" ... [69.0] performing "rpm-db" ... [69.0] performing "Samba-db-log" ... [69.0] performing "scripT "... [69.0] performing "Smolt-uuid" ... [69.0] performing "Ssh-hostkeys" ... [69.0] performing "Ssh-userdir" ... [69.0] performing "Sssd-db-log" ... [69.0] performing "Tmp-files" ... [69.0] performing "udev-persistent-net" ... [69.0] performing "utmp" ... [69.0] performing "Yum-uuid" ... [69.0] performing "Customize" ... [69.0] Setting a random seed [69.0] performing "Lvm-uuids" ...
2. Create a virtual machine image
The original virtual machine is deleted first and the Qcow2 mirror is retained because the parent image (that is, the original VM Rhel-6.5-server) is not working at the same time as the virtual machine created with the Qcow2 file causes an error
Delete procedure:
- Open Virtual Machine Manager
- Right-click on the rhel-6.5-server and select Delete
- Uncheck Delete associated storage files, and then click Delete to remove
Create a Rhel-6.5-server.qcow2-based virtual machine
[[email protected] images]# qemu-img create -f qcow2 -b rhel-6.5-server.qcow2 server1 Formatting ‘server1‘, fmt=qcow2 size=21474836480 backing_file=‘rhel-6.5-server.qcow2‘ encryption=off cluster_size=65536 lazy_refcounts=off [[email protected] images]# qemu-img create -f qcow2 -b rhel-6.5-server.qcow2 server2 Formatting ‘server2‘, fmt=qcow2 size=21474836480 backing_file=‘rhel-6.5-server.qcow2‘ encryption=off cluster_size=65536 lazy_refcounts=off [[email protected] images]# qemu-img create -f qcow2 -b rhel-6.5-server.qcow2 server3 Formatting ‘server3‘, fmt=qcow2 size=21474836480 backing_file=‘rhel-6.5-server.qcow2‘ encryption=off cluster_size=65536 lazy_refcounts=off
3. Create a virtual machine
- Click File->new Virtual Machine in the upper left corner, select Import existing disk image, click Forward
- Click Browse, click Default on the top left corner, select the server1 you just created, click Choose Volume,os Tyoe Select Linux,version, select the RHEL6.5, click Forward
- Memory (RAM) and CPUs are allocated according to demand, General memory (RAM) allocation 512MiB or 1024mib,cpus assign a core, click Forward
- Name fill Server1, click Finish
Server1 creation completed, as above can be created Server2,server3
4.server1,server2,server3 settings
Boot up and set up eth0,hostname.
Virtual machine Manager for Linux VMS