There is so much documentation online from RedHat and CentOS about this topic - it's sad that I am writing this. But the real state of documentation on this topic (CentOS 7 + KS + ISO = Bootable DVD) is almost non-existent.
I found this: http://smorgasbork.com/component/content/article/35-linux/151-building-a-custom-centos-7-kickstart-disc-part-1
Which I greatly appreciate and +1, but the documentation is half-baked and there are numerous errors.
Finally... FINALLY! After four days of banging my head, I got this to work. Hopefully someone else will be able to do this in a few hours, instead of blowing their weekend like me. :(
GOAL
- CentOS 7 Minimal Installation + Kickstart + ISO = DVD or USB for easy installs.
What you need
- 2 Hours (If you're a Ninja)
- CentOS 7 VM (Minimal install for Minimal ISO, Everything for Everything ISO, etc.)
- The ability to slowly breathe in and out / fine malted beverage.
Notes
- These instructions are for CentOS7 x86_64 Minimal
[root@localhost /]# cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)
- Please execute all these instructions as root.
===========
START
- Download the CentOS 7 x86_64 Minimal ISO: http://goo.gl/Dj2vAo
- Use VirtualBox (or VMware Fusion or whatever you like) to install the OS to disc. Rec 20GB Disk & 2048MB RAM.
- After installation completes:
yum -y update && yum -y upgrade
yum -y install wget nano tree
shutdown -r now
- Re-attach the ISO in VirtualBox/VMware Fusion, then:
mkdir /mnt/dvd;mount -o loop /dev/sr0 /mnt/dvd
- Make the following directories:
mkdir -p ~/kickstart_build/isolinux
+-- isolinux
| +-- images
| +-- ks
| +-- LiveOS
| +-- Packages
+-- utils
- Copy all the files from the isolinux directory on CentOS DVD into your ~/kickstart_build/isolinux directory.
- Copy .discinfo from the CentOS DVD into your ~/kickstart_build/isolinux directory
- Recursively copy the contents of the images directory on the CentOS DVD into your ~/kickstart_build/isolinux/images directory.
- Copy the contents of the LiveOS directory on the CentOS DVD into your ~/kickstart_build/isolinux/LiveOS directory.
- Get the comps.xml file from repodata. This file is named with a unique hex string for each release. In CentOS 7.0.1406, for example, it is called 4b9ac2454536a901fecbc1a5ad080b0efd74680c6e1f4b28fb2c7ff419872418-c7-x86_64-comps.xml.gz. Copy it to ~/kickstart_build/comps.xml.gz and gunzip it so that you have ~/kickstart_build/comps.xml.
^^^ That means change the name to "comps.xml". Don't leave the long string in front of it.
Your kickstart config file will go into ~/kickstart_build/isolinux/ks. I like to have a separate directory for this, because I build a series of different config files for different machines or classes of machines.
Start from a sample configuration file
It is always best to start with a sample configuration file. CentOS makes it easy for you to get your hands on one. Just perform a standard installation on a machine. After the install, look in look in /root/anaconda-ks.cfg to get a sample kickstart configuration file.
Copy this file into ~/kickstart_build/isolinux/ks/ks.cfg.
If you want your kickstart to run completely unattended, you will need to make sure that the installer clears any existing partitions on the system before installing. Change this line:
clearpart --none --initlabel
to
clearpart --drives=sda --all --initlabel
Of course, if you're not installing to sda, you may need to modify this line.
Do not use the --all option if you plan on running your kickstart to install to a multiboot system; you will blow away all your operating systems. Then again, I don't know that kickstart makes much sense in such a scenario. You're much safer installing manually.
Note: it seems that in CentOS 7, anaconda writes a line into this file that is not valid according to the kickstart installer. This line:
network --hostname=localhost.localdomain
should be:
network --device=lo --hostname=localhost.localdomain
Note that the drive configuration here reflects the configuration of your build machine. If that is different from your target machine (for example, your build machine might use IDE drives, and your target might use SCSI, or you may want to use software RAID on the target machine), you'll have to edit some of these lines. When you're getting started, it's easiest if you use a build machine configured identically to your target machine.
Copy the RPMs
You will need access to all the RPMs that you might possibly include in your kickstart (along with all their dependencies). These will be located on your install media in the Packages directory.
I'm new to iso. I'm wondering is there a way that: