How to configure a Linux VPS

How to configure a Linux VPS

Author: HostZealot Team
2 min.

For a virtual private server on a Linux operating system to meet all work tasks, its proper configuration is critically important. The beginning of this process is the initial debugging of basic parameters. And to make it quick and easy for you on a Linux VPS to set up this type of configuration, focus on our step-by-step instructions for all the key steps!

What does the initial VPS setup include?

To start a virtual dedicated server, also called VDS (read about the essence of this technology at this link), you need to go through 4 steps. Each of them should be described separately.

Connecting via SSH

Setting up a VPS on Linux starts with establishing a connection to the server. For this you can use different ways. But we recommend Secure Shell, or SSH for short, as the most secure and convenient protocol: you can use it to upload a file and manage the server by sending commands. And if you have a Unix-based system, you can connect directly from the command line. To do that, type:

ssh root@nnn

(Instead of nnnn, you have to give the full IP of the server - e.g.

  • Then the password (it is the same as the VPS address, provided by the hosting company).

If you have Windows, you will need a special client. We can recommend PuTTY and Bitvise because it is easy to use. After installation, you will see a window where you have to specify:

  • The IP address of your server in the column with the hostname;
  • SSH connection type from the offered options;
  • port number (the default is 22);
  • convenient for you session name for connections.

Then save everything and click on the button "Connect" - and the connection to your VPS is established. Confirmation of this will appear in the console, where you must enter the login (the default is root) and password.

Configuring basic security

Discussing how to configure a VPS on Linux is meaningless without simple rules to improve the security of your server against unauthorized access. These include changing your root password and connection port, as well as updating your kernel and packages:

  • Changing the password. At the command line, type:

This will prompt for a new password. To check, create a second SSH connection, make sure that the new password is connecting correctly, and disconnect the unwanted connection.

  • Change the port. By default it is set to 22, but we at HostZealot care about protecting our users and set another port: 56777. If your VPS has a standard port, you should change it yourself. To do this, open the configuration file for SSH with the command:
nano /etc/ssh/sshd_config 

And change the value of the variable Port NNN, where instead of NNN new number (you choose it yourself, the range is from 1 to 65535). After that restart the SSH service with the following commands:

service ssh restart (for Debian/Ubuntu);

service sshd restart (for CentOS);

As a test, use the same trick as in the last section: create another SSH session with the new parameters.

  • Updating the server. In general, responsible hosts, like our company, themselves monitor the updates of the VPS kernel. But it will not hurt to double-check this parameter personally. To do this, use the command to download the updates:

apt upgrade (for Debian and Ubuntu)

yum update (for CentOS)

This process may take a few minutes and after that the only remaining step is to reboot the server using the command:


how to configure a linux vps

Adding a new user

The root user is essentially a superadmin, with maximum rights. Although for the higher security of the Linux VPS the configuration must also include the creation and use of users with limited rights. To do this, run the following script:

  • Type the command:
adduser USERNAME

It creates a new user (use whatever name you want instead of USERNAME).

  • Run the command:
usermod -a -G sudo USERNAME

It will connect new user to sudo-group with root-authority.

  • Log in as the created user with the command:
ssh -p PORT -l USERNAME nnn

(specify port numbers instead of PORT and server IP address instead of nnn).

  • The first time you login to the VDS server, set a complex password for this new user.

Software Installation

The initial setup of a Linux VPS should be completed with the installation of basic software. It is important to note: Every project requires a different set of applications - and it is impossible to tell about all of them. That is why we will take as an example one of the most popular stacks called LAMP. This acronym is formed by the first letters of Linux, Apache (web server), MySQL (database), PHP (interpreter). By the way, there is also LEMP, where instead of Apache they use the alternative web server Nginx.

The maximum simple, fast and comprehensive installation of LAMP package with the phpMyAdmin panel is as follows: 

  • You run the command:
sudo apt-get install apache2 apache2-doc mysql-server mysql-client php5 php5-mysql libapache2-mod-php5 phpmyadmin

Then select Y to confirm the installation process.

  • In the window that appears later, set a password for MySQL, and repeat it in the next box (this password you can later change to another, if necessary).
  • Next, the system will ask you to specify the type of web server (choose apache2) and confirm the default settings panel phpMyAdmin, as well as the creation of a service database, and then - specify your password for this panel.
  • Open the Apache settings with the command:
sudo nano /etc/apache2/apache2.conf 

At the very end on a new line add:

ServerName localhost:80

Quit the file and save your changes - process complete!

Remember that the primary debugging process is now complete. So, the server is in fact ready for uploading websites to it, but for this you will need to do some more operations, like powering on the hosts, configuring DNS and so on. And this is an occasion for a separate, more substantial conversation.

Why is competent technical support important?

Plus consider one more factor: the scenario described above is an average, general one. And for each particular situation, it may differ in nuances. Different OS versions of your virtual dedicated server, different applications used on the website (like Ruby and Node.js), different server control panels, as well as regular updates of the technologies themselves - all this can adjust the answers to the question of how to configure a VPS on Linux.

Therefore, it is very important to be sure that the technical support staff from the hosting company will help you if there are any problems and will find the best solution. This is the reason why it is worth choosing the services from HostZealot. We offer not only affordable VPS server rental but also competent technical support - we will tell you how to choose a VDS and how it can be configured better for your specific project!

Related Articles