Difference between revisions of "Cluster der kan alt/PXE and Kickstart"

From Teknologisk videncenter
Jump to: navigation, search
(Sæt kickstartfil som default, og timer til 5 sek)
m (The kickstart file)
 
(30 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
=Aim=
 +
 +
To enable unattended installation and configuration of Ubuntu on nodes, so that their configuration matches the master machine.  This is achieved with PXE boot and configuration with Kickstart.
 +
 
=PXE=
 
=PXE=
 
Install tftp server
 
Install tftp server
Line 10: Line 14:
 
<source lang=cli>
 
<source lang=cli>
 
cd /var/lib/tftpboot/
 
cd /var/lib/tftpboot/
wget http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/netboot.tar.gz
+
wget http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/netboot.tar.gz
 
tar -xvzf netboot.tar.gz
 
tar -xvzf netboot.tar.gz
 
</source>
 
</source>
 +
Note: trusty = ubuntu 14.04, precise = ubuntu 12.04
  
===Sæt kickstartfil som default, og timer til 5 sek===
+
===Set the kickstartfile as default, and the timer to 5 sec===
Flyt '''menu default''' fra Install, til Kickstart i denne fil
+
Enter the txt.cfg file
 
<source lang=cli>
 
<source lang=cli>
 
sudo nano /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/txt.cfg
 
sudo nano /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/txt.cfg
 
</source>
 
</source>
Menu label kommer ca til at se sådan her ud:
+
Rename the "default install" line to "default unattended" so the the unattended kickstart file will be executed by default
 +
 
 +
Insert the "label unattended" section in the bottom ofthe file
 
<source lang=cli>
 
<source lang=cli>
 
label unattended
 
label unattended
         menu label Install ^Unattended
+
         menu label ^Unattended install
 
         kernel ubuntu-installer/amd64/linux
 
         kernel ubuntu-installer/amd64/linux
         append vga=788 initrd=ubuntu-installer/amd64/initrd.gz ks=http://10.0.0.1/kickstart/ks.cfg
+
         append vga=768 initrd=ubuntu-installer/amd64/initrd.gz ks=http://10.0.0.1/kickstart/ks.cfg
 
</source>
 
</source>
Ændre value Timeout til 50.
+
Change the timeout value to 50 in the default file.
 
<source lang=cli>
 
<source lang=cli>
sudo nano /var/lib/tftpboot/pxeboot.cfg/default
+
sudo nano /var/lib/tftpboot/pxelinux.cfg/default
 
</source>
 
</source>
{{Source cli}}
 
[[Category:Cluster]][[Category:Ubuntu]]
 
  
 
=Kickstart=
 
=Kickstart=
*Der skal anvendes en http: server således at noderne kan hente kickstart filen. Anvend for ekempel '''lighttpd'''
+
Install the http server lighttpd
 
<source lang=cli>
 
<source lang=cli>
 
sudo apt-get install lighttpd
 
sudo apt-get install lighttpd
 
</source>
 
</source>
*For at lave kickstart filer kan i ''håndlave'' dem i en editor eller anvende '''system-config-kickstart'''
+
Create the ks.cfg file
 
 
For at bruge '''system-config-kickstart''' skal du installere det med kommando'en
 
<source lang=cli>
 
sudo apt-get install system-config-kickstart
 
</source>
 
 
 
For at du kan bruge '''sytem-config-kickstart''' skal du have installeret Xming på din windows pc. Du kan hente Xming på dette link:
 
http://sourceforge.net/projects/xming/
 
 
 
==Putty Opsætning==
 
[[File:Putty-Xming-setup.png|350px]]
 
 
 
==System-config-kickstart==
 
 
 
Kør Kommando'en nedenfor for at starte med at lave din kickstart fil.
 
 
 
 
<source lang=cli>
 
<source lang=cli>
system-config-kickstart
+
nano /var/www/kickstart/ks.cfg
 
</source>
 
</source>
:#så får du et grafisk window pop up til opsætning af en kickstart fil
 
 
  
'''Filenplacering'''
+
==The kickstart file==
<source lang=cli>
+
Copy/paste the following text to the ks.cfg file. (Make your own changes like ip addresses and domain name, so it will fit your setup.)
/var/www/ks.cfg
 
</source>
 
  
==Kickstart fil==
+
Note: When choosing a password, be sure to make it more than eight symbols, with letters, numbers and special symbols.  "unattended" install will stop, waiting for confirmation of a weak password, if this advice is not followed... ;-)
 
<source lang=cli>
 
<source lang=cli>
 
#Generated by Kickstart Configurator
 
#Generated by Kickstart Configurator
 
#platform=x86
 
#platform=x86
  
 +
#################
 +
#Node configuration
 +
#################
 
#System language
 
#System language
 
lang da_DK
 
lang da_DK
 
#Language modules to install
 
#Language modules to install
langsupport da_DK
+
langsupport us_EN
 
#System keyboard
 
#System keyboard
 
keyboard dk
 
keyboard dk
Line 81: Line 69:
 
#System timezone
 
#System timezone
 
timezone Europe/Copenhagen
 
timezone Europe/Copenhagen
 +
 +
#################
 +
#User configuration
 +
#################
 
#Root password
 
#Root password
rootpw --iscrypted $1$AkUb1qdI$vMYeX3C37RX0pRjBppX7W.
+
rootpw cluster
 
#Initial user
 
#Initial user
user cluster --fullname "cluster admin" --iscrypted --password $1$9Za4QvWX$AXgp$
+
user cluster --fullname "cluster" --password <more than 8 symbols here>
 +
 
 
