• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Step by Step Guide to create autoyast xml file for SuSE Linux (SLES) with examples

    In this article I will show you some examples of autoyast xml files and syntax which can be used based on your requirement.

    Below article contains a sample autoyast xml file which works with SLES 10 and higher version

    AutoYast2 xml in SLES is similar to kickstart used with Red Hat only in terms of concept which means both of them are used for automating the installation but the syntax and variables used are completely different.

    AutoYaST2 is a system for installing one or more SUSE Linux systems automatically and without user intervention. AutoYaST2 installations are performed using an AutoYaST profile with installation and configuration data. That profile can be created using the configuration interface of AutoYaST2 and can be provided to YaST2 during installation in different ways.

    Configure General options (timezone, keyboard and mouse)

    General options include all the settings related to the installation process and the environment of the installed system.

    The mode section configures the behavior of AutoYaST with regard to confirmation and rebooting.
    • By default, the user must confirm the auto-installation process. This option allows the user to view and change the settings for a target system before they are committed and can be used for debugging.
    • confirm is set to "true" by default to avoid recursive installs when the system schedules a reboot after initial system setup. Only disable confirmation if you want to carry out a fully unattended installation.
    • With halt you cause AutoYaST to shut down the machine after all packages have been installed. Instead of a reboot into stage two, the machine is turned off. The boot loader is already installed and all your chroot scripts have run.
    • final_halt and final_reboot have been introduced with openSUSE 11.0 and SLES11. You can reboot or halt the machine after installation and configuration are finished at the end of stage 2.

    Replace the highlighted values tin yellow o configure your keyboard and language value
        <general>
          <clock>
            <hwclock>UTC</hwclock>
            <timezone>Asia/Calcutta</timezone>
          </clock>
          <keyboard>
            <keymap>english-us</keymap>
          </keyboard>
          <language>en_US</language>
          <mode>
        <halt config:type="boolean">false</halt>
            <forceboot config:type="boolean">false</forceboot>
            <final_reboot config:type="boolean">false</final_reboot>
            <final_halt config:type="boolean">false</final_halt>
            <confirm config:type="boolean">true</confirm>
            <second_stage config:type="boolean">true</second_stage>
          </mode>
          <mouse>
            <id>probe</id>
          </mouse>
          <report>
            <messages>
              <show config:type="boolean">true</show>
              <timeout config:type="integer">10</timeout>
              <log config:type="boolean">true</log>
            </messages>
            <errors>
              <show config:type="boolean">true</show>
              <timeout config:type="integer">10</timeout>
              <log config:type="boolean">true</log>
            </errors>
            <warnings>
              <show config:type="boolean">true</show>
              <timeout config:type="integer">10</timeout>
              <log config:type="boolean">true</log>
            </warnings>
          </report>
        </general>


    Configure bootloader

    Below section in the autoyast xml is mandatory, although the highlighted values can be modified accordingly
        <bootloader>
          <activate config:type="boolean">false</activate>
          <loader_type>grub</loader_type>
          <repl_mbr config:type="boolean">false</repl_mbr>
          <global>
            <boot_mbr config:type="boolean">true</boot_mbr>
          </global>
        </bootloader>


    Configure Networking, DNS, Routing

    • YaST will keep network settings created during installation (via Linuxrc) and/or merge it with network settings from the AutoYaST profile (if defined). 
    • AutoYaST settings have higher priority than already present configuration files. 
    • YaST will write ifcfg-* files from profile without removing old ones. 
    • If there is an empty or no dns and routing section, YaST will keep already present values. Otherwise settings from the profile will be applied.

    To configure network settings and activate networking automatically, one global resource is used to store the whole network configuration.

    In the below syntax I am creating a single interface with a DNS server and hostname
        <networking>
          <dns>
            <dhcp_resolv config:type="boolean">true</dhcp_resolv>
            <domain></domain>
            <hostname>golinuxhub</hostname>
            <nameserver>127.0.0.1</nameserver>
          </dns>
          <routing>
            <ip_forward config:type="boolean">false</ip_forward>
            <routes config:type="list">
             <route>
                 <destination>default</destination>
                 <device>-</device>
                 <gateway>192.168.1.32</gateway>
                 <netmask>-</netmask>
              </route>
            </routes>
          </routing>
          <interfaces config:type="list">
            <interface>
              <device>eth0</device>
              <startmode>onboot</startmode>
              <bootproto>static</bootproto>
              <ipaddr>192.168.1.10</ipaddr>
              <netmask>255.255.255.224</netmask>
            </interface>
          </interfaces>
        </networking>


    Configure NTP

    Using the below syntax you can configure your NTP client with the list of NTP servers
        <ntp-client>
          <configure_dhcp config:type="boolean">false</configure_dhcp>
          <peers config:type="list">
            <peer>
              <address>10.10.10.102</address>
              <initial_sync config:type="boolean">true</initial_sync>
              <options></options>
              <type>server</type>
            </peer>
            <peer>
              <address>10.10.10.104</address>
              <initial_sync config:type="boolean">true</initial_sync>
              <options></options>
              <type>server</type>
            </peer>
          </peers>
          <start_at_boot config:type="boolean">true</start_at_boot>
          <start_in_chroot config:type="boolean">true</start_in_chroot>
        </ntp-client>







    Create a User

    To create a user use syntax as explained below with the encrypted password and it's login shell
        <users config:type="list">
          <user>
            <encrypted config:type="boolean">true</encrypted>
            <home>/root</home>
            <shell>/bin/bash</shell>
            <user_password>/.b.X4RxPGnig</user_password>
            <username>root</username>
          </user>
        </users>


    Configure partitioning

    To understand more on every syntax used here you can follow the Guide from SuSE.

    In the below example I am creating LVM based configiration with root, boot, swap and some other data partitions
    <partitioning config:type="list" >
    <drive>
    <initialize config:type="boolean">true</initialize>
    <partitions config:type="list">
      <!-- part for boot -->
      <partition>
        <format config:type="boolean" >false</format>
        <partition_id config:type="integer" >131</partition_id>
       <filesystem config:type="symbol" >ext3</filesystem>
       <format config:type="boolean" >true</format>
        <mount>/boot</mount>
        <size>128M</size>
      </partition>

      <!-- part for root -->
      <partition>
        <format config:type="boolean" >false</format>
        <lvm_group>system</lvm_group>
        <partition_id config:type="integer" >142</partition_id>
        <size>max</size>
      </partition>

    <!-- max alloc root 128 auto -->
        </partitions>
        <use>all</use>
    </drive>
    <drive>
      <device>/dev/system</device>
        <initialize config:type="boolean" >false</initialize>
        <is_lvm_vg config:type="boolean" >true</is_lvm_vg>
        <lvm2 config:type="boolean" >true</lvm2>
        <partitions config:type="list" >
          <!-- LV for root -->
          <partition>
            <filesystem config:type="symbol" >ext3</filesystem>
            <format config:type="boolean" >true</format>
            <lv_name>root</lv_name>
            <mount>/</mount>
            <partition_id config:type="integer" >142</partition_id>
            <size>800m</size>
          </partition>

          <!-- LV for tmp -->
          <partition>
            <filesystem config:type="symbol" >ext3</filesystem>
            <format config:type="boolean" >true</format>
            <lv_name>tmp</lv_name>
            <mount>/tmp</mount>
            <partition_id config:type="integer" >142</partition_id>
            <size>2048m</size>
          </partition>

          <!-- LV for var -->
          <partition>
            <filesystem config:type="symbol" >ext3</filesystem>
            <format config:type="boolean" >true</format>
            <lv_name>var</lv_name>
            <mount>/var</mount>
            <partition_id config:type="integer" >142</partition_id>
            <size>4096m</size>
          </partition>

          <!-- LV for opt -->
          <partition>
            <filesystem config:type="symbol" >ext3</filesystem>
            <format config:type="boolean" >true</format>
            <lv_name>opt</lv_name>
            <mount>/opt</mount>
            <partition_id config:type="integer" >142</partition_id>
            <size>2048m</size>
          </partition>

          <!-- LV for swap -->
          <partition>
            <filesystem config:type="symbol" >swap</filesystem>
            <format config:type="boolean" >true</format>
            <lv_name>swap</lv_name>
            <mount>swap</mount>
            <partition_id config:type="integer" >142</partition_id>
          </partition>

        </partitions>
        <pesize>32M</pesize>
        <use>all</use>
    </drive>

    </partitioning>


    Configure Software

    You can provide a custom list of rpms which you want to be installed or removed during the installation
    <software>
          <kernel>kernel-default</kernel>
          <patterns config:type="list">
             <pattern>Minimal</pattern>
          </patterns>

          <packages config:type="list">
            <package>update-alternatives</package>
            <package>vim-base</package>
            <package>vim-data</package>
            <package>vim</package>
            <package>audit</package>
            <package>libltdl7</package>
            <package>openssh</package>
            <package>man</package>
            <package>man-pages</package>
            <package>openssl1</package>
            <package>libopenssl1_0_0</package>
            <package>quota</package>
          </packages>

          <remove-packages config:type="list">
            <package>mpt-firmware</package>
          </remove-packages>
    </software>


    Custom User scripts

    By adding scripts to the auto-installation process you can customize the installation according to your needs and take control in different stages of the installation.

    In the auto-installation process, five types of scripts can be executed and they will be described here in order of "appearance" during the installation.

    All scripts have to be in the <scritps> section.
    • pre-scripts (very early, before anything else really happens)
    • postpartitioning-scripts (after partitioning and mounting to /mnt but before RPM installation—since openSUSE 11.2 and SLES11 SP3)
    • chroot-scripts (after the package installation, before the first boot)
    • post-scripts (during the first boot of the installed system, no services running)
    • init-scripts (during the first boot of the installed system, all services up and running)

    Some examples
    1. pre script
    <pre-scripts config:type="list">
       <script>
           <filename>my-test.sh</filename>
           <interpreter>shell</interpreter>
           <source><![CDATA[#!/bin/sh
    echo "This is a dummy pre script"
    ]]>
           </source>
       </script>
    <aiPreScript/>
    </pre-scripts>

    2. post scripts
    <post-scripts config:type="list">
        <script>
            <filename>enable_reboot_on_panic.sh</filename>
            <source> <![CDATA[#!bin/sh
    echo "This is a dummy post script"
    ]]>
           </source>
        </script>
    </post-scripts>

    3. chroot scripts
    <chroot-scripts config:type="list">
        <script>
            <chrooted config:type="boolean">true</chrooted>
            <interpreter>shell</interpreter>
            <filename>disable-ipv6.sh</filename>
            <source>
              <![CDATA[
    sysctl -w net.ipv6.conf.all.disable_ipv6=1;
    echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf;
    ]]>
            </source>
        </script>
    </chroot-scripts>

    There are many more sections which can be used in an autoyast xml file which goes out of this article's scope. For more information you can always follow the SuSE Documentation

    I hope the article was useful.

    Deepak Prasad

    is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+

    Do you also have something to share here?

    Become an author and be a part of our GoLinuxHub Team, Click here for more information
    Step by Step Guide to create autoyast xml file for SuSE Linux (SLES) with examples Step by Step Guide to create  autoyast xml file for SuSE Linux (SLES) with examples Reviewed by Deepak Prasad on Sunday, February 18, 2018 Rating: 5

    No comments:

    Powered by Blogger.