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 CentOS 6.
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
-
Installation of an SSH server
Install an SSH server by following the procedure below.
# yum install openssh-server
# chkconfig sshd on
# /etc/init.d/sshd restart
-
Installation of cloud-init
Install cloud-init by following the procedure below.
-
Obtaining cloud-init
Obtain the cloud-init module provided by FUJITSU from the service desk. Use the latest package that is provided.
-
Installation of cloud-init
# yum install
http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum -y install /var/tmp/cloud-init-0.7.5-10.el7.FJ.20160406.noarch.rpm
cloud-utils-growpart
# yum -y install dracut-modules-growroot
Tip: Replace the name of the storage destination of the cloud-init module and the file name with the names that are in use in your environment.
-
Checking of cloud-init
Check if cloud-init provided by Fujitsu is installed successfully.
# rpm -qi cloud-init
The following shows a display example that appears when cloud-init provided by Fujitsu is installed successfully.
# rpm -qi cloud-init
Name : cloud-init Relocations: (not relocatable)
Version : 0.7.5 Vendor: FUJITSU LIMITED
<--omitted-->
Packager : FUJITSU LIMITED
<--omitted-->
If cloud-init provided by Fujitsu is not installed, reinstall it, and then check whether the installation was successful.
# rpm -e cloud-init
# rpm -q cloud-init
# rm -rf /var/lib/cloud
# rpm -ivh /var/tmp/cloud-init-0.7.5-10.el7.FJ.20160406.noarch.rpm
# rpm -q cloud-init
-
Setting of the output destination of the boot log
Change the 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 /root/grub.conf.bak
-
Edit /boot/grub/grub.conf and add the definition that enables the Kernel to write boot logs to the ttyS0 device to grub.
# vi /boot/grub/grub.conf
Add or change the serial definition as shown below:
(Before) kernel /vmlinuz<string omitted> rhgb quiet
(After) kernel /vmlinuz<string omitted> console=tty0 console=ttyS0,115200n8
-
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
-
Deletion of the MAC address
-
Save the configuration file.
If no configuration file exists, proceed to step 8.
# cp /etc/udev/rules.d/70-persistent-net.rules
/etc/udev/rules.d/70-persistent-net.rules.bak
# cp /lib/udev/rules.d/75-persistent-net-generator.rules
/lib/udev/rules.d/75-persistent-net-generator.rules.bak
-
Delete the MAC address information.
# 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 MAC address information (the line that starts with "HWADDR=") from /etc/sysconfig/network-scripts/ifcfg-<network interface name>.
-
Restart the OS.
* After the OS restarts, it may take several minutes until the login prompt appears.
# reboot
-
Disabling of the firewall
Disable the iptables service and the ipchains service.
# service ipchains stop
# service iptables stop
# chkconfig ipchains off
# chkconfig iptables off
-
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.
-
Shutting down the OS
Shut down the OS.
# shutdown -h now