scientific linux network installation pete gronbech: april 2005
DESCRIPTION
TRANSCRIPT
Scientific LinuxNetwork Installation
Pete Gronbech: April 2005RAL
dhcpd.conf
# /etc/dhcpd.conf.ngexample - a DHCP daemon configuration file example# for dhcpd 2.0
# distribute an IP address only if the nodes is knowndeny unknown-clients;# the server will not reply to the unknown clients; in this way# it is possible to have a second DHCP servernot authoritative;option domain-name "physics.ox.ac.uk";
# These 3 lines are needed for the installation via PXEoption dhcp-class-identifier "PXEClient";option vendor-encapsulated-options 01:04:00:00:00:00:ff;filename "pxelinux.0";
subnet 163.1.5.0 netmask 255.255.255.0 {
option routers 163.1.5.254; option domain-name-servers 163.1.2.1;
host t2slwn01 { hardware ethernet 00:30:48:72:F3:61; fixed-address 163.1.5.236; next-server 163.1.5.240; }
/tftpboot/pxelinux.cfg
[root@t2lcfg pxelinux.cfg]# ls –la /tftpboot/pxelinux.cfglrwxrwxrwx 1 root root 31 Feb 15 12:47 A30105EC -> hosts/t2slwn01.physics.ox.ac.uklrwxrwxrwx 1 root root 11 Dec 8 17:09 A30105ECold -> sl-kick.cfglrwxrwxrwx 1 root root 31 Feb 15 12:47 A30105ED -> hosts/t2slwn02.physics.ox.ac.uklrwxrwxrwx 1 root root 11 Dec 10 14:41 A30105EDold -> sl-kick.cfglrwxrwxrwx 1 root root 31 Feb 15 13:43 A30105EE -> hosts/t2slwn03.physics.ox.ac.uk-rwxr-xr-x 1 root root 414 Feb 15 12:45 ack.cgi-rw-r--r-- 1 apache apache 631 Jul 21 2004 boot-hd.cfg-rwxr-xr-x 1 root root 1140 Feb 15 12:47 create-hash-links.pllrwxrwxrwx 1 apache apache 11 May 7 2004 default -> boot-hd.cfgdrwxr-xr-x 2 apache apache 4096 Feb 21 15:59 hosts-rw-r--r-- 1 apache apache 194 Oct 24 2003 lcfg-install-62.cfg-rw-r--r-- 1 apache apache 238 May 17 2004 lcfg-install-73-2.4.20.cfg-rw-r--r-- 1 apache apache 218 May 13 2004 lcfg-install-73.cfg-rw-r--r-- 1 apache apache 209 Oct 24 2003 lcfg-install-nointeract-62.cfg-rw-r--r-- 1 apache apache 253 May 17 2004 lcfg-install-nointeract-73-2.4.20.cfg-rw-r--r-- 1 apache apache 233 May 7 2004 lcfg-install-nointeract-73.cfg-rw-r--r-- 1 root root 277 May 13 2004 lcfg-install-nointeract-bigkernel-73.cfg-rw-r--r-- 1 root root 279 May 13 2004 lcfg-install-nointeract-custom-73.cfg-rwxr-xr-x 1 root root 182 Feb 15 12:45 Makefiledrwxr-xr-x 2 root root 4096 Feb 15 12:52 oldlinks-rw-r--r-- 1 root root 758 Dec 9 17:00 sl-kick.cfg-rwxr-xr-x 1 root root 1063 Feb 15 12:45 swing
boot_hd.cfg
[root@t2lcfg pxelinux.cfg]# cat boot-hd.cfg default local
# This is the default pxelinux cfg file# It by default drops onto the harddisk but otherwise # various rescure and diagnostic utilities can be used.default localprompt 1# timeout after 6 seconds. (1/10s of seconds)timeout 60
# Pop up a small menu, this should be changed to correspond to # the options below.display messages/boot-hd.msg
label local localboot 0
label memtest+ kernel memdisk append initrd=diagnostics/memtestp-1.15.img
label cpuburn kernel memdisk append initrd=diagnostics/cpuburn-1.00.img
label nuke kernel memdisk append initrd=diagnostics/book-and-nuke.img
sl-kick.cfg
[root@t2lcfg pxelinux.cfg]# cat sl-kick.cfg
# This is the default pxelinux cfg file# It by default drops onto the harddisk but otherwise # various rescure and diagnostic utilities can be used.default kickstartprompt 1# timeout after 6 seconds. (1/10s of seconds)timeout 60
# Pop up a small menu, this should be changed to correspond to # the options below.#display messages/boot-hd.msg
label kickstart kernel SL/vmlinuz append initrd=SL/initrd.img keymap=uk devfs=nomount ramdisk_size=16384
ksdevice=link ks=nfs:163.1.5.240:/opt/local/linux/SL303/ks/
hosts subdir link script
[root@t2lcfg pxelinux.cfg]# cat Makefile # Make file to update all the hash to hostname links.# This should be run after the the dhcpd file is updated# or the DNS is changed.
all: /usr/local/sbin/create-hash-links.pl
[root@t2lcfg pxelinux.cfg]# cat /usr/local/sbin/create-hash-links.pl#!/usr/bin/perl -w
use strict ;use Socket ;
my $dhcpd = " /etc/dhcpd.conf" ;my $tftp = "/tftpboot/pxelinux.cfg" ;
my @ips ;
open (DHCP,"<$dhcpd") or die "Could not open $dhcpd: $!\n" ;
print "Collecting a list of ip address from $dhcpd\n" ;while ( <DHCP> ) { if ( /\s*[^#]\s*fixed-address\s+(\S+)\s*;/ ) { my $fixed = $1 ; # Check if it is a host name and if so we must convert it to # ip address. if ( $fixed =~ m/^.*ox\.ac\.uk$/ ) { print "Converting hostname $fixed to ip address: " ; $fixed = inet_ntoa(inet_aton($fixed) ) or die "fixed= $fixed\n" ; print "$fixed\n" ; } push(@ips,$fixed) ; }}
# Now set up the symlinks IF they are not already there.foreach my $ip ( @ips ) { my $hexip = sprintf("%02X%02X%02X%02X",split('\.',$ip)) ; my $hostname = gethostbyaddr(inet_aton($ip), AF_INET) or die "No reverse look up for $ip\n" ; # Create a symlink from the hostname to default config. symlink('../boot-hd.cfg',$tftp.'/hosts/'.$hostname) unless ( -l $tftp.'/hosts/'.$hostname ) ; symlink('hosts/'.$hostname,$tftp.'/'.$hexip) ;
}
close (DHCP) ;
kickstart directory
[root@t2lcfg pxelinux.cfg]# cd /opt/local/linux/SL303/[root@t2lcfg SL303]# ls -latotal 20drwxr-xr-x 5 root root 4096 Dec 9 17:02 .drwxr-xr-x 5 root root 4096 Nov 26 16:14 ..drwxr-xr-x 3 root root 4096 Oct 1 00:14 imagesdrwxr-xr-x 2 root root 4096 Feb 15 15:02 ksdrwxr-xr-x 5 root root 4096 Oct 1 00:14 SL[root@t2lcfg SL303]# cd ks[root@t2lcfg ks]# ls -latotal 16drwxr-xr-x 2 root root 4096 Feb 15 15:02 .drwxr-xr-x 5 root root 4096 Dec 9 17:02 ..lrwxrwxrwx 1 root root 15 Dec 9 12:10 163.1.5.236-kickstart -> anaconda-ks.cfglrwxrwxrwx 1 root root 15 Dec 10 14:40 163.1.5.237-kickstart -> anaconda-ks.cfglrwxrwxrwx 1 root root 15 Dec 10 14:40 163.1.5.238-kickstart -> anaconda-ks.cfglrwxrwxrwx 1 root root 14 Feb 14 16:40 163.1.5.93-kickstart -> SL-Clar-ks.cfg-rw-r--r-- 1 root root 1551 Feb 15 15:01 anaconda-ks.cfg-rw-r--r-- 1 root root 1567 Feb 15 14:10 SL-Clar-ks.cfg
kickstart file 1
[root@t2lcfg ks]# cat anaconda-ks.cfg # Kickstart file automatically generated by anaconda.#network --device eth1 --bootproto dhcpreboot
installlang en_US.UTF-8langsupport --default en_US.UTF-8 en_US.UTF-8keyboard ukmouse genericwheelps/2 --device psauxxconfig --card "ATI Mach64" --videoram 8192 --hsync 31.5-67 --vsync 50-75 --resolution 1280x1024 --depth 24 --startxonboot --defaultdesktop gnomenetwork --bootproto dhcpnfs --server 163.1.5.240 --dir /opt/local/linux/SL303/rootpw --iscrypted encryptedpasswdherefirewall --disabledauthconfig --enableshadow --enablemd5timezone Europe/Londonbootloader --location=mbr
Kickstart file 2
# The following is the partition information you requested# Note that any partitions you deleted are not expressed# here so unless you clear all partitions first, this is# not guaranteed to workzerombr yesclearpart --allpart / --fstype "ext3" --size=6000part /usr --fstype "ext3" --size=6000part swap --size=2000part /home --fstype "ext3" --size=100 --grow
%packages@ office@ engineering-and-scientific@ editors@ xemacs@ base-x@ graphics@ misc-sl@ text-internet@ kde-desktop@ gnome-desktop@ dialup@ yum@ openafs-client@ authoring-and-publishing@ printing@ sound-and-video@ graphical-internetkernelkernel-module-openafs-2.4.21-20.ELsmpkernel-smppinegrubgv
%post
# Change link on server to boot from hard diskwget -q t2lcfg.physics.ox.ac.uk/cgi-bin/ack.cgi
more later….
ack.cgi
[root@t2lcfg ks]# more /var/www/cgi-bin/ack.cgi #!/usr/bin/perl
use Socket ;
# Configuration file to boot from HD$boothd = "../boot-hd.cfg";
print "Content-type: text/plain\n\n";
$point_address = $ENV{'REMOTE_ADDR'};$hostname = gethostbyaddr(inet_aton($point_address), AF_INET) ;
system ("cd /tftpboot/pxelinux.cfg/hosts ; ln -fs $boothd /tftpboot/pxelinux.cfg/hosts/$hostname");
print "$hostname is now configured to boot from $boothd\n";
Post Installation
• We want to perform updates and local customisations
• yum update has to be done after the first reboot so set up a one time /etc/rc.local which calls configuration modules then returns the original rc.local and reboots.
• yaim can be installed here and LCG software installed and configured
• SL can also be mirrored to speed up installations
Post Installation
### Write motdecho "Kickstart-installed Scientific Linux release 3 (FNAL SL 303) `/bin/date`" > /etc/motd
# Create a post install init script to run once# Mount the kickstart directory from the server.
mkdir /tmp/kickmount -o nolock,nfsvers=2 t2lcfg.physics.ox.ac.uk:/opt/local/linux/SL303 /tmp/kick
mkdir /root/install-scriptscp /tmp/kick/modules/* /root/install-scripts
umount /tmp/kickrmdir /tmp/kick
Post Installation
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.orig
# Create a script to run at first reboot.cat <<EOFrc>/etc/rc.d/rc.local#!/bin/sh
# One time script to run in two minutes/usr/bin/at "now + 1 minutes" <<EOFat >& /dev/null
MODULES="slyum yum-4-lcg java yaim ntpd local-admins root-admins nokudzu "# MODULES="slyum yaim yum-4-lcg lcg-install-wn lcg-setup-wn"
# MODULES="denyAll syslog slyum network180 yumit ntpd sshd-ral root-admins" # MODULES="\\\$MODULES sendmail heartbeat local-admins gmond-lcg-others"# MODULES="\\\$MODULES nrpe yaim yum-4-lcg lcg-install-bdii lcg-setup-bdii"
for M in \\\$MODULES do /bin/sh -x /root/install-scripts/\\\$M.sh >& /root/install-scripts/\\\$M.log done
mv /etc/rc.d/rc.local /etc/rc.d/rc.local.onetime mv /etc/rc.d/rc.local.orig /etc/rc.d/rc.local /sbin/shutdown -r now
EOFat
touch /var/lock/subsys/localEOFrc
Configuration Modules
• slyum.sh
#!/bin/sh
# yumsl consider yum for SL and update it.cd /etcrm -f yum.confwget http://t2lcfg.physics.ox.ac.uk/yum/SL/yum.conf
/sbin/chkconfig yum offyum -d 1 -y update
echo "Oxford PP Scientific Linux 3 standard yum update installed `date`" >> /etc/motd
Configuration Modules
• yum-4-lcg.sh
#!/bin/sh
# Set up the yum repostories for LCG.cat <<EOF>>/etc/yum.conf
[oxfordserver]name=Oxford javabaseurl=http://t2lcfg.physics.ox.ac.uk/yum/java/
[sl-lcg]name=LCG packagesbaseurl=http://t2lcfg.physics.ox.ac.uk/yum/lcg/2_4_0/sl3/
[sl-lcg-ca]name=LCG CA packagesbaseurl=http://t2lcfg.physics.ox.ac.uk/yum/lcg/ca/
EOF
Configuration Modules
• java.sh
#!/bin/sh
yum -y -d 0 -t install j2sdk
Configuration Modules
• root-admins.sh
#!/bin/sh
# We want to allow admins to login
mkdir -p /root/.sshchmod go-rwx,u+rwx /root/.ssh
cat <<EOF>/root/.ssh/authorized_keys
ssh-dss //gAAAIB8jRBMgcTjU………………………………………qDjt5rmnGLKcSjLwNXCDqSNbKTqOAEWJO2SVp4r7emo3QGBiiiSL9AuBnIscNbLI0oitAFZlFs0fmZSlYu1AiJk/f2MShNA7PTNlbqLUeF4BkUTpO/GFjiTe/FEIlF3IaArjYGfhrBCS14uhhULtcyrHt3KX2qwMw== gronbech@pplx3
EOF
lcg installation
• lcg-install-wn#!/bin/sh
# Install the packages for a UI node.
# We should just install the lcg-WN package# I just install the packages that it requires.
yum -t -d 0 -y install lcg-WN-torqueyum -t -d 0 -y install lcg-CA
lcg installation
• lcg-setup-wn.sh#!/bin/sh
# Do the buisness./opt/lcg/yaim/scripts/
configure_WN_torque /root/yaim-conf/site-info.def
GOC Wiki
• http://goc.grid.sinica.edu.tw/gocwiki/AdministrationFaq– Using yum to install LCG– Mirror LCG Packages– Preserving host keys when using Kickstart
Credits
• This installation method is heavily based on work carried out at RAL by Chris Brew and Steve Traylen.