• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

CentOS4 re-image script for 1and1, and others

atomicturtle

Golden Pleskian
This is a call for testers for a CentOS installer specifically targetted at 1and1 systems.

http://3es.atomicrocketturtle.com/tests/1and1-installer.sh

This script will reimage a 1and1 server with CentOS4, replacing an existing FC2 or FC4 installation, and repartition the system with a more optimized layout. At this point in development the result will be a minimal install of CentOS4, and it does not install PSA at this time (you will need to use yum or the autoinstaller). I'm looking for general QA, and development eyeballs on the network config. Im missing something subtle on their DHCP setup, which does not configure the network settings correctly by default.

For those of you not running on a 1and1 box, that use lilo as a boot loader:
http://3es.atomicrocketturtle.com/tests/os-installer.sh

and for grub users:
http://3es.atomicrocketturtle.com/tests/grub-installer.sh

the above scripts will also reimage a system running rh7.3 - FC5, Debian, SuSE, Ubuntu, rhel3/4 to CentOS4
 
This works like a charm, I use something similiar like this... Kickstarting really blew me away with all it's possibilities...

I've got a remote server (with no access) that I manage to re-install with FC3/4/5, it loads my custom RAID drivers remotely.. it's really cool.

But, Art, add something like this to the end (note that I use this for Fedora installations, but you can modify it easily):

%post
wget http://mysite/yum-redah.conf
cp -f yum-redah.conf /etc/yum.conf
wget http://mysite/fedora-redah.repo
cp -f fedora-redah.repo /etc/yum.repos.d/fedora.repo
wget http://mysite/fedora-updates-redah.repo
cp -f fedora-updates-redah.repo /etc/yum.repos.d/fedora-updates.repo

/usr/bin/yum -y update

This fetches yum config files and repos, updates the system, and then does the reboot.

After my server gets back online, it's freshly installed and fully updated!

(Ofcourse you could create your own distribution share with all updates, but I figure this to be too much work to keep updated)
 
I've got creating ART repo rpms and installing PSA on the list as well. Basically I'd like to get the installer to the point where you can select what you want to create. A good example is where I used it to create a cluster at 1and1 for a very high volume website. I had 6 webserver nodes, and 2 load balancer nodes all built from the installer in quick fashion (around 10-15 minutes per box). In comparison, rekicking a box through the 1and1 CP in one case took several days.

The down side is I can't run an update event inside of %post on a 1and1 box because there is no network access. I can push things down into a firstboot event however, which is an option Ive been looking into.
 
Here's my ks.cfg, complete with partitioning, etc:

# install, duh
install

# fetch RPMs from here
url --url http://mysite/os/

# driverdisk with S-ATA drivers
driverdisk --source=http://mysite/drivers.img

# language default english
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard us

# set to VESA, prevent SIS lockup
xconfig --card "VESA driver (generic)" --videoram 7872 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16

# network settings
network --device eth0 --bootproto static --ip ***.***.***.*** --netmask ***.***.***.*** --gateway ***.***.***.*** --nameserver ***.***.***.***,***.***.***.*** --hostname ***.kyona.net

# security stuff
rootpw --iscrypted ******
selinux --enforcing
authconfig --enableshadow --enablemd5

# no firewall, install apf
firewall --disabled

# timezone, duh
timezone Europe/Amsterdam

# setting up the harddisks as brand-new
zerombr
bootloader --location=mbr --driveorder=sda,sdb
clearpart --all
part raid.7 --size=100 --ondisk=sda --asprimary
part raid.8 --size=100 --ondisk=sdb --asprimary
part raid.14 --size=10240 --ondisk=sdb
part raid.13 --size=10240 --ondisk=sda
part raid.11 --size=2048 --ondisk=sdb
part raid.10 --size=2048 --ondisk=sda
part raid.18 --size=1024 --ondisk=sdb
part raid.16 --size=1024 --ondisk=sda
part raid.27 --size=100 --grow --ondisk=sdb
part raid.24 --size=100 --grow --ondisk=sda
raid /boot --fstype ext3 --level=RAID1 raid.7 raid.8
raid swap --fstype swap --level=RAID1 raid.10 raid.11
raid / --fstype ext3 --level=RAID1 raid.13 raid.14
raid /tmp --fstype ext3 --level=RAID1 raid.16 raid.18
raid /home --fstype ext3 --level=RAID1 raid.24 raid.27

