Setting Up Your Own Remote VPS Using Raspberry Pi : Part One

In this series we will be hosting a remote VPS (Virtual Private Server) which can be accessed from any part of the world using a raspberry pi 4. So let’s first learn a bit about raspberry pies.

The Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer monitor or TV, and uses a standard keyboard and mouse.

It is a capable little device that enables people of all ages to explore computing, and to learn how to program in languages like Scratch and Python. It’s capable of doing everything you’d expect a desktop computer to do, from browsing the internet and playing high-definition video, to making spreadsheets, word-processing, playing games and much more.

It is usually used by IT professionals and students for various types of project which can be as small as a adblocker to a robot.

The quad-core Raspberry Pi 4 Model B is both faster and more capable than its predecessor, the Raspberry Pi 3 Model B+. For those interested in benchmarks, the Pi 4’s CPU — the board’s main processor — is offering two to three times the performance of the Pi 3’s processor in some benchmarks.

Unlike its predecessor, the new board is capable of playing 4K video at 60 frames per second, boosting the Pi’s media center credentials. That’s not to say, however, that all video will play this smoothly, and supporting this hardware acceleration for H.265-encoded video is currently a work in progress across the Pi’s various operating systems, so this is more a potential future feature than something available today. The Pi 4 also supports wireless internet out of the box, with built-in Wi-Fi and Bluetooth.

For starters, you will need a raspberry pi 4(4gb), a monitor or TV, an micro HDMI cable, keyboard, a type-c cable for power supply and a micro SD card (32GB recommended). I will list some links at the end of the blog.

Step 1: — Download and install the Raspberry Pi Imager from the link.

Step 2: — Connect your micro SD card using a SD card adapter with your PC.

Step 3: — Run Raspberry Pi Imager on your PC.

Step 4: — Select your desired Operating System by clicking on choose OS, I personally like Ubuntu hence I will be selecting Ubuntu from “Other general purpose OS” >> “Ubuntu” >> “Ubuntu Desktop 21.04”(You can also pick the Ubuntu server).

Step 5: — Select your attached micro SD card in Storage.

Step 6: — Click on Write and leave it for a few minutes.

Take a coffee break this might take a while.

Step 7: — Once the above step is completed, Eject the micro SD card and attach it to your Raspberry Pi 4.

Step 8: — Connect the raspberry pi 4 to your keyboard and monitor/display using the USB and micro HDMI port .

Step 9: — Attach the power supply and switch on the device.

Step 10: — Wait for it to run and then set the language, keyboard layout, timezone according to your preference.

Step 11: — Give the Computer a name and create a user by adding it’s username and password.

Step 12: — Take another break till the OS is done installing.

There you go! now you have successfully installed the Ubuntu OS on your Raspberry Pi 4 but, we don’t want to connect the pi to the display and keyboard all the time.

We can enable SSH on the Pi and then connect to it locally using the terminal. But first connect it to your Wifi or provide it internet access using the ethernet cable.

To do so, open the Terminal and enter the commands:

sudo apt update && sudo apt upgrade

Once your PC is done updating, enter the commands listed below:

sudo apt install openssh-serversudo systemctl status ssh

The output for these commands should be something like this and it should be active.

ssh.service - OpenBSD Secure Shell server                                                                               Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)                                    
Active: active (running) since Fri 2021-06-04 21:29:07 IST; 19h ago Docs: man:sshd(8) man:sshd_config(5) Main PID: 897 (sshd) Tasks: 1 (limit: 4143) Memory: 4.2M CGroup: /system.slice/ssh.service └─897 sshd: /usr/sbin/sshd -D

To make sure that the service SSH is running when you start your pi we need to enable it run on boot.

sudo systemctl enable ssh

Make sure to check your IP address by typing

ip a

Disconnect the display and keyboard from your pi and connect to it using your laptop/PC or mobile.

Enter the command with your username, IP address and password:-

ssh username@ip

Congrats!!!

Now are now running a local ssh server in your home. You can do all sorts of stuff just by using the command line.

Tip:- Enable rdp server for GUI access for the same.

Thank you for reading the blog and if you liked it please share it with your friends and fellow learners. In the next part, I will explain how you can use the same ssh server from anywhere in the world using a simple python script and a tool.

Penetration tester | Ethical Hacker