Skip to main content

Command Palette

Search for a command to run...

SSH and Web Servers: A Beginner's Guide 🐧

Updated
3 min read
SSH and Web Servers: A Beginner's Guide 🐧
J

I am excited to continue my learning journey in DevOps. I believe that DevOps is the future of software development, and I am excited to be a part of the movement.

Introduction

Secure Shell (SSH) is a network protocol that allows secure communication between two computers. It is commonly used to connect to a remote server and manage it using a terminal interface. On the other hand, a web server is a software application that serves web pages to clients over the internet.

SSH

SSH provides a secure way to access a remote server and execute commands on it. To establish an SSH connection, you need two things:

  • SSH client

  • SSH server

The SSH client is installed on your local machine, while the SSH server is installed on the remote machine.

Installing the SSH Server

To install SSH server on Linux distro, run the following command:

sudo apt-get install openssh-server

This will install the OpenSSH server on your machine.

Remember to use sudo before each command if you are Installing a software, Editing a system file or starting a service on your linux system.

After installation run the following command to start the SSH service:

sudo systemctl start ssh

Connecting to the SSH Server

To connect to the SSH server, you need to use an SSH client. The most common SSH client is the OpenSSH client, which already comes installed on most Linux machines.

To connect to the SSH server, run the following command:

ssh username@hostname

#example
ssh jatin@legiondev
ssh jatin@192.167.0.1

Here jatin is my username for the remote machine and legiondev is my domain or you can use IP address of the remote machine.

You will be prompted to enter your password to authenticate the connection.

Web Server

A web server is a software application that serves web pages to clients over the internet. There are many web servers available for Linux, but the most popular one is Apache.

Installing Apache

Let's install Apache on our Linux machine, Run the following command:

sudo apt-get install apache2

This will install the Apache web server on your machine.

Now start the Apache service using the following command:

sudo systemctl start apache2

Configuring Apache

Apache uses configuration files to determine how to serve web pages. Main apache config file is located at /etc/apache2/apache2.conf. You can edit this file to configure Apache.

To serve a web page, you have to create a file in the /var/www/html directory. This directory is the default document root for Apache. You can create a file called index.html in this directory with the following code:

<html>
<head> <title>Welcome to Legion Dev!!</title> </head>
<body>
      <h1>Hello, my name is Jatin Chourasia.</h1>
</body>
</html>

Once you have created this file, you can access it in a web browser by entering the IP address or domain name of your Linux machine.

Conclusion

In this blog, we have discussed how to set up an SSH connection and a web server on a Linux machine. SSH provides a secure way to access a remote server and execute commands on it, on the other hand Apache is a popular web server that can serve web pages to clients over the internet. With these steps mentioned in this blog, you can set up your own SSH connection and web server on your Linux system.

More from this blog

Jatin Chourasia

49 posts

Goes by the name LegionDev

SSH and Web Servers: A Beginner's Guide 🐧