Mastering Red Hat Enterprise Linux Essentials | Generated by AI
Introduction to Red Hat Linux
Red Hat Enterprise Linux (RHEL) is a leading open-source operating system developed by Red Hat, Inc. It is designed for enterprise environments, offering stability, security, and robust support for mission-critical applications. RHEL is widely used in servers, cloud environments, and enterprise IT infrastructure.
History
- 1994: Red Hat Linux was first released as a commercial Linux distribution.
- 2002: Red Hat introduced Red Hat Enterprise Linux, focusing on enterprise-grade reliability.
- 2025: RHEL 9 is the latest major release, with RHEL 10 in development, offering advanced features like enhanced security and container support.
Key Features
- Stability: RHEL prioritizes long-term support (LTS) with a 10-year lifecycle per major release.
- Security: Features like SELinux (Security-Enhanced Linux), firewalld, and regular security patches.
- Performance: Optimized for high-performance computing, virtualization, and cloud deployments.
- Subscription Model: Provides access to updates, support, and certified software through Red Hat subscriptions.
- Ecosystem: Integrates with Red Hat OpenShift, Ansible, and other tools for DevOps and automation.
Installation
System Requirements
- Minimum:
- 1.5 GB RAM
- 20 GB disk space
- 1 GHz processor
- Recommended:
- 4 GB RAM or more
- 40 GB+ disk space
- Multi-core processor
Installation Steps
- Download RHEL:
- Obtain the RHEL ISO from the Red Hat Customer Portal (requires a subscription or developer account).
- Alternatively, use a free developer subscription for non-production use.
- Create Bootable Media:
- Use tools like
dd
or Rufus to create a bootable USB drive. - Example command:
sudo dd if=rhel-9.3-x86_64.iso of=/dev/sdX bs=4M status=progress
- Use tools like
- Boot and Install:
- Boot from the USB or DVD.
- Follow the Anaconda installer:
- Select language and region.
- Configure disk partitioning (manual or automatic).
- Set up network settings.
- Create a root password and user accounts.
- Register System:
- Post-installation, register with Red Hat Subscription Manager:
subscription-manager register --username <username> --password <password>
. - Attach a subscription:
subscription-manager attach --auto
.
- Post-installation, register with Red Hat Subscription Manager:
System Administration
Package Management
RHEL uses DNF (Dandified YUM) for package management.
- Install a package:
sudo dnf install <package-name>
- Update system:
sudo dnf update
- Search for packages:
sudo dnf search <keyword>
- Enable repositories:
sudo subscription-manager repos --enable <repo-id>
User Management
- Add a user:
sudo useradd -m <username>
- Set password:
sudo passwd <username>
- Modify user:
sudo usermod -aG <group> <username>
- Delete user:
sudo userdel -r <username>
File System Management
- Check disk usage:
df -h
- List mounted file systems:
lsblk
- Manage partitions: Use
fdisk
orparted
for disk partitioning. - Configure LVM (Logical Volume Manager):
- Create physical volume:
pvcreate /dev/sdX
- Create volume group:
vgcreate <vg-name> /dev/sdX
- Create logical volume:
lvcreate -L <size> -n <lv-name> <vg-name>
- Create physical volume:
Networking
- Configure network with
nmcli
:- List connections:
nmcli connection show
- Add a static IP:
nmcli con mod <connection-name> ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.method manual
- Activate connection:
nmcli con up <connection-name>
- List connections:
- Manage firewall with
firewalld
:- Open a port:
sudo firewall-cmd --add-port=80/tcp --permanent
- Reload firewall:
sudo firewall-cmd --reload
- Open a port:
Security
- SELinux:
- Check status:
sestatus
- Set mode (enforcing/permissive):
sudo setenforce 0
(permissive) orsudo setenforce 1
(enforcing) - Modify policies: Use
semanage
andaudit2allow
for custom policies.
- Check status:
- Updates:
- Apply security patches:
sudo dnf update --security
- Apply security patches:
- SSH:
- Secure SSH: Edit
/etc/ssh/sshd_config
to disable root login (PermitRootLogin no
) and change default port. - Restart SSH:
sudo systemctl restart sshd
- Secure SSH: Edit
Advanced Features
Containers and Virtualization
- Podman: RHEL’s rootless container tool.
- Run a container:
podman run -it docker.io/library/centos bash
- Build an image:
podman build -t <image-name> .
- Run a container:
- Virtualization: Use
libvirt
andvirt-manager
for managing VMs.- Install:
sudo dnf install libvirt virt-manager
- Start libvirt:
sudo systemctl start libvirtd
- Install:
Automation with Ansible
- Install Ansible:
sudo dnf install ansible
- Create a playbook:
```yaml
- name: Install Apache
hosts: all
tasks:
- name: Install httpd dnf: name: httpd state: present ```
- name: Install Apache
hosts: all
tasks:
- Run playbook:
ansible-playbook playbook.yml
Cloud Integration
- RHEL integrates with AWS, Azure, and Google Cloud.
- Use Red Hat OpenShift for container orchestration.
- Deploy RHEL images in cloud environments via Red Hat Cloud Access.
Troubleshooting
- Logs: Check
/var/log
for system logs (e.g.,/var/log/messages
or/var/log/secure
). - Systemd: Manage services with
systemctl
:- Check service status:
systemctl status <service>
- Restart service:
systemctl restart <service>
- Check service status:
- Performance: Use
top
,htop
, orvmstat
to monitor system performance. - Network Issues: Use
ping
,traceroute
, ornslookup
for diagnostics.
Best Practices
- Regularly update the system to patch vulnerabilities.
- Use strong passwords and enforce SELinux policies.
- Back up critical data with tools like
rsync
or Red Hat’srear
. - Monitor system health with tools like Cockpit (
sudo dnf install cockpit
).
Resources
- Red Hat Customer Portal
- RHEL Documentation
- Red Hat Developer Program
- Community forums like Red Hat Discuss