When starting work on your new Ubuntu server, the first step you should make is setting up its correct configuration. It begins with setting up the basic parameters. If you want the process to go smooth and easy, follow this guide.
Basic VPS configuration
There are four steps you need to make to launch a VPS.
Connecting via SSH
The first thing you’ve got to do when setting up a VPS on Linux is to connect to the server. There are different ways to do it. But in our opinion, the best way to do it is via Secure Shell Protocol, which will allow you to upload files and manage the server. By the way, a Unix-based operating system will let you connect through the command line. Enter:
ssh [email protected]
(instead of nnn you should type the whole IP address of the server, like “192.0.2.123”).
Then enter the password provided by the hosting company.
If your operating system is Windows, you’ll need a special client. Such clients as PuTTY or Bitvise are a good solution for their convenience and functionality. After the installation, you’ll see the window where you’ll have to specify:
- the IP address of your server in the hostname column;
- type of SSH connection;
- port number (the default is 22);
- the name of the connection session of your choice.
Now you have to save the data and press the “connect” button. If everything went well, you’ll see a console. Enter your login (by default it’s root) and password.
Basic security setup
First of all, you have to know the basic rules on how to improve the protection of your server from unauthorized access. These include changing the root’s password and connection port, as well as updating the core and the packages.
To change the password, enter into the command line:
In this way, you’ll create a request for a new password. To check the new password, create a second SSH connection. Make sure that the connection with the new password runs well and shut down the unnecessary connection.
Changing the port. The default port value is 22. However, we, HostZealot, take care of our customers, so we’ve changed it to 56777. If your VPS has the standard port value, you have to change it yourself. To do that, open the configuration file with the command:
Change the value of the Port NNN variable, entering a new number instead of NNN (you can choose any value between 1 and 65535). Afterwards, restart the SSH service with the commands:
service ssh restart (for Debian/Ubuntu);
service sshd restart (for CentOS);
To check it, use the trick from the previous stage: open another SSH session with the new parameters.
Server update. Responsible hosting companies, like us, take care of the actualization of the VPS kernel. But you can check it anytime anyway. To do this, use the update download command:
apt upgrade (для Debian и Ubuntu)
yum update (для CentOS)
It will take a couple of minutes. After the update, you only have to restart the server with the command:
Adding a new user
The root user is a kind of superadmin having any possible rights. But to use Linux VPS more safely, users with limited rights are to be created and used as well. To do this, perform the following scenario:
Enter the command:
It creates a new user (instead of USERNAME, you should type the username you want).
Run the command:
usermod -a -G sudo USERNAME
It adds a new user to sudo group, which owns root rights.
Enter the system as the created user with the command:
ssh -p PORT -l USERNAME nnn (enter the port number instead of PORT and IP-address of the server instead of nnn).
Create a complex password for this user when entering the server.
Installation of software
The last step of the setup of a VPS on Linux is the installation of the basic software. You should know that every project requires its own set of software, and it’s impossible to tell about each one. Here we are going to have a closer look at just one of the popular stacks known as LAMP (short for Linux, Apache, MySQL, and PHP). By the way, there is an alternative for LAMP, known as LEMP, with E standing for Nginx web-server (instead of Apache).
The complex installation of the LAMP package is easy and fast.
First, run the command:
sudo apt-get install apache2 apache2-doc mysql-server mysql-client php5 php5-mysql libapache2-mod-php5 phpmyadmin
Then press Y to confirm the installation process.
In the next window, enter the password for MySQL and repeat it in the following window (you can change the password any time you need it).
Then choose the type of the server (apache2) and confirm the standard settings for the phpM yAdmin panel, create the service database, and specify your password for this panel.
Open Apache settings with the command:
sudo nano /etc/apache2/apache2.conf
At the end add:
Exit the file saving changes, and you are through.
Keep in mind, however: you’ve just finished the basic setup. The server is ready for uploading sites, but it may later need a bunch of other operations, like turning on the hosts, setting up the DNS, etc. These subjects will be covered in detail in our other posts.
Why good technical support is so important?
Keep in mind that we’ve just discussed a general scenario, but it can vary depending on the situation. Such factors as different OS versions of your VPS, different apps which are used on the site (like Ruby and Node.js), different server control panels, and regular updates may affect the setup of VPS on Linux.
That’s why the technical support of the hosting company is so important when you face problems and have to find an optimal solution when setting up VPS on Linux.
Therefore, it’s best to choose the services of HostZealot. We offer not only VPS Europe for affordable prices but also professional technical support. We’ll surely help you find the right VPS and set it up for your project!g