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!
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.
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:
(Instead of nnnn, you have to give the full IP of the server - e.g. 192.0.2.123).
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:
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.
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:
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.
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.
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:
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:
It creates a new user (use whatever name you want instead of USERNAME).
usermod -a -G sudo USERNAME
It will connect new user to sudo-group with root-authority.
ssh -p PORT -l USERNAME nnn
(specify port numbers instead of PORT and server IP address instead of nnn).
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:
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.
sudo nano /etc/apache2/apache2.conf
At the very end on a new line add:
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.
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!