Automated Linux cloud Installation

Source: Internet
Author: User
Tags configuration settings
Article Title: Automated Linux cloud installation. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Simplify the installation of Linux on the new Power System or System p LPAR

Simplifying the operating system installation process can reduce the time required to manage the cloud computing environment. This article explains how to use the new IBM Power? System or System p? Is SUSE Linux automatically installed on LPAR ?. This installation method also applies to installing Red Hat Linux or AIX ?.
One of the features of cloud computing is the ability to move applications from one processor environment to another. This feature requires a target operating system to receive it before a mobile application. Isn't it good to automate the installation of the new operating system?

Intel? A well-known feature of architecture systems is the ability to automatically install Linux. However, for System p or IBM Power Systems that use the Hardware Management Console, automatic installation of Linux is a tricky issue. One of the advantages of the solution discussed in this article is that it is a pure Linux solution and does not require you to master any specific AIX technology.

Automation solution Overview

The goal of this solution is to install an automated operating system by using a set of configuration that is easy to maintain and modify. It has the following features:

● The created and installed LPAR uses a static IP address. This is only related to the final configuration of the LPAR. You can use the Dynamic Host Configuration Protocol (DHCP) during the installation process ).
● The Automatic Linux Installation and Configuration with YaST2 (AutoYaST) Configuration XML file is very common and can be used on many server types, including HTTP and MySQL.
● The AutoYaST file does not contain system-specific information, such as the IP address and host name.
● Use this method to automate all content, so that you can use a command on HMC to install a new LPAR.
● Steps for building and using an automated solution include:

1. Configure the AutoYaST File
2. Configure DHCP/BOOTP and TFTP servers
3. Use the HMC lpar_netboot command
4. Use the-g parameter to automate lpar_netboot
5. Reuse automation solutions

Step 1. Configure the AutoYaST File

SUSE Linux uses an xml configuration file named AutoYaST. XML to control the installation of the operating system. By default, the same configuration is used to install the system each time AutoYaST is used. This allows you to obtain the AutoYaST file specific to different configurations. For example, you may have an AutoYaST file for the Web server and an AutoYaST file for the MySQL server. However, if the server only has different IP addresses and host names, it is quite difficult and time-consuming to configure and maintain multiple AutoYaST files for them.

To create a custom AutoYaST file that obtains the IP address and host name from the DHCP server, you must copy the AutoYaST file from the SUSE installation CD and modify it as follows:

1. Configure the standard AutoYaST file to use DHCP. Change the network segment to use DHCP only when the operating system is installed for the first time. Check to make sure that no host names are assigned to these network segments. If a region has a host name, you must delete it completely.
2. If the XML file contains static IP, DNS, or other network information, delete the content from the file.
3. Copy the code in Listing 1 to the location before the last XML mark of the AutoYaST file. This new part contains a script that converts the current Boot DHCP configuration to a static network configuration (this configuration is used in the next boot LPAR ).
With this script, you do not need to separately prepare an AutoYaST file with a hard-coded IP address for each LPAR. Therefore, you only need to maintain the DHCP server.

Listing 1. AutoYaST DHCP conversion script

 


Network_setup
Shell
#!/bin/bash<BR>### Disable ipv6<BR>echo 'install ipv6 /bin/true' >> /etc/modprobe.conf.local<BR><BR>### Variables to Calculate Network Configuration Settings for a static configuration ###<BR>ACTIVE_INTERFACE=`/sbin/ifconfig | grep eth | awk '{print $1}'`<BR>IP_ADDRESS=`/sbin/ifconfig $ACTIVE_INTERFACE | grep 'inet addr' | awk '{print $2}' <BR> | sed 's/addr://'`<BR>NETMASK=`/sbin/ifconfig $ACTIVE_INTERFACE | grep 'inet addr' | awk '{print $4}' <BR> | sed 's/Mask://'`<BR>BROADCAST=`/sbin/ifconfig $ACTIVE_INTERFACE | grep Bcast: | awk '{ print $3 }' <BR> | sed 's/Bcast://'`<BR>NETWORK=`/sbin/ip route list | grep $IP_ADDRESS | awk '{ print $1 }' <BR> | sed 's/\/[1-9][1-9]//'`<BR>GATEWAY=`/sbin/route | grep default | awk '{print $2}'`<BR>HOSTNAME=`/usr/bin/host $IP_ADDRESS | awk '{print $5}' | sed '$s/.$//'`<BR><BR>### Setup HOSTNAME<BR>echo "$HOSTNAME" > /etc/HOSTNAME<BR><BR>### Setup Gateway Address<BR>echo "default $GATEWAY - -" > /etc/sysconfig/network/routes<BR><BR>### Setup /etc/hosts with correct host information<BR>HOST=`/usr/bin/host $IP_ADDRESS | awk '{print $5}' | sed '$s/.$//' | cut -d "." -f 1`<BR>echo "$IP_ADDRESS&nbsp;&nbsp; $HOSTNAME $HOST" >> /etc/hosts<BR><BR>### Network configuration file rewrite for static configuration<BR><BR>INT_CONF_FILE=/etc/sysconfig/network/ifcfg-eth-id-`ifconfig eth0 | grep HWaddr <BR> | awk '{ print $5 }' | perl -ne '$var=$_; print lc($var)'`<BR><BR>echo 'DEVICE=eth0' > $INT_CONF_FILE<BR>echo 'BOOTPROTO=static' >> $INT_CONF_FILE<BR>echo "IPADDR=$IP_ADDRESS" >> $INT_CONF_FILE<BR>echo "NETMASK=$NETMASK" >> $INT_CONF_FILE<BR>echo "BROADCAST=$BROADCAST" >> $INT_CONF_FILE<BR>echo "NETWORK=$NETWORK" >> $INT_CONF_FILE<BR>echo 'STARTMODE=onboot' >> $INT_CONF_FILE<BR>echo 'TYPE=Ethernet' >> $INT_CONF_FILE<BR><BR>### Restart Network<BR>/etc/init.d/network restart<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;



[1] [2] [3] [4] Next page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.