Course Content
Overview
Are you tired of repetitive tasks and manual configurations in your Linux administration work? Do you wish to streamline your workflow and boost productivity? Look no further! In this comprehensive online course, we dive into the world of Python automation specifically tailored for Linux admins. From the very basics of writing a "Hello World" program in Python to advanced file manipulation and directory operations, this course equips you with the skills and knowledge needed to automate your daily administrative tasks efficiently. With hands-on exercises, practical examples, and step-by-step guidance, you'll learn how to harness the power of Python to simplify complex processes, save time, and elevate your effectiveness as a Linux admin. Join us now and embark on a journey towards becoming a proficient Python automation expert for Linux administration!
0/3
Python Automation for Linux admins
About Lesson

Step 1: Update the System

 dnf update -y

Step 2: Check for Python Preinstalled

RHEL 9 usually comes with Python 3 pre-installed. Check the current version:

python3 –version
Step 3: Install Python (If Not Already Installed)
RHEL 9 provides Python 3 through its default package manager.

dnf install python3 -y
Step 4: Verify Python Installation
Check the installed version to confirm:

python3 –version
Step 5: Install Development Tools (Optional but Recommended)
Development tools are required for building Python packages with native dependencies.

dnf groupinstall “Development Tools” -y
 dnf install gcc python3-devel -y
Step 6: Set Python3 as Default (Optional)
If python3 does not default to python, set it up manually:

Check current alternatives:

alternatives –config python
If no alternatives are configured, set one:

alternatives –install /usr/bin/python python /usr/bin/python3 1
 alternatives –set python /usr/bin/python3
Step 7: Install pip (Python Package Manager)

 dnf install python3-pip -y
Verify the installation:

pip3 –version
Step 8: Install Virtual Environment (Optional but Recommended)

dnf install python3-virtualenv -y
Create a virtual environment:

python3 -m venv myenv
source myenv/bin/activate
Step 9: Test Installation
Create a simple Python script to ensure Python is working:

vi test.py
Add the following code:

print(“Python installation successful on RHEL 9!”)
Run the script:

python3 test.py