Articles on: Virtual Servers

Getting started with your Unmanaged Linux VPS

After completing your purchase and setup, you’ll receive a welcome email with essential information for accessing your VPS. SSH access will be your initial point of entry to the server. This guide provides foundational steps to access, secure, and install software on your VPS.

Essential Steps



Connect to your server via SSH.
Update your VPS.
Secure your VPS.
Install the required software.

1. Connect to your VPS via SSH



Connecting to SSH on macOS or Linux:

macOS and Linux come with SSH pre-installed, making it easy to connect through the Terminal.

Open the Terminal on your computer.
For MacOS: You can find Terminal in Applications > Utilities or by searching Terminal in Spotlight.
Enter the following command, replacing your_vps_ip with the VPS IP address:
ssh root@your_vps_ip

Connecting to SSH on Windows:

Windows 10 and newer versions come with Windows Terminal, which includes SSH. Alternatively, you may choose to use PuTTY, a widely used SSH client for Windows.

Open Command Prompt by pressing Windows + R , typing cmd , and clicking OK .
In the Command Prompt, enter the following SSH command, replacing your_vps_ip with your VPS IP address:

ssh root@your_vps_ip

2. Update your VPS



Regularly updating your VPS is critical to maintaining security and performance. Use the package management system appropriate for your Linux distribution to update system packages and repositories:

Using apt (Debian/Ubuntu):
apt upgradeapt upgrade


Using dnf (AlmaLinux, Rocky Linux, CentOS):
dnf update


These commands update the package list and install the latest updates, keeping your VPS current and secure.

4. Securing Your Linux VPS



Securing your VPS from unauthorised access is essential. Following these best practices will help protect your server:

3.1 Change SSH port:



Changing the SSH port from the default port (22) adds an additional layer of security by making your VPS less vulnerable to automated attacks on common ports.

Open the SSH configuration file :
nano /etc/ssh/sshd _config


Locate the line #Port 22 , remove the # to uncomment it, and change 22 to a new port number (e.g., 7822 ):
Port 7822


Save the file (ctrl+o then ctrl+x) and restart SSH to apply the changes :
systemctl restart sshd


Connect using the new port number for example: ssh root@your_vps_ip -p 7822

3.2 Set Up a Firewall:



Use ufw (on Ubuntu) or firewalld (on AlmaLinux, Rocky Linux, CentOS) to allow only necessary traffic, improving your VPS security.

Using UFW (Ubuntu/Debian)


Allow the new SSH port (replace 7822 with your chosen port):

ufw allow 7822


Allow specific services (e.g., HTTP and HTTPS for web traffic):

ufw allow http
ufw allow https


Enable UFW :

ufw enable


Verify UFW status :

ufw status


Using firewalld (AlmaLinux, Rocky Linux, CentOS):


Install and start/enable firewalld (if not already installed):
dnf install firewalld
systemctl start firewalld
systemctl enable firewalld


Allow the new SSH port (replace 7822 with your chosen port):
firewall-cmd --permanent --add-port=7822/tcp


Allow specific services (e.g., HTTP and HTTPS for web traffic):
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https


Reload firewalld to apply changes :
firewall-cmd --reload


Verify firewalld status :
firewall-cmd --list-all


sdfsdf

Make sure only the necessary ports are open to minimise security risks.

3.3 Use SSH keys:



SSH keys offer a more secure, passwordless login method. Generate SSH keys on your local machine, then add the public key to your VPS for enhanced security.

4. Install the Necessary Software



Installing software on your VPS depends on the applications you plan to use. Below are the commands for adding software packages based on your Linux distribution:

Using apt (Debian/Ubuntu):
apt install package_name


Using dnf (AlmaLinux, Rocky Linux, CentOS):
dnf install package_name


By following these foundational steps, you’ll be well-equipped to get started using your VPS effectively.

Updated on: 23/11/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!