Automatic SUSE installation Based on AutoYaST

Source: Internet
Author: User
Tags filezilla

Automatic SUSE installation Based on AutoYaST

Preface

In the financial industry, the main operating systems I have come into contact with are:AIXAndSLES(SUSE Linux Enterprise Server), Maybe we usually use moreCentOSAlthough there are some differences, the principles are the same,SMITAndYaSTIt is also a very useful function. We recommend you have the opportunity to try it out. Because there are few articles on SuSE automated deployment on the Internet, this automated deployment solution has been verified and used in the production system for one and a half years. The configuration is relatively mature and stable. FollowDon't Repeat YourselfPrinciples: This article describes how to use AutoYaST to automatically install SuSE on a semi-automated SuSE custom CD and PXE network. For more detailed parameter descriptions, see The SuSE official website in extended reading.

AutoYaST is the prime partner for automated SuSE deployment

SuSE auto-install custom CD version

SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 2

Https://www.suse.com/zh-cn/download-linux/

About AutoYast

AutoYast is an automatic Installation Tool for SuSE Linux. With AutoYast and supported by DHCP, TFTP, and PXE services, SuSE Linux can be automatically installed automatically on unattended basis through FTP, NFS, and other network installation sources. However, this method requires the establishment of an independent server and the client supports PXE network startup. This method is not suitable when there is no network or the system does not support the client Nic, the one-click installation CD of SuSE Linux made with AutoYast can meet the above requirements. This article describes how to create a one-click installation CD for SuSE Linux Enterprise Server 11 (SLES11). Other SuSE Linux is for your reference only.

Generate the AutoYaST configuration file

After AutoYast is configured successfully, an xml configuration file named autoinst. XML is generated. SuSE Linux uses this file to control the installation of the operating system.

There are three ways to generate a configuration file using AutoYast:

  1. Automatically generated during system installation
  2. After the system is installed, run the command to generate
  3. Directly edit and generate (Best practices for laziness)
Configuration file generated during system installation

Follow the normal steps to install SLES11 and install all necessary software. Run to the last step "installation completed", check "Copy this system for AutoYast", the system starts cloning the system to generate the configuration file, and a prompt window is displayed. It takes about 2 minutes to generate the configuration file. The generated configuration file is located in the/root directory.

Run the command to generate or modify the configuration file

If the configuration file is not generated during system installation, run the command to generate it. Open the terminal in the system and run the command as the root useryast2 autoyastIn the AutoYast Configuration window, choose tools> create reference configuration file. The create reference control file window is displayed. Select the project to be configured, such as the software package selection, language, partition, keyboard layout, firewall, and network settings. AutoYast obtains related configuration information from the system based on the selected project. Select "file"-> "save". The "Save as" window is displayed. Enter the file name "autoinst. xml" and select "save". The system prompts you to save the file to the specified directory.

Sometimes we need to make some adjustments to the module, such as disk partitions and software packages. The following example describes how to modify the configuration file. Run as root useryast2 autoyastOpen the AutoYast window, select "file"-> "open", and select the autoinst. xml file. After the System reads the configuration, display the configuration accessory name in the AutoYast window, and save the changes.

Create and install a cd

