PDA

View Full Version : How I Automated a Fedora Install on a Home Network



donatom
27th September 2017, 06:35 AM
This is how I was able to create a custom kickstart file and use it for an automated fedora install on a home computer network:

It is important that both computers be connected to the internet via wired ethernet. Trying to use wifi will make the job a lot harder (it did for me anyway). And, of course, your computers must be connected to the same network.

(Note this requires a usb thumb drive, a computer onto which to install the OS, and another computer that you will use as a http server which will contain the ks.cfg file)

First, configure your Fedora system exactly as you would like it by adding all necessary or desired programs. Then save a copy of the anaconda-ks.cfg file to a working directory as ks.cfg (this file will contain encrypted passwords for users and root):


sudo cp /root/anaconda-ks.cfg /home/user-name/name-of-some-directory/ks.cfg

clearpart in the initial part of the file works best – but will wipe your hard drive. In any case, back up all partitions that you may need later. Be aware that this process is not designed for multiboot systems. It works best when you are able to wipe the whole drive.

Next run the following command to list all the programs you have installed on your configured system:


# rpm -qa --queryformat "%{NAME}\n"

Delete all programs on your ks.cfg file (programs listed between “%packages” and “%end” – make sure you don’t erase these two lines). Then copy all programs that were listed with the “rpm -qa . . . “ command above and paste them right after #packages (again make sure that “%end” is still present. Add any other programs you would like to install to this list. Make sure you have the appropirate urls and repos (like rpmfusion free and non-free) necessary for the installation of your programs.

Note: I gleaned the information listed above from:
https://forums.fedoraforum.org/showthread.php?t=209741

Download the Fedora server netinstall iso (go to www.fedoraproject.org and click on Fedora Server. Then click on install. In the new web-page look to the far right and click on 64-bit image right below “Netinstall Image”) then use “dd” to copy iso to your usb thumb drive.

On your other computer which will contain your newly created ks.cfg file install httpd to make it a httm server. Then issue the command “sudo systemctl start httpd” (or “sudo systemctl enable httpd” and then “systemctl start httpd” if you intend to continue to use this system as a sever even after installation) to start the server. Then copy your ks.cfg file to the /var/www/html directory. On both computers enable “http” in your firewall (or include permission in your iptables).

After making ks.cfg accessible in your http server, boot up your netinstall usb drive on you destination machine. Instead of clicking on “Install Fedora . . .”, click on the “tab” key. On the bottom of screen, at the end of the boot commands, add “inst.ks=http://192.168.1.33/ks.cfg” and then click the “enter” key.
You will, of course, have to enter the correct IP address for your http server (computer that is storing your ks.cfg file).

Here is a copy of my ks.cfg (your %package section will probably be much longer):


#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
#install using text
text
# Run the Setup Agent on first boot
firstboot --enable
# the disk onto which you are installing system
# Use command "sudo ls /dev/disk/by-id/" to get ww id for drive and use the following
# with the proper ww id your drive
ignoredisk --only-use=disk/by-id/wwn-0x50014ee20583fc8f
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
#url for fedora install
url --install --mirrorlist="https://mirrors.fedoraproject.org/mirrorlist?
repo=fedora-26&arch=x86_64"
# list of repos including rpm fusion free, non-free and updates for both of these and
# google chrome
repo --name="fedora" --install --baseurl=http://mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/releases/26/Everything/x86_64/os/
repo --name="fedora-updates" --install --baseurl=http://mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/updates/26/x86_64/
repo --name="rpmfusionfree" --install --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-26&arch=x86_64
repo --name="rpmfusionfreeupdates" --install --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-updates-released-26&arch=x86_64
repo --name="rpmfusion-nonfree" --install --mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-fedora-26&arch=x86_64
repo --name="RPMFusion Non-Free - Updates" --install --baseurl=http://download1.rpmfusion.org/nonfree/fedora/updates/25/x86_64/
repo --name="google-chrome" --install --baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
# Network information
network --bootproto=dhcp --device=link --activate
network --bootproto=dhcp --hostname=fedora
# Root password
rootpw --iscrypted $6$UnCeKtsD0HXUXUX$R88vIWzpXP8SSvHJPhu.nF1CWWFB7hz 8ICvxUQVK1H9h65AYRiWNRociGTXCN06bgzv4VbW0WO8T3x.Xy Zz/
# System timezone -- use your own zone
timezone America/Pacific
user --name=donatomi --password=$6$4FlJTvbIyopFfGgHhIi.$Vz5KSSvmuNRAqcVlM TK7llwjeOm0VcIOimAgdP8I7LHwrr9yck3uENSJ9HDK8IwB87S RSpfB/WA7XxJpBYiuS/ --iscrypted --gecos="donatomi"
# X Window System configuration information
xconfig --startxonboot
# System bootloader configuration for mbr system
bootloader --location=mbr
# Partition clearing information
clearpart --all
# Disk partitioning information
## make partitions of certian size
part / --fstype="ext4" --size=100000
part /home --fstype="ext4" --size 150000
part swap --name=swap --fstype=swap --recommended

%packages
@admin-tools
@anaconda-tools
@base-x
@core
@x11
@legacy-x
@fonts
@guest-desktop-agents
@hardware-support
@input-methods
@dial-up
@graphics
@libreoffice
@multimedia
@networkmanager-submodules
@printing
@standard
@xfce-apps
@xfce-desktop
@xfce-extra-plugins
@xfce-media
@xfce-office
NetworkManager-wifi.x86_64
NetworkManager.x86_64
aajohan-comfortaa-fonts
akmod-wl.x86_64
anaconda
chrony
dracut-live
ffmpeg.x86_64
firefox
gcc.x86_64
gedit.x86_64
generic-logos
generic-release
generic-release-notes
glibc-all-langpacks
gnome-keyring-pam
google-chrome-stable.x86_64
gparted
grub2-efi
k3b.x86_64
kernel
kernel-devel.x86_64
kernel-headers.x86_64
kernel-modules
kernel-modules-extra
lorax.x86_64
memtest86+
rfkill
sane-backends-drivers-scanners.x86_64
syslinux
system-config-printer
tar
vlc.x86_64
wget
xsane
xscreensaver-extras
ImageMagick.x86_64
lorax.x86_64
mock.noarch
-PackageKit*
-abiword
-acpid
-aspell-*
-autofs
-coolkey
desktop-backgrounds-basic
-fedora-logos
-fedora-release
-fedora-release-notes
-gimp-help
-hplip
-isdn4k-utils
-midori
-mpage
-numactl
-xfce4-sensors-plugin
-xsane-gimp

%end


I got most of my information from the following websites:

https://docs.fedoraproject.org/f26/install-guide/advanced/Kickstart_Installations.html
https://www.howtoforge.com/how-to-create-a-kickstart-file-for-centos-fedora-redhat-rhel
https://forums.fedoraforum.org/showthread.php?t=209741
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Installation_Guide/s1-kickstart2-packageselection.html

Hopefully this information is of some use to those who have a home network and who want to automate the installation of fedora. The above worked for me, however, you follow these instructions at your own risk.

lsatenstein
28th September 2017, 05:30 AM
Many Thanks
Will try something similar.