Many of our deployed servers utilize the Linux-based system. We provide all recent distro’s and our databases are updated frequently to provide you the most recent version of the operating system (OS) that you need. Additionally, the virtual services that we provide are always licensed via official distributors.

How To Setup Your Free Linux VPS

A virtual private server (VPS) is a hosting server that is divided into virtual pieces. The main benefit of a VPS is the scalability of the product. With normal servers, you can run into memory, storage, or CPU issues. Virtualization eliminates these problems, and smart virtualization software means the server can be upgraded within seconds. To add to this, the Linux operating system promises a lot of ease for the process.

While setting up a Linux VPS can sound like an overwhelming task, it’s quite simple. When it comes to VPSs, you’re given full administrative control over your server, meaning you’ll have to do a bit more to prepare it for use, like:

  • Connecting to your server
  • Learning essential Linux commands
  • Adding and managing user accounts
  • Installing new software and updates
  • Setting up a firewall

Connecting To Your Server

The first thing you’ll need in setting up a server is, of course, a VPS plan. We offer flexible plans for Linux VPS hosting, which allows you to pay for only what you require on an hourly, daily, or monthly basis. We offer some of the most powerful features and excellent packages and are pleased to offer excellent, advanced technology solutions for you and your business.

Once you sign up for a VPS plan with a web host, you’ll be provided with a set of credentials, which usually include:

  • The IP address of your server
  • A username (usually root)
  • A password

Unix-based OS

If you’re connecting to your server from another Unix-based OS, you can connect directly to your server via the command line. First, you’ll open Terminal, then type:

  • ssh username@your_VPS_IP

You’ll then be prompted for your password. Type, then enter.

Windows OS

If connecting from Windows, you’ll have to install PuTTy to connect to your server. Once installed, just insert the hostname or IPv4 address to connect. You’ll also input the username and password. Once finished, you can enter the command-line interface.

In the terminal, you’ll need to type the following command to log into your VPS. You’ll be using the same credentials as before:

  • ssh username@your_VPS_IP

If you enter the information correctly, you’ll be presented with a summary of the details of your server as well as a prompt to enter more commands.

Updating Your Server

Note: This guide will use Ubuntu as it’s Linux distribution. If using any other, make sure to adjust the command lines accordingly.

You should see a message that lets you know if there are any packages or updates available. You risk leaving your server exposed to security vulnerabilities and well as any new features or improved performance by using outdated software.

First, type in the command “apt update” and hit enter. This makes your server check what packages need upgrading. Once it finishes, type “apt dist-upgrade”, which updates all of your server’s packages. This can take a while, depending on how many updates your server needs to install.

After all of your packages are up to date, you should restart your server. Type “reboot”, then close the command line window. Give your server a few moments, then log back in.

If you’ve executed this step properly, your server shouldn’t present any packages or updates to install.

Creating/Modifying Users

Although you have access to the root user on your VPS, it’s better to set up a second account and give it superuser privileges. The reason why is that without proper experience of what you’re doing, executing commands from the root account can cause some serious damage to your system.

With a regular account that has superuser privileges, you’re required to add the prefix sudo to any command you want to run using administrative privileges. Though a small change, this adds a buffer when running commands, as you’ll often think twice before running any command using sudo.

Next, you’ll type the following command to set up a new user. Replace the second half with the username of your choosing:

  • $ adduser username

You’ll be asked a series of questions, though all you’ll need to enter is a password. Then, to grant superuser privileges to your new user, you’ll type this command:

  • $ usermod -aG sudo username

If you ever seek to remove a user, you would use this command:

  • $ deluser username

Setting Up SSH Keys

Though your server is protected by a password, it’ll be more secure if utilizing public key authentication. When securing your server through this method, you use a set of public and private keys. Your server stores your public key and uses it to authenticate your private one, which only you have access to. Once set up, you would require the private key and passphrase to log in.

Generating SSH Keys

Generating SSH keys can be done directly from the Terminal using this command:

  • ssh-keygen -t rsa

