Initial VPS Setup


Creating a Non-root user

Log in to your VPS

ssh root@your_server_ip

Create a new root user

adduser UserName

Give the new user on demand root access

usermod -aG sudo UserName

Setting Up Firewall

Allow SSH to the VPS

sudo apt-get install ssh
ufw allow OpenSSH

Enable Firewall

ufw enable

Login Using The Newly Created User
( Dont close the previous terminal use new terminal)

ssh UserName@your_server_ip

If You Can Login Through new UserName Then, Close The root Terminal and Never Login Using root again



First Time Setup Commands

Install Python 3, pip, development tools, and Nginx web server

sudo apt install python3-pip python3-dev nginx

Install virtualenv to create isolated Python environments

sudo pip3 install virtualenv

Open port 8000 for incoming connections and testing (adjust as needed).

sudo ufw allow 8000

Edit Nginx configuration to change the user directive to your username.

sudo nano /etc/nginx/nginx.conf

In The File change

user www-data   TO   user UserName