Detailed instructions for installing VestaCP on VDS. Instructions for using the Cloud VDS section of the control panel Adding a new user
Virtual dedicated servers (VDS) are designed to host Internet projects with a high level of visits, which are characterized by a very large load on regular hosting. Such a solution allows you to expand administration capabilities, increase resistance to overloads and provide the required security. The use of VDS opens up great opportunities for the implementation of modern technologies for managing website content.
A virtual server is an emulated Calculating machine with the operating system installed. Accordingly, when working with it, the VDS administration and configuration tools are no different from those of a dedicated physical server. VDS operates under OS control Microsoft Windows, Mac OS or Linux depending on choice tariff plan. Like a physical server, its virtual counterpart provides work with root rights, assignment of IP, ports, security policies, etc.
To start using VDS, the first thing you need to do is order the appropriate services from your hosting provider. You can connect to a virtual server using the Remote Desktop utility. A similar application is developed for all popular operating systems - Microsoft Windows, MacOS, Linux and even Android. In the case of Linux, rdesktop, FreeRDP or Remmina programs are suitable, and in Microsoft Windows they use mstsc.exe.
Connecting to a server may also require certain knowledge - this console commands and parameters without which control of the remote system is impossible. You can find out how to use VDS after connecting in three ways:
- in relevant reference materials;
- yourself - to do this, just download and install the nginx or Apache web server, PHP and MySQL packages and other necessary full-fledged work server software;
- contact your hosting provider, who will give you the necessary step-by-step instructions.
To make it convenient to manage the system, we use special programs- VDS control panels. These include, for example, ISP Manager, a commercial application actively used by Russian Internet agencies.
If you do not want to waste your time searching for information on setting up and managing a virtual server, it is better to immediately order the necessary technical support. In particular, in the 3data data center network you can always count on this service. Thanks to it, you can focus your attention on the site and its promotion, and not on the intricacies of setup and administration.
This article discusses general issues on working with Cloud VDS from the hosting control panel.
As part of the service Cloud VDS you can flexibly manage the resources your applications need to function properly. At any time, you can get additional resources by creating a certain number of new VDS servers, or increasing the capacity of existing VDS, or vice versa - abandon unused capacity and not pay for it. The cloud VDS billing system calculates the ordered services once an hour, so even if you need a very powerful server, but only for a few hours, it will not cost much, because only the hours of actual use of this server will be paid. For example, the cost of using an entry-level cloud VDS (tiny tariff, 10 GB disk) for one day will be about 8 rubles, and for one hour - about 34 kopecks.
We offer cloud VDS based on many distributions.
Server must select the following option:
You will receive access data by email. If you reinstall, all current data from the server will be deleted.
Those wishing to install VestaCP via the console you can independently use the instructions below.
1. If you use Windows OS on your PC, then download the popular SSH client PuTTY .
If you use Linux or MacOS on a local PC, you can use the SSH console built into the operating system.
2. After installation PuTTY run the program and enter the IP of your server:
We enter the root login and password for the server, you received this data when activating the VDS to the contact email of your account, a request with this data is also available in the section "Tickets". Please note that the password should not be visible when entered. When you have entered it, press the button Enter.
3. Run the commands one by one:
Curl -O http://vestacp.com/pub/vst-install.sh
Bash vst-install.sh
4. We will see a proposal to continue the installation, type "y"
Next, the system will ask you to enter your email and server hostname, do this and wait up to 15 minutes until the control panel is installed along with necessary set software.
5. When the installation is complete, we will see the following message in the SSH console:
Save the data highlighted in red.
7. After entering the login and password that we received in step 5, we proceed to adding our domain. This can be done in the section WEB using the green button in the form of a sign "+" , base MySQL data create in the same way, but in the section D.B.. Detailed information on working with VestaCP You can visit the developers' website.
8. To download files from the added domain, you need to use any convenient FTP client and username/password admin, we received this data in paragraph 5 of this instruction. How FTP server
indicate the IP of our VDS, upload site files to the directory /web/YOURDOMAIN/public_html/
If necessary, you can add new users to VestaCP.
9. Information about which NSs to use for a domain can be found.
Control is carried out using command line. For these purposes it is most convenient to use free program PuTTy. It does not require installation: after downloading and running the utility, you can immediately connect to the VDS via SSH by entering the IP address (the default port number is 22) and clicking on the “Open” button. After this, a console window will appear on the screen with an invitation to authorize “login as:”. Enter root, press “Enter”, then enter the password received when ordering the service and confirm the action again with the enter key. Now you can start working.
The VDS setup procedure itself involves entering text commands into the console, with which you can perform almost any operation on the server. Below is a sequence of basic actions that must be performed immediately after launch virtual machine, and step by step installation software bundles necessary for hosting websites. The examples are adapted for the two most common Linux families: Debian (which includes, for example, the popular Ubuntu) and Centos (which includes Centos itself, Fedora and a number of others).
Attention! For OS version Bitrix 6 installed on VDS, LEMP installation is not required!
Initial VDS setup
Software update
You need to start setting up VDS with a global update. You can run the update on Debian-like operating systems as follows:
Apt-get update && apt-get upgrade
for Centos the command is different:
During the update process you will be asked if you want to install new packages. Answer yes using the Y key and confirm your choice by pressing “Enter”.
Adding a new user
Work with the server under account root is strongly not recommended - it is best to create a new user and give him the necessary rights. On Debian-like systems this is done with the command:
Adduser username
where username should be replaced with the desired username. After completing it, you will be asked to set a password, and then asked to fill out additional fields (this is not necessary - you can leave them blank).
When working with Centos, the command is also used:
Adduser username
However, the password is set separately:
Passwd username
Transferring root privileges
After creating a new user, you need to assign super administrator rights to him, otherwise you will not be able to fully configure VDS. This is done by adding the newly created account to the appropriate group. For Debian-like:
Gpasswd -a username sudo
for Centos-like:
Gpasswd -a username wheel
SSH management
For safety reasons, it is necessary to perform a number of manipulations with configuration file sshd_config, which, as you might guess, is responsible for configuration remote connection to the server via SSH. Different Linux distributions use different utilities for editing, and accordingly, the commands for them will be slightly different. Debian-like ones use nano:
Nano /etc/ssh/sshd_config
To save the changes you have made, press the key combination Ctrl+X, then Y and “Enter”. Centos includes a vi editor:
Vi /etc/ssh/sshd_config
Saving information is carried out with the command: x, after which you must press “Enter”.
In sshd_config you should disable root logins by replacing
PermitRootLogin yes
PermitRootLogin no
and also change the default SSH port by replacing
for example, on
It is better to choose a port number from the range 49152-65535 - this will avoid possible conflicts with various Linux services. After the described manipulations, you need to restart SSH. In Debian this is done like this:
Service ssh restart
Systemctl reload sshd
Now you need to reconnect to the server via the assigned port under a new account, after which you can continue setting up VDS.
Installing and configuring LEMP
Most modern CMS are written in the PHP programming language. This means that to host almost any website, regardless of type and functionality, we will need LEMP. This abbreviation stands for a combination of a modern and very fast Nginx web server, the php-fpm interpreter and the MySQL database management system. The installation procedure is quite simple and will not take much time.
Installing Nginx
Let's start by installing Nginx. In Debian-like distributions this is done in one line:
Sudo apt-get install nginx
after which the server will be automatically started.
On Centos, you first need to add the EPEL repository:
Sudo yum install epel-release
and only after that carry out the installation:
Sudo yum install nginx
The final stage is launching Nginx:
Sudo systemctl start nginx
Installing MySQL
On Debian-like operating systems, the database service is installed with the command:
Sudo apt-get install mysql-server mysql-client
During the process, you will be asked to set a MySQL administrator password.
In Centos-like distributions, instead of MySQL, a fork of MariaDB is used, which has the same functionality. After installing it:
Sudo yum install mariadb-server mariadb
The database server must be started and also added to the startup list:
Sudo systemctl start mariadb sudo systemctl enable mariadb
Setting up MySQL
The initial setup of the database server is carried out using a special script included with the main software:
Sudo mysql_secure_installation
After launch, you will be asked to enter the MySQL administrator password that we set in the previous step, and then will be asked a series of questions, which must be answered with the Y (yes) and N (no) buttons, confirming the choice with the “Enter” key:
- Do you want to change your password? (Change the root password?) - No (N)
- Delete anonymous users? (Remove anonymous users?) - Yes (Y)
- Deny remote authorization with superuser rights? (Disallow root login remotely?) - Yes (Y)
- Delete test database? (Remove test database and access to it?) - Yes (Y)
- Reload the privilege table? (Reload privilege tables now?) - Yes (Y)
Adding a new database
Database management is carried out through MySQL console. To enter it, you must enter the command:
To host a dynamic site, you need to create a database with which the engine will work. Typically, a separate database and a separate user who can manage it are created for each project. Let's create a sitedb database, a site_user user, and then give sitedb management rights to the latter (you can replace the suggested names with any others).
This is done as follows:
Create a database:
CRE ATE DATABASE sitedb;
Create a user (instead of password, enter a unique password)
CREATE USER site_user@localhost IDENTIFIED BY "password";
We transfer sitedb management rights to the site_user user:
GRANT ALL PRIVILEGES ON sitedb.* TO site_user@localhost IDENTIFIED BY "password";
Updating privilege data:
FLUSH PRIVILEGES;
When all operations are complete, exit the MySQL console:
Installing PHP
An important step in setting up VDS is installing and configuring the PHP interpreter. The commands for different Linux distributions are different. Installation in Debian is carried out like this:
Sudo apt-get install php5-fpm php5-mysql
In Centos it's a little different:
Sudo yum install php php-mysql php-fpm
PHP configuration
The first step is to edit the php.ini file. On Debian and Ubuntu it is located here:
Sudo nano /etc/php5/fpm/php.ini
On Centos-like distributions - directly in the etc directory:
Sudo vi /etc/php.ini
In both systems, you first need to uncomment and change the value in the following line:
;cgi.fix_pathinfo=1
Cgi.fix_pathinfo=0
Thus, we have closed an important vulnerability that could have been used by attackers to gain unauthorized access to the site. This completes the setup of the interpreter on Debian; all that remains is to restart the PHP processor:
Sudo service php5-fpm restart
In Centos, you also need to edit the www.conf file:
Sudo vi /etc/php-fpm.d/www.conf
Here you need to find the line
Listen = 127.0.0.1:9000
and replace with
Listen = /var/run/php-fpm/php-fpm.sock
We also change
Listen.owner = nobody listen.group = nobody
Sudo systemctl start php-fpm sudo systemctl enable php-fpm
Creating a directory
Now you need to create a directory in which your resource files will be located. At any operating system On Linux this is done with the following command:
Sudo mkdir /var/www/sitename.ru/public_html
IN in this example sitename.ru must be replaced with Domain name site. As for CMS files, they should be uploaded to the public_html folder. Once the download is complete, you must transfer control rights to the web server. There are differences in the names used to refer to Nginx. For Debian-like distributions the command will look like this:
Sudo chown -R www-data:www-data /var/www/html/*
It's different in Centos:
Sudo chown -R nginx:nginx /var/www/html/*
Adding a new Nginx host
The last step in setting up a VDS to host a website is adding an Nginx virtual host. We just need to edit the default. In the Debian family this is done like this:
Sudo nano /etc/nginx/sites-available/default
Sudo vi /etc/nginx/conf.d/default.conf
After opening the file, remove all information from it, replacing it with the code presented below (instead of sitename.ru, substitute the current site name), and save the result:
Server ( listen 80; server_name sitename.ru; server_name_in_redirect off; access_log /var/log/nginx/sitename.access_log; error_log /var/log/nginx/sitename.error_log; root /var/www/sitename.ru/public_html; index index.php index.html index.htm default.html default.htm; location / ( try_files $uri $uri/ /index.php?$args; ) error_page 404 /404.html; error_page 500 502 503 504 /50x.html ; location = /50x.html ( root /usr/share/nginx/html; ) location ~ \.php$ ( try_files $uri =404; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; ) )
All that remains is to restart Nginx. Command for Debian distributions:
Sudo service nginx restart
Sudo systemctl restart nginx
Now virtual server completely ready for use, and you can start working directly with the web resource. Further steps depend on the selected CMS.