5 Step Guide for Setting up Your VPS
author image

Author:

Naman AroraWed, 17 Jan, 2024

Securing your server is a crucial step when setting up a Virtual Private Server (VPS) from providers like DigitalOcean, Linode, or Vultr. This guide will walk you through the necessary commands and steps to ensure your server is set up securely.

1. Creating a VPS

To start, we'll create a VPS using DigitalOcean:

  1. Create an account on DigitalOcean and log in.
  2. Click on "Create" and then "Droplets."
content image

3. Select a region closest to your users.

content image

4. Choose the droplet, operating system, and plan size.

content image

After processing, you'll receive a public IP address, which we'll use for the next steps.

2. Initial Login

The first step is to log in. Since we can't physically connect a keyboard and mouse, we'll use an SSH client. Execute the following command in PowerShell or terminal:

ssh root@your_server_ip

Enter the password created by you or provided by your service provider.

3. Creating a Non-Root User

For security, create a non-root user with restricted access. Execute:

adduser naman

Follow the prompts to set a strong password.

content image

Grant root access when needed:

usermod -aG sudo naman

4. Firewall Setup

Protect your public server by setting up the UFW firewall. Allow OpenSSH for remote access:

ufw allow OpenSSH

Enable the firewall:

ufw enable

The firewall will now block all connections except SSH, enhancing your server's security.

5. Conclusion

In summary, you've created a VPS, performed the initial login, created a non-root user, and set up a firewall. Always test the new user's login before logging out. Consider additional security measures like strong passwords and regular software updates.

I hope this guide was helpful.

Happy Coding!

author image

Naman Arora

Technical Author with a passion for translating the complexities of software, computers, and emerging technologies into accessible and engaging content. Armed with a background in computer science, I blend technical expertise with a flair for effective communication in my writing. Join me on this tech-savvy journey as we explore coding languages, unravel the nuances of software architecture, and stay informed about the latest tech trends. Let's navigate the digital frontier together!

Portfolio designed and developed by Naman Arora