Unattended Linux Installation

/, How To, Linux/Unattended Linux Installation

Here you can find the set of preseed/kickstart configuration files for most common operating systems. These files are used for an unattended installation and make provisioning new servers much easier. Presented configs are suitable for Debian 8/9, Ubuntu 14/16, RHEL/CentOS/Oracle Linux 6/7, and SLES (SUSE) 12. Probably, they can also work with other derivatives of the mentioned Linux distributions.

Using these files to build up a new server you will get the following result:

  • Minimal required set of packages will be installed (barebone), SSH service will be enabled
  • X11 Windows will not be installed, only text mode will be available. In most cases text mode is more than enough for servers
  • Disk will be partitioned using LVM (Logical Volume Manager). LVM provides scalability and flexibility in disk space allocation and usage
  • Chosen filesystem is EXT4 because XFS cannot be shrunk. XFS is a good choice for additional disks/partitions (for example, /opt partition which can be configured on a separate disk after the installation is complete)
  • Directories will be created: /root/scripts, /root/downloads, /root/certs, /root/backup

Note: it is assumed that you have a DHCP server on the network so that a server can obtain an IP address automatically, otherwise you have to amend these configs or add extra parameters to the boot options to define network settings.

Usage

Before you start using these files you should replace/amend some values:

  • Language, location, and keyboard layout
  • Root password (hash), current value is Tester!123
  • Address of your internal proxy server (if applicable)
  • Paths to your custom post-installation/deployment scripts (if applicable)

Invoking preseed/kickstart files on different distributions uses different sets of command-line options, each section below contains those sets.

Debian

Invoke (press ESCAPE and type):

auto url=http://192.168.100.10/d9.cfg hostname=debian01

To get preseeded values which were used during the installation (not all of them are needed):

apt-get -y install debconf-utils
debconf-get-selections --installer

To validate the format of your preseed config:

debconf-set-selections -c d9.cfg

To generate a new hash to be used as the root password (for example, MyPa$$w0rd):

mkpasswd -m sha-512 -S saltsalt -s <<< MyPa\$\$w0rd
Download

 
Unfortunately, the debian installer allocates all remaining free space to the last volume defined, so this preseed config creates the lv_extra partition which can be removed after the installation is complete to reclaim that space back to the volume group. You can do it by executing the commands below:

umount /extra
lvremove -f /dev/vg00/lv_extra
rmdir --ignore-fail-on-non-empty /extra
sed -i '/lv_extra/d' /etc/fstab

Ubuntu

Invoke (press ESCAPE, F6, ESCAPE, and then type):

auto url=192.168.100.10/u16.cfg hostname=ubuntu01 initrd=/install/initrd.gz quiet ---

To get preseeded values which were used during the installation (not all of them are needed):

apt-get -y install debconf-utils
debconf-get-selections --installer

To validate the format of your preseed config:

debconf-set-selections -c u16.cfg

To generate a new hash to be used as the root password (for example, MyPa$$w0rd):

apt-get -y install whois
mkpasswd -m sha-512 -S saltsalt -s <<< MyPa\$\$w0rd

The following menus require user input, everything after is an unattended installation:

  • Select a language
  • Select your location
  • Configure the keyboard
  • Configure the network
Download

 
You also should remove the lv_extra partition after the installation (see the Debian section for more information).

RHEL, CentOS, and Oracle Linux

RHEL derivatives do not allow setting up a hostname as a parameter to invoking kickstart configs, but there is a simple solution how to make it possible – a custom wrapper script. You can find the example of such a wrapper below:

Download

Invoke (press ESCAPE and type):

linux ks=http://192.168.100.10/rksw.php?v=r7&h=centos01
Parameter Description
v=r7 Config to be used, in this case, r7.cfg
h=centos01 Hostname to be set – centos01

To get kickstart values which were used during the installation:

cat /root/anaconda-ks.cfg

To validate the format of your kickstart config:

yum -y install pykickstart
ksvalidator r7.cfg

To generate a new hash to be used as the root password (for example, MyPa$$w0rd):

python -c 'import crypt; print(crypt.crypt("MyPa$$w0rd"))'

RHEL/CentOS/Oracle Linux 6

Download

RHEL/CentOS/Oracle Linux 7

Download

Note: Your web server must support PHP to use the wrapper script.

SUSE

Invoke (type in the Boot Options field):

install=cd:// autoyast=http://192.168.100.10/s12.xml netsetup=dhcp hostname=suse01

To get autoyast values of a server (better to do it on a fresh installation):

yast2 clone_system
cat /root/autoinst.xml

To validate the format of your autoyast config:

xmllint s12.xml
jing /usr/share/YaST2/schema/autoyast/rng/profile.rng s12.xml

To generate a new hash to be used as the root password (for example, MyPa$$w0rd):

python3 -c 'import crypt; print(crypt.crypt("MyPa$$w0rd"))'
Download

See also

HugePages Configurator
System Monitor
Debian Installer – Preseed
Red Hat Customer Portal – Kickstart Installations
SUSE Linux Enterprise Server 12 – AutoYaST

Contact us

Please, feel free to contact us if you have any questions or suggestions. Post a comment below if you want to report a bug.

By |2018-04-28T21:45:05+00:00November 29th, 2017|Configs, How To, Linux|0 Comments

Leave A Comment