The following explains the steps required for migrating an image to a IaaS environment when the OS of the virtual server that is operating in the migration source virtual environment is RHEL6.
About this task
Perform the following steps in the virtual environment and on the OS of the virtual server from which you are migrating the image.
Important:
- Each of the following procedures provides an example of the command operation. The operation method may vary slightly, depending on the user's environment. Perform each operation according to the user's environment at the responsibility and decision of the user.
-
Use the console of the virtual environment for operation. Do not connect from outside, such as by using remote desktop, because doing so affects the network settings.
Example: Start and operate the virtual machine console from VMware vSphere Client.
- Be sure to make a backup before you change the settings of the virtual environment from which you are migrating so that you can restore it.
Procedure
-
Uninstallation of VMware Tools
If VMware Tools is installed on the virtual server that you intend to migrate, uninstall it.
# vmware-uninstall-tools.pl
-
Setting of the output destination of the boot log
Change the GRUB setting so that the Kernel can write the boot logs to the ttyS0 device.
-
Save /boot/grub/grub.conf.
# cp -p /boot/grub/grub.conf /boot/grub/grub.conf.bak
-
Edit /boot/grub/grub.conf and add the definition that enables the Kernel to write boot logs to the ttyS0 device.
# vi /boot/grub/grub.conf
Delete "rhgb quiet," and add "console=tty0 console=ttyS0,115200" as follows:
(Before) kernel /vmlinuz<string omitted> rhgb quiet
(After the change) kernel /vmlinuz<string omitted> console=tty0 console=ttyS0,115200n
Add or change the end to the following:
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console
-
Restart the OS.
# reboot
-
Deletion of the MAC address
Delete the udev rule file information and the MAC address information in the network interface settings file so that the settings for the network interface are set correctly for the virtual machine whose MAC address has been changed after migration.
-
Save the definition file. If no definition file exists, this operation is not required.
# cp -p /etc/udev/rules.d/70-persistent-net.rules
/etc/udev/rules.d/70-persistent-net.rules.bak
# cp -p /lib/udev/rules.d/75-persistent-net-generator.rules
/lib/udev/rules.d/75-persistent-net-generator.rules.bak
-
Replace the definition file with an empty file.
# rm /etc/udev/rules.d/70-persistent-net.rules
# rm /lib/udev/rules.d/75-persistent-net-generator.rules
# touch /etc/udev/rules.d/70-persistent-net.rules
# touch /lib/udev/rules.d/75-persistent-net-generator.rules
- Delete the line with "HWADDR=" (the MAC address information) from /etc/sysconfig/network-scripts/ifcfg-<network interface name>.
-
Restart the OS.
# reboot
-
Assigning a subscription
If you have not assigned a subscription to a virtual server, do the following:
-
Register the server to the subscription service.
After you have run the following command, enter the user name and password of your Red Hat account, then register the system to the subscription service.
# subscription-manager register
-
Check for a subscription that can be assigned.
Check for a subscription that can be assigned which has been registered to the subscription service. After running the command shown below, take a note of the Pool ID of the subscription to be assigned.
# subscription-manager list --available | less
-
Assign a subscription.
Specify the Pool ID that you took a note of in step 2, and assign a subscription to the virtual server.
# subscription-manager subscribe --pool=<Pool ID>
-
Installation of an SSH server
Install an SSH server by following the procedure below.
# yum -y install openssh-server
# chkconfig sshd on
# service sshd start
Tip: Configure the SSH service settings as necessary.
-
Installation of cloud-init
Install cloud-init.
# yum -y install cloud-init --enablerepo=rhel-6-server-rh-common-rpms
-
Unregistration of the subscription service
Unregister the system from the subscription service.
# subscription-manager unregister
-
Configuring cloud.cfg
Configure the settings of /etc/cloud/cloud.cfg.
Configure the operational settings of cloud-init in /etc/cloud/cloud.cfg. For details on the settings, refer to the support site of cloud-init.
-
Setting of network (DHCP connection)
Tip: To connect a virtual server via a network using DHCP after importing the image, configure the settings shown below. When the fixed IP address is set, the same IP address is used for startup after importing the image.
-
Check the setting of /etc/sysconfig/network-scripts/ifcfg-<network interface name>.
ONBOOT=yes
BOOTPROTO=dhcp
Delete the following lines if they exist.
IPADDR=10.4.0.110
PREFIX=22
GATEWAY=10.4.0.220
* The above values are examples.
-
Restart the network.
# service network restart
-
Disabling Zeroconf
Disable Zeroconf so that the migrated virtual machine can acquire metadata.
# vi /etc/sysconfig/network
Add the following line.
NOZEROCONF=yes
* Delete the following line if it exists. The value is an example.
GATEWAY=10.4.0.220
-
Disabling of the firewall
# service iptables stop
# chkconfig iptables off
-
Shutting down the OS
Shut down the OS.
# shutdown -h now