How to create auto-setup script for CentOS 5?

Installing, Configuring, Troubleshooting server daemons such as Web and Mail
Post Reply
ionix
Posts: 8
Joined: 2006/11/10 12:36:15

How to create auto-setup script for CentOS 5?

Post by ionix » 2007/07/23 02:18:51

Hi

Will like to know how can I create a setup script that will install a "standard" bunch of packages on each fresh installation of CentOS 5?

User avatar
toracat
Site Admin
Posts: 7518
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: How to create auto-setup script for CentOS 5?

Post by toracat » 2007/07/23 05:17:21

Look at /etc/rc.d/rc.local

arrfab
Site Admin
Posts: 878
Joined: 2005/01/03 21:30:54
Location: /country/belgium
Contact:

How to create auto-setup script for CentOS 5?

Post by arrfab » 2007/07/23 05:43:57

If you want to automate the whole process (fresh centos setup + custom scripts/packages) then you'd have a look at kickstart : more informations here : http://www.centos.org/docs/5/html/Installation_Guide-en-US/pt-install-advanced-deployment.html
Read the Post-installation script (%post in the kickstart file)

c_henry
Posts: 6
Joined: 2007/08/07 13:15:55

Re: How to create auto-setup script for CentOS 5?

Post by c_henry » 2007/08/14 17:57:54

One of the easiest ways is to install CentOS onto the host to generate a valid ks.cfg file. In /root after it's been built you'll find a file called anaconda.cfg. This is an auto-generated kickstart file for your system. You can then use this as a base for installing using Kickstart. On one of my systems it looks like this:

# Kickstart file automatically generated by anaconda.

install
nfs --server=rhelnfs --dir=/local/apps/kickstart/Centos_5.0_x64
lang en_US.UTF-8
keyboard uk
xconfig --startxonboot
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$HhKjcxBy$/335g1/9e55uEkDoTDZPJ/
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone --utc Europe/London
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# 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 work
#clearpart --linux
#part /boot --fstype ext3 --size=100
#part swap --size=2048
#part pv.5 --size=100 --grow
#volgroup VolGroup00 --noformat --pesize=32768 pv.5
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=50432
#logvol /tmp --fstype ext3 --name=LogVol01 --vgname=VolGroup00 --size=9984

%packages
@ruby
@system-tools
@virtualization

Yours would look pretty much the same. To customise the build you would usually put a section called %post at the bottom and can install your own custom built RPMs from there or, more typically, run shell commands to set up users etc. Kickstart in conjunction with PXE is a powerful tool to deploying Linux automatically.

Was there something specific you wanted to do?

c_henry

Post Reply