RHEL
Contents
- 1 Red Hat Enterprise Linux
- 2 How to install packages on RHEL5.11 using DVD ISO
- 3 How to install gcc on RHEL6 using DVD ISO
- 4 How to install gcc on RHEL7.9 using DVD ISO
- 5 How to install packages on RHEL8 using ISO DVD
- 6 How to install python2.7 on RHEL5.5
- 7 Kickstart
- 8 How to create a modified Red Hat Enterprise Linux ISO with kickstart file or modified installation media
Red Hat Enterprise Linux
Releases:
https://access.redhat.com/articles/3078
Where to download old RHEL ISOs:
https://access.redhat.com/downloads/content/69/ver=/rhel---5/5.11/x86_64/product-software
How to install packages on RHEL5.11 using DVD ISO
- Note: there is no lsblk command in RHEL5. But you can run things like: ls -al /dev/disk/by-path;
Make sure the ISO is attached to the VM.
Tested on RHEL5.11:
mkdir /mnt/rhel5dvd mount /dev/sr0 /mnt/rhel5dvd # ensure the DVD Iso is connected to the VM vi /etc/yum.repos.d/dvd.repo [dvd-Server] mediaid=1409145026.642170 name=RHEL 5 Server DVD baseurl=file:///mnt/rhel5dvd/Server gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1
yum -y install kernel-devel
How to install gcc on RHEL6 using DVD ISO
Make sure the ISO is attached to the VM.
Tested on RHEL6.9:
mkdir /mnt/rhel6dvd mount /dev/sr0 /mnt/rhel6dvd # ensure the DVD Iso is connected to the VM vi /etc/yum.repos.d/dvd.repo [dvd-Server] mediaid=1409145026.642170 name=RHEL 6 Server DVD baseurl=file:///mnt/rhel6dvd/Server gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1 yum -y install gcc
How to install gcc on RHEL7.9 using DVD ISO
Tested on RHEL7.9:
- The baseurl is file:///mnt/rhel7dvd/ because the repodata directory is in /mnt/rhel7dvd/repodata
mkdir /mnt/rhel7dvd # ensure the DVD Iso is connected to the VM. Sometimes it will be attached as /dev/sr0 or sr1 mount /dev/sr0 /mnt/rhel7dvd mount /dev/sr1 /mnt/rhel7dvd vi /etc/yum.repos.d/dvd.repo [dvd-Server] mediaid=1409145026.642170 name=RHEL 7 Server DVD baseurl=file:///mnt/rhel7dvd/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1 yum -y install gcc wget
OR
sr1 mounted on /run/media/ardikass/RHEL-7.9 Server.x86_64
vi /etc/yum.repos.d/dvd.repo [dvd-Server] mediaid=1409145026.642170 name=RHEL 7 Server DVD baseurl=file:///run/media/ardikass/RHEL-7.9\ Server.x86_64/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1 yum -y install gcc wget
How to install packages on RHEL8 using ISO DVD
(for SLES15, its similar steps above except its more like:
vi /etc/zypp/repos.d/dvd.repo [dvd-Server] name=<some name> autorefresh=0 baseurl=file:///mnt/Module-Basesystem/x86_64/ type=plaindir enabled=1 gpgcheck=1
How to install python2.7 on RHEL5.5
Download the python package from Python website directly
wget https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tgz
- If you can't wget/curl it from RHEL5/Centos5 due to TLSv1 issues. Copy it from another VM (i.e. RHEL7) like so:
# Copy files from remote host directory to local machine: scp root@192.168.122.200:/home/ardikass/Python-2.7.16.tgz ~/
Then compile it:
# tar xvzf Python-2.7.16.tgz # cd Python-* # ./configure --prefix=/opt/python2.7 --enable-shared # make install # ls -al /opt/python2.7 # export PATH=$PATH:/opt/python2.7/bin/ # python2.7 -V
If you get the following error:"python2.7: error while loading shared libraries: libpython2.7.so.1.0 cannot open shared object file: No such file or directory", then follow the proceeding commands:
# python2.7 -V python2.7: error while loading shared libraries: libpython2.7.so.1.0 cannot open shared object file: No such file or directory
- find libpython2.7.so.1.0 based on this: https://gist.github.com/dalegaspi/dec44117fa5e7597a559?permalink_comment_id=3887193#gistcomment-3887193
# find / -name "libpython2.7.so.1.0" /opt/python2.7/lib/libpython2.7.so.1.0 # echo "/opt/python2.7/lib" >> /etc/ld.so.conf # ldconfig
Now it should work, and continue:
# python2.7 -V Python 2.7.16
(optional)
# alias python=python2.7
python -V Python 2.7.16
Kickstart
HELPFUL LINKS:
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-howto
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax#sect-kickstart-commands
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-examples
NOTE: DO NOT USE NOTEPAD++ OR VISUAL STUDIO CODE OR OTHER TEXT EDITORS WHEN EDITING A KICKSTART CONFIGURATION FILE!!!! ONLY USE VIM!!!!!
Anaconda-ks.cfg
Whenever you build out a RHEL server, there is a kickstart configuration file that automatically gets created. It is located in /root/anaconda-ks.cfg. You can use this kickstart configuration file to create other servers or you can use this as a basis template and make changes to it when building out other servers.
How to in RHEL7
1) Boot up RHEL7.9 ISO on UEFI in vcenter, install with GUI option. 2) Follow these steps to mount the dvd so we can install stuff: https://dikapedia.com/wiki/RHEL 3) ensure the DVD Iso is connected to the VM and install:
lsblk should show: sr1 mounted on /run/media/ardikass/RHEL-7.9 Server.x86_64
vi /etc/yum.repos.d/dvd.repo [dvd-Server] mediaid=1409145026.642170 name=RHEL 7 Server DVD baseurl=file:///run/media/ardikass/RHEL-7.9\ Server.x86_64/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1
yum -y install gcc system-config-kickstart vsftpd
4) Ensure the VM can reach other VMs on the network. If not able to ping another VM, check the route:
# ip route
If you see duplicate entries for the same route on two different interfaces, remove it (virb0):
RHEL7: # route -del -net 192.168.122.0 gw 0.0.0.0 netmask 255.255.255.0 dev virbr0
RHEL8: # route del -net 192.168.122.0 gw 0.0.0.0 netmask 255.255.255.0 dev virbr0
5) Add ftp to firewall: firewall-cmd --permanent --zone=public --add-service=ftp firewall-cmd --reload
- allow ftp service in firewall (I needed this on rhel8)
firewall-cmd --permanent --zone=public --add-service=ftp firewall-cmd --reload
- disable selinux, because it was also causing ftp (550) issues
vi /etc/selinux/config enforcing=disabled
4) Run the kickstart configuration app:
$ system-config-kickstart
5) Try to configure the kickstart based on customer's kickstart configuration.
6) Save the file as ks.cfg, and then move it to ftp server:
cp ks.cfg /var/ftp/pub/ks.cfg
systemctl start vsftpd
systemctl enable vsftpd
7) Launched a 'client' vm using same ISO:
- ensure storage size is large enough based on the kickstart configuration or else you would get "Failed to save storage configuration" into "No disks selected" . (20GB works) - Ensure you select BIOS (custom disk configuration saved successfully when it was set to BIOS) as boot option. - it seems on a fresh EFI VM, custom disk configuration saved successfully.
I found that on the BIOS system, the disk label is 'dos', and /boot/efi was on sda3, which is showing FAT16. HOWEVER, my boot * is on /boot, and not /boot/efi... hmmm.. SO BIOS is what you want to use to get the 'dos' disk label type.
I found that on the EFI system, the disk label is 'gpt', and /boot/efi was on sda1, which is showing EFI system.
Press 'tab' (if you booted the VM with BIOS) or 'e' (if you booted the VM with EFI) on the first install option. And then add this at the end of the kernel parameter line:
ks=ftp://192.168.122.200/pub/ks.cfg
How to in RHEL8
https://www.golinuxcloud.com/rhel-centos-8-kickstart-example-generator/
1) Boot up RHEL8 ISO on UEFI in vcenter, install with GUI option. 2) Follow these steps to mount the dvd so we can install stuff: https://dikapedia.com/wiki/RHEL 3) ensure the DVD Iso is connected to the VM and install:
lsblk should show: sr1 mounted on /run/media/ardikass/<rhel8 ISO dir>
vi /etc/yum.repos.d/dvd.repo [dvd-Server] mediaid=1409145026.642170 name=RHEL 7 Server DVD baseurl=file:///run/media/ardikass<rhel8 ISO dir> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=1 gpgcheck=1
sudo dnf -y install gcc pykickstart vsftpd
- allow ftp service in firewall (I needed this on rhel8)
firewall-cmd --permanent --zone=public --add-service=ftp firewall-cmd --reload
- disable selinux, because it was also causing ftp (550) issues
vi /etc/selinux/config enforcing=disabled
4) Ensure the VM can reach other VMs on the network. If not able to ping another VM, check the route:
# ip route
If you see duplicate entries for the same route on two different interfaces, remove it (virb0):
RHEL7: # route -del -net 192.168.122.0 gw 0.0.0.0 netmask 255.255.255.0 dev virbr0
RHEL8: # route del -net 192.168.122.0 gw 0.0.0.0 netmask 255.255.255.0 dev virbr0
4) (Not necessary) Run the kickstart configuration app
$ system-config-kickstart
5) Try to configure the kickstart based on customer's kickstart configuration.
I had to download it from my rhel7 server using sftp.
# sftp root@192.168.122.200 sftp> get /var/ftp/pub/ks.cfg
6) Save the file as ks.cfg, and make edits and then move it to ftp server:
cp ks.cfg /var/ftp/pub/ks.cfg
# replace the clearpart line with: clearpart --all --disklabel=msdos --drives=$ROOTDRIVE
systemctl start vsftpd
systemctl enable vsftpd
7) For some reason, when I try to fetch the file via FTP from RHEL8 VM, I get access denied 530 :(
To fix this: # vi /etc/vsftpd/vsftpd.conf anonymous_enable=YES
# systemctl restart vsftpd
How to fetch Kickstart configuration file upon ISO boot up
When you reach the grub menu, press E to edit the grub configuration.
Then at the end of the kernel parameter line, enter:
inst.ks=https://<url where you ks is>/kickstart.cfg
Then press ctrl+x to start it.