Day 7 of 90 Days of DevOps Challenge: web servers and package managers

Vaishnavi DVaishnavi D
6 min read

What is a website

A website is a collection of interlinked web pages that are accessible through the internet using a domain name. It can display information, images, videos, and other content to users via a web browser. Websites are typically static or informational in nature.

Type of website

Static Website

A static website is made up of fixed web pages with content that doesn't change unless a developer manually edits the code. Each page is coded using HTML and CSS and is delivered to the user's browser exactly as stored on the server.

  • Fixed content. doesn’t change unless manually updated.

  • Built with HTML, CSS.

  • No interaction with databases.

  • Tech Used: HTML, CSS

  • Example: Portfolio sites, brochure websites

Dynamic Website

A dynamic website generates web pages on the fly based on user interaction or data from a database. These sites use server-side scripting languages to process requests and show updated content dynamically.

  • Content changes based on user interaction or backend data.

  • Uses databases and server-side scripting.

  • Tech Used: PHP, Python (Django), JavaScript (React, Node.js)

  • Example: Social media platforms, e-commerce sites, blogs

Package Managers in Linux

In Linux, package managers are essential tools used to install, update, configure, and remove software packages. They make managing applications and dependencies much easier and more efficient. package managers are vital for system administration and DevOps workflows.

These tools handle:

  • Software installation

  • Dependency resolution

  • System updates

Here are some popular package managers:

APT (Advanced Package Tool) – Debian/Ubuntu-based systems

sudo apt update        # Updates package list  
sudo apt install nginx # Installs a package  
sudo apt remove nginx  # Removes a package

YUM (Yellowdog Updater Modified) – RHEL/CentOS (older versions)

sudo yum install httpd    # Installs a package  
sudo yum remove httpd     # Removes a package  
sudo yum update           # Updates all packages

DNF (Dandified YUM) – RHEL/CentOS/Fedora (modern versions)

sudo dnf install git      # Installs a package  
sudo dnf remove git       # Removes a package  
sudo dnf update           # Updates all packages

Pacman – Arch Linux-based systems

sudo pacman -Syu          # Sync packages and update  
sudo pacman -S nginx      # Install a package  
sudo pacman -R nginx      # Remove a package

Web Server

A web server is software that receives and responds to requests from clients by serving web content such as HTML pages, images, or data. It is a core component of the internet, enabling websites and web applications to be accessible to users across the globe.

Some of the most widely used web servers today include:

  • Apache HTTP Server

  • Nginx

  • Lighttpd

  • Microsoft IIS

These servers listen for incoming HTTP requests on port 80 and HTTPS requests on port 443. These ports are standard for web communication and help the server distinguish between secure and non-secure traffic.

Setting Up Apache (httpd) on Linux

Here’s a step-by-step guide:

Installing Apache

sudo yum install httpd -y
  • yum → Package manager for RHEL-based systems

  • install → Action to install software

  • httpd → Apache server package

  • -y → Automatically confirms the installation

Note: Apache’s default directory for web content is /var/www/html. This is where we’ll place our web files.

Update all installed packages (best done when starting a new project):

sudo yum update -y

Starting and Checking Apache Service

Start the Apache server:

sudo service httpd start

Check its status:

sudo service httpd status

Possible statuses:

  • unloaded and inactive → Apache is not installed

  • loaded and inactive → Installed but not started

  • active and running → Apache is running successfully

Check the version:

httpd -V

Hosting a Basic HTML Page

Navigate to the default web directory:

cd /var/www/html

Create a simple HTML file:

sudo nano index.html

Example content for index.html:

<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello from Apache Server!</h1>
</body>
</html>

Save and exit using: CTRL + X, then Y, then Enter.

Viewing the Page in Browser

Open a browser and enter:

http://<your_public_ip>

You should see your web page live like this:

Setting Up Nginx on Linux

Nginx (pronounced “engine-x”) is a high-performance, lightweight web server used widely for serving static content, acting as a reverse proxy, load balancer, and more.

Here’s a step-by-step guide:

Installing Nginx

sudo yum install nginx -y

Nginx’s default directory for web content is /usr/share/nginx/html. This is where we place our web files.

Update all installed packages (recommended when starting a new project):

sudo yum update -y

Starting and Checking Nginx Service

Start the Nginx server:

sudo systemctl start nginx

Check its status:

sudo systemctl status nginx

Check the version:

nginx -v

Hosting a Basic HTML Page

Navigate to the default web directory:

cd /usr/share/nginx/html

Create a simple HTML file:

sudo nano index.html

Example content for index.html:

<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello from Nginx Server!</h1>
</body>
</html>

Save and exit using: CTRL + X, then Y, then Enter.

Viewing the Page in Browser

Open a browser and enter:

http://<your_public_ip>

You should see your web page live!

systemctl commands in Linux

As part of Linux service management, systemctl is a powerful command-line utility used to control and inspect systemd services. Whether it's starting a web server or enabling it to run at boot, systemctl is the go-to tool.

Here are some commonly used commands to manage services like httpd (Apache):

# Start a service
sudo systemctl start httpd # for apache
sudo systemctl start nginx # for nginx
# Stop a service
sudo systemctl stop httpd # for apache
sudo systemctl stop nginx # for nginx

# Restart a service
sudo systemctl restart httpd # for apache
sudo systemctl restart nginx # for nginx

# Reload a service (applies config changes without stopping the service)
sudo systemctl reload httpd # for apache
sudo systemctl reload nginx # for nginx

# Enable a service to start on boot
sudo systemctl enable httpd # for apache
sudo systemctl enable nginx # for nginx

# Disable a service from starting on boot
sudo systemctl disable httpd # for apache
sudo systemctl disable nginx # for nginx

These commands are essential in DevOps for ensuring services run reliably and automatically as part of system operations or CI/CD pipelines.

Final thoughts

Learning to set up Apache and Nginx, manage services with systemctl, and use package managers like yum and apt gave me hands-on insight into how servers actually work. Seeing my own web page live felt amazing! This part of the journey boosted my confidence and reminded me why I started to build, learn, and grow every day as a DevOps engineer.

Thanks for reading! If you found this helpful, feel free to drop a comment, share it with others, or follow along for tomorrow’s update!

10
Subscribe to my newsletter

Read articles from Vaishnavi D directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vaishnavi D
Vaishnavi D