#Reboot after installation
 
#Reboot after installation
 
reboot
 
reboot
Line 99: Line 92:
 
#Partition clearing information
 
#Partition clearing information
 
clearpart --all --initlabel
 
clearpart --all --initlabel
 +
 +
#################
 +
#Disk configuration
 +
#################
 
#Disk partitioning information
 
#Disk partitioning information
 
part / --fstype ext4 --size 1024
 
part / --fstype ext4 --size 1024
Line 107: Line 104:
 
part /usr --fstype ext4 --size 5120
 
part /usr --fstype ext4 --size 5120
 
part swap --size 1024
 
part swap --size 1024
 +
 
#System authorization infomation
 
#System authorization infomation
 
auth  --useshadow  --enablemd5  --enablenis --nisdomain dka.local --nisserver 1$
 
auth  --useshadow  --enablemd5  --enablenis --nisdomain dka.local --nisserver 1$
Line 115: Line 113:
 
#Do not configure the X Window System
 
#Do not configure the X Window System
 
skipx
 
skipx
 +
 +
#################
 +
#Package installation
 +
#################
 
#Package install information
 
#Package install information
 
%packages
 
%packages
Line 137: Line 139:
 
nis
 
nis
 
%pre
 
%pre
 +
 +
#################
 +
#Scipt run
 +
#################
 
#!/bin/bash
 
#!/bin/bash
 
echo "Pre-installation"
 
echo "Pre-installation"
Line 147: Line 153:
 
echo "10.0.0.1:/script /mnt/tmp/ nfs rw,bg,hard,intr 0 0" >> /target/etc/fstab
 
echo "10.0.0.1:/script /mnt/tmp/ nfs rw,bg,hard,intr 0 0" >> /target/etc/fstab
 
/target/etc/init.d/nis restart
 
/target/etc/init.d/nis restart
 +
 +
mount 10.0.0.1:/home/ /home/
 
</source>
 
</source>
 
Sådan ser vores gældende Kickstart fil ud
 
 
{{Source cli}}
 
{{Source cli}}

Latest revision as of 17:18, 19 October 2014

Aim

To enable unattended installation and configuration of Ubuntu on nodes, so that their configuration matches the master machine. This is achieved with PXE boot and configuration with Kickstart.

PXE

Install tftp server

apt-get install tftpd-hpa

Netinstaller

Download and install pxelinux to tftp root:

cd /var/lib/tftpboot/
wget http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/netboot.tar.gz
tar -xvzf netboot.tar.gz

Note: trusty = ubuntu 14.04, precise = ubuntu 12.04

Set the kickstartfile as default, and the timer to 5 sec

Enter the txt.cfg file

sudo nano /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/txt.cfg

Rename the "default install" line to "default unattended" so the the unattended kickstart file will be executed by default

Insert the "label unattended" section in the bottom ofthe file

label unattended
        menu label ^Unattended install
        kernel ubuntu-installer/amd64/linux
        append vga=768 initrd=ubuntu-installer/amd64/initrd.gz ks=http://10.0.0.1/kickstart/ks.cfg

Change the timeout value to 50 in the default file.

sudo nano /var/lib/tftpboot/pxelinux.cfg/default

Kickstart

Install the http server lighttpd

sudo apt-get install lighttpd

Create the ks.cfg file

nano /var/www/kickstart/ks.cfg

The kickstart file

Copy/paste the following text to the ks.cfg file. (Make your own changes like ip addresses and domain name, so it will fit your setup.)

Note: When choosing a password, be sure to make it more than eight symbols, with letters, numbers and special symbols. "unattended" install will stop, waiting for confirmation of a weak password, if this advice is not followed... ;-)

#Generated by Kickstart Configurator
#platform=x86

#################
#Node configuration
#################
#System language
lang da_DK
#Language modules to install
langsupport us_EN
#System keyboard
keyboard dk
#System mouse
mouse
#System timezone
timezone Europe/Copenhagen

#################
#User configuration
#################
#Root password
rootpw cluster
#Initial user
user cluster --fullname "cluster" --password <more than 8 symbols here>

#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://mirror.tekkom.dk/ubuntu/
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel

#################
#Disk configuration
#################
#Disk partitioning information
part / --fstype ext4 --size 1024
part /boot --fstype ext4 --size 512
part /home --fstype ext4 --size 1024
part /var --fstype ext4 --size 3072
part /tmp --fstype ext4 --size 3072
part /usr --fstype ext4 --size 5120
part swap --size 1024

#System authorization infomation
auth  --useshadow  --enablemd5  --enablenis --nisdomain dka.local --nisserver 1$
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx

#################
#Package installation
#################
#Package install information
%packages
openssh-server
nmap
ssh
screen
bmon
iperf
bonnie++
lmbench
lm-sensors
snmpd
snmp
build-essential
gcc
openssh-client
nfs-common
mpich2
dsh
portmap
nis
%pre

#################
#Scipt run
#################
#!/bin/bash
echo "Pre-installation"
%post --nochroot
echo "portmap : 10.0.0.1" >> /target/etc/hosts.allow
echo "ypserver 10.0.0.1" >> /target/etc/yp.conf
perl -pi -w -e 's/\/home/\/home.old/g;' /target/etc/fstab
mkdir /target/mnt/tmp
echo "10.0.0.1:/home /home nfs rw,bg,hard,intr 0 0" >> /target/etc/fstab
echo "10.0.0.1:/script /mnt/tmp/ nfs rw,bg,hard,intr 0 0" >> /target/etc/fstab
/target/etc/init.d/nis restart

mount 10.0.0.1:/home/ /home/