After the AutoYast configuration file is generated, you can create a one-click installation disc. To create a one-click installation disc, you need to use the data of the original installation disc of SLES11.

  1. # First copy data from the original installation disc of SLES11 to the specified directory
  2. mkdir /tmp/sles11
  3. cp -R /media/S*/* /tmp/sles11
  4. # Copying autoinst. xml
  5. cp /root/autoinst.xml /tmp/sles11
  6. # Edit the isolinux. cfg file and find the # install location
  7. cd boot/x86_64/loader/
  8. vi isolinux.cfg
  9. # install
  10. append initrd=initrd autoyast=file:///autoinst.xml splash=silent showopts
  11. :x!
  12. # Run the mkisofs command to generate an automatic installation disc
  13. cd /tmp/sles11
  14. mkisofs -R -o /tmp/SLES11-SP2-64-AUTO.iso -b boot/x86_64/loader/isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
My configuration file pre-partitioning
Name Format Size
Swap Swap 16 GB
Boot Ext3 120 M
LVM    
Root Ext3 5G
Usr Ext3 10G
Var Ext3 5G
Opt Ext3 10G
Home Ext3 15G
Tmp Ext3 10G
Total   71G
Pre-installed software package
  • KDE Desktop Environment
  • Oracle Server
  • Base C/C++ Compiler and Tools
  • nmap
  • java-1_6_0 libstdc++43-devel-32bit
Preset Language
  • Major: English
  • Add: Chinese
Default User Name/Password

Root/If you reuse my configuration file directly, please trust me to get the password: D

Preset Network Configuration

Disable services: Firewall, IPv6

What is the basic principle of automatic PXE network installation in SuSE?

PXE (Pre-boot Execution Environment) is a protocol designed by Intel that enables computers to start over the network. The Protocol is divided into two ends: client and server. The PXE client is in the ROM of the NIC. When the computer boots, the BIOS transfers the PXE client to the memory for execution and displays the command menu. After the user selects the client, the PXE client downloads the operating system on the remote end to the local computer for running. To run the PXE Protocol successfully, you must solve the following two problems: 1. since it is transmitted through the network, who will configure the IP address of the computer when it starts; 2. which protocol is used to download the Linux kernel and the root file system.

The first problem can be solved through the DHCP Server. The DHCP server assigns an IP address to the PXE client. The DHCP Server is a protocol used to dynamically allocate IP addresses to the DHCP Client, however, because the IP address is assigned to the PXE Client, you need to add a specific PXE configuration When configuring the DHCP Server. As for the second problem, TFTP client already exists in the ROM where the PXE Client is located. PXE Client uses the TFTP Client to download the required files to the TFTP Server through the TFTP protocol. In this way, the conditions for running the PXE protocol are met. Let's take a look at the working process of the PXE protocol.

Work Process

In, PXE client is a computer that requires Linux installation. TFTP Server and DHCP Server run on another Linux Server. The Bootstrap file, configuration file, Linux kernel, and Linux root file system are all stored in the root directory of the TFTP Server on Linux Server. The PXE client requires three binary files: bootstrap, Linux kernel, and Linux root file system. The Bootstrap file is an executable program that provides you with a simple control interface and downloads the appropriate Linux kernel and Linux root file system based on your selections.

Solution Introduction

In this solution, you must first set a startup server and an installation server (which can be configured on the same physical machine), and then start the installation program stored on the startup server through the network. The installer automatically accesses the installation configuration file and media stored on the Installation server to complete the installation.

Technologies involvedThis solution mainly applies three technologies: 1. start the PXE protocol of the SLES installer from the network on the PC 2. the network installation function provided by the SLES Installer (that is, access the installation media through the network) 3. the unattended installation feature provided by the SLES Installer (SuSE is called AutoYast)

Hardware and software requirementsTo perform automatic installation as described in this article, you need the following hardware and software resources:

  • One PC machine is used as the startup and Installation server (Other architecture machines can also be used)
  • The network card of a PC to be installed must have PXE support
  • The above two machines have been connected to the same subnet.
  • SLES installation media to be installed
Configure tftpd

To simplify the process, we set up DHCP and TFTP server under the XP Virtual Machine, and use the tftpd tool to integrate and implement PXE network guidance. Note that the server and client must be in the same LAN. The principle of configuring services in Linux is similar. For details, refer to the Internet.

(1) download tftpd http://tftpd32.jounin.net/

(2) Start the tftpd32 program and select Settings]

(3) select as needed. Here we only select "TFTP" and "DHCP]

(4) The following Base Directory is set for TFTP: corresponds to the boot file PXE Compatibility for storing Linux: enhanced network startup support for different network adapters Show Progress bar: show progress during network boot: Translate Unix file names: Convert Unix file name Allow "\" As virtual root: Allow virtual path other advanced options: settings include compatibility and some details

(5) Pay attention to settings of Boot File and DHCP binding address in DHCP Configuration

(6) tftpboot directory structure

  1. file://D:\tftpboot (2 folders, 3 files, 35.86 MB, 36.46 MB in total.)
  2. │ INITRD 32.20 MB
  3. │ LINUX 3.64 MB
  4. │ pxelinux.016.04 KB
  5. ├─pxelinux.cfg (0 folders,1 files,193 bytes,193 bytes in total.)
  6. │default193 bytes
  7. └─tftpd32 (0 folders,4 files,620.33 KB,620.33 KB in total.)
  8. EUPL-EN.pdf 33.51 KB
  9. tftpd32.chm 346.96 KB
  10. tftpd32.exe 200.50 KB
  11. tftpd32.ini 39.36 KB

INITRD and LINUX are extracted from Linux boot image pxelinux.0 is the default file in the pxe boot image pxelinux. cfg folder for the boot menu configuration item editingtftpboot\pxelinux.cfgTo customize the access mode and path of the autoinst. xml file.

  1. default linux
  2. # Install Linux
  3. label linux
  4. kernel linux
  5. append initrd=initrd autoyast=ftp://198.15.0.106/suse/autoinst.xml install=ftp://198.15.0.106/suse splash=silent showopts
Configure FTP

(1) download Filezilla Server http://filezilla-project.org/

(2) Set ftp to allow anonymous access to the account. Configure the ftp path to extract the installation directory from the SLES image to the ftp directory.

Configure AutoYaST

Use the AutoYaST tool in SuSE to generate autoinst. xml and copy it to any ftp directory. Note that the file path is consistent with the default configuration.

Network start Machine

After the preceding configuration is complete, we will install it in the unattended way on the machine to be installed.

(1) start the machine to be installed and select start from the NIC. The specific method varies depending on the BIOS version. Is the screen for selecting network boot from vmwarevm.

(2) The PXE code in the NIC will contact the DHCP server to obtain the IP address and start the image, and then the image will be loaded and run.

(3) Start Automatic Installation

Add a custom module after installation

Here, we will add a Kernel patch as an example.

  1. <scripts>
  2. <init-scriptsconfig:type="list">
  3. <script>
  4. <filename>instkernel.sh</filename>
  5. <debug config:type="boolean">true</debug>
  6. <location></location>
  7. <interpreter>shell</interpreter>
  8. <source><![CDATA[
  9. #!/bin/bash
  10. #
  11. #After installation, the logfile from this script can be found in
  12. #/var/adm/autoinstall/logs
  13. #
  14. echo "========================================="
  15. echo "... Starting AutoYAST included script ..."
  16. echo "========================================="
  17. rpm -ivh --root=/ ftp://144.131.254.206/update/3.0...-0.6.8.1.x86_64.rpm
  18. rpm -ivh --root=/ ftp://144.131.254.206/update/3.0...-0.6.8.1.x86_64.rpm
  19. rpm -ivh --root=/ ftp://144.131.254.206/update/3.0...-0.6.8.1.x86_64.rpm
  20. rpm -ivh --root=/ ftp://144.131.254.206/update/3.0...-0.6.8.1.x86_64.rpm
  21. ]]>
  22. </source>
  23. </script>
  24. </init-scripts>
  25. </scripts>
Summary

In fact, during the study of automated deployment, we will encounter various pitfalls. Only those who have stepped on will be able to understand the difficulties. If you encounter any problems when testing and using SuSE automated installation, you are welcome to leave a message at the bottom of the original article. Let's learn and grow together _.

Update history

April May 28, 2015-first draft

Http://wsgzao.github.io/post/autoyast/

Additional reading
  • Https://www.suse.com/zh-cn/-SuSE
  • AutoYaST-http://doc.opensuse.org/projects/autoyast/

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.