Once entered, you’ll be presented with a few questions.

  • Enter file in which to save the key (/home/tautvydas/.ssh/id_rsa):

It’s generally recommended to allow the key generator to create the keys in the default location.

  • Enter passphrase (empty for no passphrase):

Then

  • Enter same passphrase again:

Though you aren’t required to leave these empty, it’s possible to do so. Doing this allows you to log in using the ssh username@your_VPS_IP command as long as the keys are set up.

You should have two keys - one that says id_rsa and id_rsa.pub. Ensure that you take care of id_rsa as this is your private key. Keep it on your local device only.

Copying The Public Key To Your VPS

Now that we have the key pair, we need to transfer the public key to the VPS. This is easily accomplished using this command:

  • ssh-copy-id username@your_VPS_IP

Remember to enter your server’s IP address and username for the correct server. Entering this command gives you this warning message:

  • The authenticity of host 'Server's IP address' can't be established.
  • RSA key fingerprint is ...
  • Are you sure you want to continue connecting (yes/no)?

Type yes to confirm and hit enter. Another message will pop up:

  • Warning: Permanently added 'SERVER IP' (RSA) to the list of known hosts.
  • username@your_VPS_IP password:

Here, you’ll enter the username and password as required. You’ll see another message:

  • Now try logging into the machine, with "ssh 'user@serverip'", and check in:
  • ~/.ssh/authorized_keys*
  • to make sure we haven't added extra keys that you weren't expecting.

Now, you’ll be prompted for a password (or not) when logging into your VPS.

Setting Up Your Firewall

The best firewall program for Linux is Iptables. Understanding how iptables works can be a bit involved, though we’ll guide you through the process. Best of all, this is a one-time procedure.

In short, Iptables monitors traffic to and from your server using tables. These tables utilize sets of rules called chains which filter incoming and outgoing data packets. When a packet matches a rule, it’s given a target, which can be another chain or one of these values:

  • Accept - which allows the packet to pass.
  • Drop - which doesn’t allow the packet to pass.
  • Return - which stops the packet from going through a chain and tells it to go back to the previous chain.

For this guide, we’ll need to use filter, one of the default tables. It has three chains:

  • Input - which controls packets coming to the server
  • Forward - which filters incoming packets that will be forwarded elsewhere
  • Output - which filters packets leaving your server

How To Install Iptables

Iptables comes pre-installed in most Linux distributions, though if you don’t have it, we’ll guide you through the installation process.

  1. Connect to your server via SSH
  2. Execute the following commands:
    1. sudo apt-get update
    2. sudo apt-get install iptables
  1. Check the status of your iptables configuration by running:
    1. sudo iptables -L -v

-L allows you to list all of the rules, while -v shows the information in a more detailed format. You’ll notice that all of the chains are set to Accept and have no rules. This will change as we move forward.

Define Your Chain Rules

When you define a chain rule, you append it to the chain. To do this, you would insert -A after the iptables command, like this:

  • sudo iptables -A

It will alert iptables that you are adding new rules to a chain, and you can combine commands with other options. Here’s a quick list:

  • -i (interface) - allows you to filter the traffic of a specific network interface
  • -p (protocol) - the network protocol where your filtering process takes place
  • -s (source) - the address from which traffic comes from
  • -dport (destination port) - the destination port number of a protocol (22, 443, 80, etc.)
  • -j (target) - the target name (Accept, Drop, Return)

Note that if you use all of these at once, you must use them in this order:

  • sudo iptables -A <chain> -i <interface> -p <protocol (tcp/udp) > -s <source> --dport <port no.>-j <target>

Understanding this syntax will allow you to configure the firewall to give more security to your server with relative ease. In this case, we’ll be utilizing the Input chain.

First, we’ll need to allow traffic on localhost, using this command:

  • sudo iptables -A Input -i lo -j Accept

In this command, lo stands for loopback interface, which is utilized for all communications on the localhost. This command makes sure that the connections between a database and a web application work together properly.

Now, we want ports 22, 80, and 443 to connect and work as usual. These are SSH, HTTP, and HTTPS, respectively. Input the commands one by one:

  • sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  • sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
  • sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT

