الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

الفصل 16الاسم في الدورة: Installing Red Hat Enterprise Linux

Install RHEL by hand and with Kickstart

One server you install by hand with the Anaconda installer. Ten or a hundred servers you install with Kickstart: one text file that answers every question of the installer, so every system comes out the same. This chapter shows both, in package mode (the classic RHEL with DNF).

  • 6 الدروس
  • 14 الأوامر
  • 2 المعامل

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

المهارات في هذا الفصل

  • تثبيت RHEL يدويًا وباستخدام ملف Kickstart

16.1

Plan the installation

Decide the basics before you boot the installer. Then the installation is fast and the result fits its job.

QuestionTypical answer for a server
Installation imageThe DVD/full ISO (works offline) or the boot ISO (gets packages from the network)
Hardware2 CPUs, 2 GiB RAM or more, 20 GiB disk or more; UEFI firmware
SoftwareMinimal Install or Server (no desktop)
Disk layoutAutomatic LVM, or /boot + LVM with /, /var, /home, swap
NetworkFixed address and host name for servers
Accountsroot locked, one admin user in wheel with an SSH key
RegistrationActivation key, so updates work at once

16.2

Install interactively with Anaconda

Anaconda shows an Installation Summary hub. Every item with a warning sign must be done before Begin Installation works.

  1. Boot from the ISO and choose Install Red Hat Enterprise Linux 10.
  2. Choose the language.
  3. In the summary, set:
    • Installation Destination: the disk, and Automatic or Custom partitioning.
    • Network & Host Name: turn the card on, set the host name, and (with Configure…) a fixed address.
    • Software Selection: for example Minimal Install.
    • Time & Date: the time zone, NTP on.
    • Root Account: lock it, or set a strong password.
    • User Creation: an admin user, with Add administrative privileges (puts the user in wheel).
    • Connect to Red Hat: register with an account or an activation key.
  4. Click Begin Installation, wait, then Reboot System.

After the first boot, check the system:

hostnamectl
ip -br a
sudo dnf repolist
lsblk
ls -l /root/anaconda-ks.cfg

ملاحظة

Anaconda writes the answers of this installation into /root/anaconda-ks.cfg. It is the best start for your own Kickstart file.

16.3

Read a Kickstart file

A Kickstart file has commands (one per line), then sections that start with % and end with %end.

ks-web.cfg
# --- installation source and basics ---
text
lang en_US.UTF-8
keyboard --vckeymap=us
timezone Asia/Riyadh --utc
network --bootproto=static --device=enp1s0 --ip=192.168.122.30 --netmask=255.255.255.0 --gateway=192.168.122.1 --nameserver=192.168.122.1 --hostname=web1.example.com --activate
rhsm --organization=12345678 --activation-key=web-servers
 
# --- accounts ---
rootpw --lock
user --name=admin --groups=wheel --iscrypted --password=$6$rounds=4096$Xy1...$k3...
sshkey --username=admin "ssh-ed25519 AAAAC3Nza...k9 admin@laptop"
 
# --- disks ---
ignoredisk --only-use=vda
zerombr
clearpart --all --initlabel
autopart --type=lvm
 
# --- security and services ---
selinux --enforcing
firewall --enabled --service=ssh,http
services --enabled=chronyd,httpd
reboot
 
%packages
@^minimal-environment
httpd
vim-enhanced
-cockpit
%end
 
%post --log=/root/ks-post.log
echo "Installed by Kickstart on $(date +%F)" > /etc/motd
%end
PartWhat it does
textRun the installer in text mode (no graphics)
network …Address, host name; --activate uses it already during the installation
rhsmRegister with an activation key during the installation
rootpw --lock / user … / sshkey …Accounts and SSH keys
ignoredisk, zerombr, clearpart, autopartUse only vda, wipe it, make an automatic LVM layout
%packagesPackage groups (@^environment, @group), packages, -name to leave one out
%pre / %postShell scripts before / after the installation
rebootReboot at the end without asking

Make a password hash for --iscrypted:

openssl passwd -6
Password:
$6$Xy1...$k3...

انتبه

A Kickstart file with clearpart --all wipes the disk without asking. Use ignoredisk --only-use= so it never touches other disks.

16.4

Lay out the disks yourself

Instead of autopart, list every partition and logical volume with sizes.

ks-disk-part.cfg
zerombr
clearpart --all --initlabel --drives=vda
part /boot/efi --fstype=efi --size=600
part /boot     --fstype=xfs --size=1024
part pv.01     --size=1 --grow
volgroup rhel pv.01
logvol /     --vgname=rhel --name=root --fstype=xfs --size=10240
logvol /var  --vgname=rhel --name=var  --fstype=xfs --size=4096
logvol swap  --vgname=rhel --name=swap --size=2048

--grow makes the partition use all free space. Sizes are in MiB.

16.5

Check the file before you use it

ksvalidator (package pykickstart) finds syntax errors in seconds — much faster than a failed installation.

dnf install pykickstart
ksvalidator ks-web.cfg
ksvalidator -v RHEL10 ks-web.cfg
ksverdiff -f RHEL9 -t RHEL10

ksverdiff lists the Kickstart commands that changed between two versions.

في العمل

Red Hat also offers a Kickstart Generator web tool on the Customer Portal, and the Hybrid Cloud Console can build installation images with your settings inside.

الأوامر في هذا الدرس

16.6

Start an installation with Kickstart

Put the file on a web server (or the ISO, or a USB stick) and tell the installer where it is with the boot option inst.ks=.

dnf install httpd
cp ks-web.cfg /var/www/html/
restorecon -v /var/www/html/ks-web.cfg
systemctl enable --now httpd
firewall-cmd --add-service=http --permanent ; firewall-cmd --reload
curl -s http://192.168.122.1/ks-web.cfg | head -3

At the boot menu of the ISO, press e (UEFI) or Tab (BIOS) and add:

Boot option
inst.ks=http://192.168.122.1/ks-web.cfg

For a virtual machine, virt-install can do it all in one command:

virt-install --name web1 --memory 2048 --vcpus 2 --disk size=20 \
    --location /var/lib/libvirt/images/rhel-10.0-x86_64-dvd.iso \
    --os-variant rhel10.0 --network network=default \
    --initrd-inject /root/ks-web.cfg --extra-args "inst.ks=file:/ks-web.cfg console=ttyS0" \
    --graphics none
Source of the fileBoot option
Web serverinst.ks=http://server/path/ks.cfg
NFSinst.ks=nfs:server:/path/ks.cfg
Disk / USB with a labelinst.ks=hd:LABEL=KS:/ks.cfg
Injected into the initrdinst.ks=file:/ks.cfg

تدرّب

كل الأوامر في هذا الفصل