[asterisk-users] Using centos and kickstart to build a minimum installation
Steve Edwards
asterisk.org at sedwards.com
Tue Jan 20 16:25:16 CST 2009
On Tue, 20 Jan 2009, Julian Lyndon-Smith wrote:
> Using centos 5.2,
>
> I want to use a kickstart file to select packages in order to have an
> unattended install onto a bare-metal server.
I started (but have not finished) a live pen drive install. I've snipped out
some bits specific to this project, but you're welcome to crib off it.
#
# Filename: example.ks
#
# Version: 000
#
# Edit date: 2008-06-11
#
# Facility: example.com
#
# Abstract: This kickstart script creates the CD image.
#
# Environment: Unix, sh
#
# Author: Steven L. Edwards
#
# Modified by
#
# 000 2008-06-11 SLE Create.
lang en_US.UTF-8
keyboard us
network --bootproto=dhcp --device=eth0
network --bootproto=dhcp --device=eth1
rootpw example
firewall --enabled --port=22:tcp
authconfig --enablemd5 --enableshadow
selinux --disabled
timezone --utc America/Los_Angeles
# US english
# US keyboard
# use DHCP to set up networking
# set the password for root
# disable the firewall
# use MD5 and shadow passwords
# list the repositories
repo --name=base --baseurl=http://localhost/yum/base
repo --name=extras
--baseurl=http://ftp.telus.net/pub/centos/5/extras/$basearch
repo --name=live
--baseurl=http://www.nanotechnologies.qc.ca/propos/linux/centos-live/$basear
ch/live
repo --name=updates --baseurl=http://localhost/yum/updates
# repo --name=base
--baseurl=http://ftp.telus.net/pub/centos/5/os/$basearch
# repo --name=base
--baseurl=http://isoredirect.centos.org/centos/5/os/$basearch
# repo --name=extras
--baseurl=http://isoredirect.centos.org/centos/5/extras/$basearch
# repo --name=updates
--baseurl=http://ftp.telus.net/pub/centos/5/updates/$basearch
# repo --name=updates
--baseurl=http://isoredirect.centos.org/centos/5/updates/$basearch
# packages
%packages
authconfig
bash
chkconfig
comps-extras
kernel
passwd
policycoreutils
rootfiles
syslinux
xkeyboard-config
# more packages
dhcdbd
dhclient
dhcp
emacs-nox
lynx
mailx
memtest86+
ntp
openssh
openssh-clients
openssh-server
wget
%post
echo Post package customization in chroot
PATH=$PATH:/sbin/
# housekeeping
TIMESTAMP=$(date +"Created by example.ks on %F at %T")
# clean up install
rm --force /root/.cshrc
rm --force /root/.tcshrc
echo Configuring the timezone
(
printf "# %s\n\n" "$TIMESTAMP"
printf "\tARC=false\n"
printf "\tUTC=true\n"
printf "\tZONE=\"America/Los_Angeles\"\n"
printf "\n# (end of /etc/sysconfig/clock)\n"
) >/etc/sysconfig/clock
cp /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
chmod u=rw,g=r,o=r /etc/localtime
echo Configuring syslogging
(
printf "# %s\n\n" "$TIMESTAMP"
printf "# log everything to messages\n"
printf "\t*.*\t\t\t\t/var/log/messages\n"
printf "\n# (end of /etc/syslog.conf)\n"
) >/etc/syslog.conf
echo Configure networking
(
printf "# %s\n\n" "$TIMESTAMP"
# printf "\tDOMAIN=${DOMAINNAME}\n"
# printf "\tGATEWAY=${GATEWAY}\n"
printf "\tHOSTNAME=localhost.localdomain\n"
printf "\tNETWORKING=yes\n"
printf "\tNETWORKING_IPV6=no\n"
printf "\n# (end of /etc/sysconfig/network)\n"
) >/etc/sysconfig/network
echo Configure ntp
(
printf "# %s\n\n" "$TIMESTAMP"
printf "\t0.pool.ntp.org\n"
printf "\t1.pool.ntp.org\n"
printf "\t2.pool.ntp.org\n"
printf "\t3.pool.ntp.org\n"
printf "\n# (end of /etc/ntp/step-tickers)\n"
) >/etc/ntp/step-tickers
chkconfig --add ntpd
chkconfig --level 2345 ntpd on
echo Link for using emacs as edit
rm --force /usr/local/bin/edit
ln --symbolic /usr/bin/emacs-nox /usr/local/bin/edit
%post --nochroot
echo Post package customization not in chroot
PATH=$PATH:/sbin/
PROJECT_DIR=/home/sedwards/example.com/
cp ${PROJECT_DIR}/bashrc ${INSTALL_ROOT}/etc/
cp ${PROJECT_DIR}/emacs ${INSTALL_ROOT}/root/.emacs
cp ${PROJECT_DIR}/asterisk.tar.gz ${INSTALL_ROOT}/root/
%post
echo Post package customization in chroot
PATH=$PATH:/sbin/
tar\
--gzip\
--directory /\
--extract\
--file /root/asterisk.tar.gz\
${END_OF_LIST}
chkconfig --add asterisk
chkconfig --add zaptel
# this is where --shell kicks in -- at the end of the ks
# (end of example.ks)
Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list