RHEL: Difference between revisions

From DikapediaV2
Jump to: navigation, search
(Created page with "==== Red Hat Enterprise Linux ==== ---- Releases:</br> https://access.redhat.com/articles/3078 Where to download old RHEL ISOs:</br> 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...")
 
 
(One intermediate revision by the same user not shown)
Line 333: Line 333:




====How to install Graphical User Interface====
====How to install Graphical User Interface (GUI)====
----
----
https://access.redhat.com/solutions/5238
https://access.redhat.com/solutions/5238
Line 349: Line 349:
And then rebooted the system:
And then rebooted the system:
  # reboot
  # reboot


====RHEL Subscription====
====RHEL Subscription====

Latest revision as of 15:07, 21 November 2024

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 / -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:

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

  1. allow ftp service in firewall (I needed this on rhel8)

firewall-cmd --permanent --zone=public --add-service=ftp firewall-cmd --reload

  1. 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

Helpful link: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/system_design_guide/kickstart-commands-and-options-reference_system-design-guide

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

  1. allow ftp service in firewall (I needed this on rhel8)

firewall-cmd --permanent --zone=public --add-service=ftp firewall-cmd --reload


  1. 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.


How to create a modified Red Hat Enterprise Linux ISO with kickstart file or modified installation media


https://access.redhat.com/solutions/60959


How to install Graphical User Interface (GUI)


https://access.redhat.com/solutions/5238


Install Gnome on RHEL8.8 Server

Run:

$ sudo yum group install GNOME base-x Fonts

After installing the appropriate packages, change the default systemd boot target to graphical.target. If you run into any errors, try updating the system first with 'yum update'.

# systemctl set-default graphical.target
Removed /etc/systemd/system/default.target.
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.

And then rebooted the system:

# reboot

RHEL Subscription


How to (unregister and) re-register a System

2. Launch a terminal 3. View current lifecycle -

# dzdo subscription-manager identity 
        

4. Remove subscription and unregister

# dzdo subscription-manager remove --all
# dzdo subscription-manager unregister
# dzdo subscription-manager clean


5. Register to lifecycle (either PROD or QA matching output of #3)

# dzdo subscription-manager register --force --org="<organization>" --activationkey="<keyname>"


How to RDP into your RHEL Linux machine


This was tested on RHEL8.8

# yum install -y tigervnc-server xrdp
# systemctl start xrdp
# systemctl enable xrdp
# firewall-cmd --permanent --add-port=3389/tcp
# firewall-cmd --reload

And then Open up RDP on your client end and connect to it.


Google Chrome on RHEL8


/etc/opt/chrome/policies/managed/chrome.json


To enable/disable Developer Tools in Chrome, modify this line to true (disabled) or false (enabled):

"DeveloperToolsDisabled": false,

Shortcut:

sudo sed -i '/DeveloperToolsDisabled/ s/true/false/g' /etc/opt/chrome/policies/managed/chrome.json


Configure Secondary Interface on RHEL8 Workstation


In this scenario, we used a TPLink router for us to test as a separate subnet (192.x.x.x) on the secondary interface while the primary interface was connected to a different subnet.

This is how we set it up: 1. Connected the TPLink ethernet (USB) to the computer 2. Ran ip addr show. Can see the new interface is enp0s20f0u3 with MAC address: 00:24:9b:80:cb:8f 3. Then created the network configuration file:

dzdo cp /etc/sysconfig/network-scripts/ifcfg-enp0s31f6 /etc/sysconfig/network-scripts/ifcfg-enp0s20f0u3
dzdo chmod 644 /etc/sysconfig/network-scripts/ifcfg-enp0s20f0u3
dzdo vi /etc/sysconfig/network-scripts/ifcfg-enp0s20f0u3
TYPE=Ethernet
DEVICE=enp0s20f0u3
NAME=enp0s20f0u3
ONBOOT=yes
BOOTPROTO=dhcp
DHCP_HOSTNAME=cacirh-st (likely not necessary)
PROXY_METHOD=none  (likely not necessary)
BROWSER_ONLY=no  (likely not necessary)
DEFROUTE=no 
IPV4_FAILURE_FATAL=no 
NAME="System enp0s20f0u3"
MAC=00:24:9b:80:cb:8f (Ensure the MAC address matches with the output in ip a)
USERCTL=no
NM_CONTROLLED=yes
dzdo systemctl restart NetworkManager
dzdo nmcli connection up enp0s20f0u3 

(I can't remember if this ran successfully or not, but I ran reload in the next command and that worked

dzdo nmcli connection reload

4. Confirm it has IP address now by running: ip addr show 5. Confirmed we could ping the TPLink router: ping 192.16.0.1 6. Also confirmed we could reach the gateway via browser. 7. Confirmed we could reach a website via the primary interface (10.x.x.x): ping somewebsite.com 8. We checked the route table and confirmed the route for the secondary interface was there and it looked good:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.228.200.1    0.0.0.0         UG    100    0        0 enp0s31f6
10.118.200.0    0.0.0.0         255.255.248.0   U     100    0        0 enp0s31f6
192.168.0.0    0.0.0.0         255.255.X.0   U     100    0        0 enp0s20f0u3


References:


How to Configure 802.1Q VLAN Tagging in RHEL 8


How we did Vlan tagging with static IP when testing with Andrew's Hyper-V Vlan set up:

[+] The main interface (ifcfg-enp0s31f6)

# Generated by parse-kickstart
TYPE=Ethernet
DEVICE=enp0s31f6
UUID=92567071-7d48-44d5-b189-b9a2792c094f
ONBOOT=yes
#BOOTPROTO=dhcp
BOOTPROTO=none
#DHCP_HOSTNAME=cacirh-st
IPV6INIT=yes
IPV6_AUTOCONF=yes
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME="System enp0s31f6"


[+] The VLAN <ID> interface (ifcfg-enp0s31f6.<id>)

DEVICE=enp0s31f6.<id>
BOOTPROTO=none
ONBOOT=yes
NETWORK=192.168.x.0
IPADDR=192.168.x.254
PREFIX=24
VLAN=yes

[+] For DHCP on the VLAN <ID> interface:

DEVICE=enp0s31f6.<id>
BOOTPROTO=dhcp
ONBOOT=yes
VLAN=yes


There is also a way to do VLAN tagging using nmcli, see: https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_and_managing_networking/configuring-vlan-tagging_configuring-and-managing-networking#configuring-vlan-tagging-by-using-nmcli_configuring-vlan-tagging