To check if the rules have been appended, use -L -v again. You should be presented with a table showing that the TCP protocol connections from the ports you specified will be accepted.

You can also filter packets based on an IP address or range of addresses. This would go after the -s command, like so:

  • sudo iptables -A INPUT -s 192.168.0.1 -j ACCEPT
  • sudo iptables -A INPUT -s 192.168.0.1 -j DROP

To reject packets from a specific IP address, replace Accept with Drop.

Dropping packets from a range of IP addresses requires you to use the -m command along with the iprange module, then specify the IP address range with -src-range. A hyphen should separate the range of IP addresses without a space between them.

  • sudo iptables -A INPUT -m iprange --src-range 192.168.0.400-192.168.0.500 -j DROP

Once you’ve defined your -dport rules, it’s crucial to use Drop for all other traffic. This prevents any unauthorized connections to your server via other ports. This command is easy:

  • sudo iptables -A INPUT -j DROP

This drops any connections outside of the specified port.

If you want to remove all rules and start over completely, use the -F command, flush.

  • sudo iptables -F

This command erases all current rules. To delete specific rules, you must use the -D option. First, you must see all available rules by entering this command:

  • sudo iptables -L --line-numbers

You’ll be shown your list of rules along with numbers. To delete a rule, you would need to insert the corresponding chain and number from the list. Say you wanted to remove the first rule of the input chain, it would be:

  • sudo iptables -D INPUT 1

You would adjust the number accordingly depending on what rule you wanted to delete.

Before we finish, an important thing to note is that all iptables rules are saved in memory. This means that they aren’t persistent after a reboot. To make your changes persistent, use this command:

  • sudo /sbin/iptables-save

This saves the current rules on the system configuration file, which is used to reconfigure the tables every time your server reboots. Make sure to run this command whenever you make changes to the rules.

Wrapping It Up

Now you have a nice and secure Linux server set up and ready for your business needs. Additionally, when choosing our cheap Linux VPS hosting services, you receive a guarantee that you are the only one in charge of your data. Our VPS hosting and web hosting plans, along with our other services and support team, are all that you will ever need for your business.

How Does A Linux VPS Work?

As stated before, a VPS is a hosting server divided into pieces. It’s a hosting solution that uses virtualization technology to provide you with dedicated resources on a server with multiple users. When a visitor accesses your website, the browser sends a request to your server and transfers the files via the internet. With VPS hosting, you’re simulating a physical server that can be shared among several users. It’s more stable and secure than shared hosting, yet cheaper than a dedicated server.

In short, a VPS is both virtual and private because it gives you complete control while being separate from other server users on the OS level. Our VPS hosting gives you the same root-level access as a dedicated server, but at a far lower cost.

When Would You Use A Linux VPS?

Linux has its advantages just like Windows does. However, choosing a free Linux VPS mainly relies on your personal experience and requirements. For the experienced user, they may find that Linux allows them to manage their server far easier due to the abundance of support and security, low cost of entry, and performance benefits.

On the other hand, Windows provides a widely familiar graphic user interface (GUI) that the common layperson will be more adjusted to. Additionally, support for any issues you have is prompt due to the paid Microsoft IT team, unlike the voluntary help from Linux-based OS forums.

Although Linux is the most popular OS, you should always ensure that your hosting package is compatible with your operating system. At the end of the day, your choice boils down to personal preference.

Conclusion

We provide an efficient, secure, and effective service, and our packages are trusted by businesses and individuals all over the world. Because of our service’s flexibility, our clients can grow and scale their businesses as required while only paying for what they need. We have designed our network to be the best Linux VPS hosting you can buy, and we ensure quick deployment, exceptional support, and high-level security. We offer the most powerful features and servers for Linux, all for a very low, flexible cost.

Free Linux VPS

Learn more :

Free VPS

Free Linux VPS Trial

Start now for as low as $2,99 a month!

  • 8 Characters2
  • 1 Uppercase Atleast
  • 1 Number Atleast