reboot

%packages --resolvedeps
e2fsprogs
grub
kernel-smp
mdadm

# update system before rebooting
# note to self: looks like install hangs, but it's just yum doing it's thing
%post
wget http://mysite/yum-redah.conf
cp -f yum-redah.conf /etc/yum.conf
wget http://mysite/fedora-redah.repo
cp -f fedora-redah.repo /etc/yum.repos.d/fedora.repo
wget http://mysite/fedora-updates-redah.repo
cp -f fedora-updates-redah.repo /etc/yum.repos.d/fedora-updates.repo

/usr/bin/yum -y update

As you can see I'm still someone from the 'put everything on different partitions, lock your /tmp down, etc'-generation. Any way, some tips:

Why don't you let your script fetch your ks.cfg, and put it in /boot as well? You can then kickstart your installation with:

title Atomic
root (hd0,0)
kernel /vmlinuz ks=hd:sda1:/ks-c4.cfg ip=$IPADDR netmask=$NETMASK gateway=$GATEWAY dns=$DNS
initrd /initrd.img

You'd have to know if /boot is on sda or hda but this can be easily figured out. Then you make a nice $HD for it and voila :) Since ks.cfg gets parsed right at the beginning it doesn't matter that it's on the HD that is being wiped anyway.

Any way, the reason for putting the ks.cfg local is that you can make your script edit the local ks.cfg file and add the network settings, as you can see in the sample above. Then your box will have network access right out of installation (but seriously, shouldn't it have network connection as soon as you give it along as parameters during your kickstart?) and you can run YUM or anything you want, e.g. fetching PSA and installing it (although I'm not sure if that will work since during installation your kind of limited in what you're allowed to do).

Also, I always add the word 'vnc' to my kickstart line. As soon as graphical installation starts, you'll have a VNC window available at yournewserver.domain.com:1. It's always nice to be able to see what's going on ;) The only thing I wasn't able to figure out is to make whatever Yum does in the background print to the VNc window. This bugs me because I don't know what it's doing now, it just says "installing bootloader" while it's actually updating with Yum.

The reason I had to do all this was because I have servers at Server4You in Germany. They use new SIS chipsets that FC4 can't handle when using a kernel < 2.6.14. They also use a lame FC3 image that's both outdated and packed with unneccessary stuff (I always install 'minimal', and even then rip plenty of RPMs out (ISDN, PCMCIA, bluetooth, you get the point). I think they simply chose a 'Server install' or something.

So, I created a driverdisk with drivers, and FC4 installed fine, but when it rebooted it wouldn't reboot, because the 2.6.11 kernel simply couldn't do it. Now, I start the installation, it fetches the drivers remotely, installs, then runs yum, which updates the kernel to 2.6.16, and the machine boots as happily as it could be :)
 
Yep, I store the ks.cfg locally in the 1and1 installer. Unfortunately/Fortunately the 1and1 network wouldn't let me do a pure network install (just try it, you'll see what I mean), so I ended up having to store the ISO locally and install everything offline. There are some added advantage to the local ISO route, as you noted with the additional driver issues on your system, you can store modules, or psa configs, that dont get overwritten when you repartition the drive (I hijack swap), and pass those right into anaconda. I may merge the 1and1/(os|grub)-installer's together in the future to allow you to choose which path to take.

Another advantage of the network stored ks that I couldnt use because of 1and1 is that it has the ability to pass in variables to a cgi, which would allow you to control an installation from a web page. My pipe dream there was to set up a page where you could pick things like OS, PSA version, etc and then submit a custom ks for that box.

I'm glad you found it useful, my whole intent with this was to empower folks to set up the box the way you want it. This is exactly the kind of thing I was hoping people would do with it
 
Originally posted by atomicturtle
My pipe dream there was to set up a page where you could pick things like OS, PSA version, etc and then submit a custom ks for that box.

I was actually thinking of doing the exact same thing :)

I've been using kickstart installs for a long time (sorry, I wasn't inspired by your script, just thought it was weird you couldn't do a network install ;) I tried to learn something to the allmighty ART and failed ;)), and I was also planning on creating some sort of ServerInstaller, able to install stuff like FC or Cent...

Might need to start thinking about that more before it shows up in an ART project and I can't get my 15 minutes of fame ;)
 
Back
Top