It’s easy to create a website on a hosting. You’ve a got a nice control panel, Softaculous, website builder and other tools. But on a VPS or a server it’s a little more complicated.

Table of Contents

How to change the DNS records

DNS records show the browsers on which server they should look for the website’s files when the user types in a domain. If your domain is registered at Unihost:

  • Log into the Client Area.
  • Press Domains > Edit the DNS records.
  • Click Edit records.
  • Type your server’s IP address as an A-record.
  • Click Save at the bottom of the page.

If you purchased the domain from another provider, write to their tech support and ask them to change the DNS records. IMPORTANT: The process of changing the DNS records can take up to 3 days. You can wait until it’s done, but I prefer to keep setting
up the server using its IP address.

How to make a website on a server with a control panel

All Unihost servers and VPS have an ISPmanager control panel installed. In order to log into it, access the address http://server’s_ip_address:1500 and type in the login and password that you received in the e-mail after purchasing the server. The just follow the manuals from the the ISPManager 5 chapter. For example, install the CMS via Softaculous.

How to make a website on a server without a control panel

If you have no control panel, or you just really want to setup everything through the console, you are going to need:

Starting work

  • Open the terminal on your PC or another device (Ctrl+Alt+T or use the app menu).
  • Connect to the server. To do this, run the following command: ssh user_name@server’s_ip_address and enter your password if necessary.
    DS_171017_b16a29

How to install and setup the necessary software

In order to run a website from the VPS or a server, you need a LAMP. LAMP is a software complex that consists of Linux OS (L), Apache webserver (A), MySQL database manager (M) and hypertext preprocessor PHP (P). I also recommend adding PHPMyAdmin — a
web interface for MySQL, which makes setting up databases much easier. You already have Linux installed on your server, so let’s install the rest.

Webserver

Necessary to transmit files via HTTP, which means necessary for the server to work at all.

  • Install Apache with: sudo apt install apache2.
    DS_171017_873a65 (1)
  • Enter your password, in order to give the terminal root access.
    DS_171017_8b12cf
  • Press Y and Enter, to confirm installation.
    DS_171017_20488e
  • Wait until it’s done.
  • Go to the http://your_server’s_ip_address and see the Apache test page.
    DS_171017_a42dec

Database manager

Databases are necessary in modern CMS. They contain all the custom information about the website — user list, post content etc.

  • Install the MySQL with: sudo apt install mysql-server.
    DS_171017_e5521f
  • Press Y and Enter to confirm installation.
    DS_171017_588dd1
  • Make up a password for MySQL. You can type in anything you want, even «1234» — we are going to change it later anyway.
    DS_171017_cf5c39
  • Confirm the password.
    DS_171017_6626ba
  • Wait until the installation is over.
    DS_171017_4dbfe0
  • Run /usr/bin/mysql_secure_installation to set MySQL up.
    DS_171017_09774d
  • Enter your OS password.
    DS_171017_ff83b7
  • Agree to install the password validation plugin. To do this, press Y on the keyboard and press Enter.
    DS_171017_83dfe6
  • Plugin offers three strength levels for your password. Type in the one you want and press Enter.
    DS_171017_80dfde

    • Plugin will evaluate the current password on a 1-100 scale and offer to change it. Agree by pressing Y and Enter.
      DS_171017_79ba5e
    • Type in a new password. It has to conform to the guidelines you agreed to previously.
      DS_171017_d2a77e
    • Plugin will re-evaluate your password and offer to continue. Press Y and Enter.
      DS_171017_03a148
    • Respond to all following requests by pressing Y and Enter. This will delete all the test databases, test users and close some vulnerabilities in MySQL itself.
      DS_171017_f00afe
    • Wait until setup is over.
      DS_171017_a1a32c

Hypertext preprocessor

PHP is necessary to run scripts — special programs that are necessary for all modern CMS to function.

  • Install PHP: sudo apt install php libapache2-mod-php php-mcrypt php-mysql.
    DS_171017_590e7c
  • Press Y and Enter, to confirm installation.
    DS_171017_6a9896
  • Wait until it’s done.
  • Create a test php file by running: sudo nano /var/www/html/info.php
    DS_171017_92c5b9
  • Paste this into it:
    <?php
    	phpinfo();
    	?>
    
    • Press Ctrl+X, to close the text editor.
    • Press Y, to save the changes.
    • Press Enter to overwrite the file.
    • Check whether PHP is working or not. To do this, go to http://your_server’s_ip_address/info.php и and see the PHP test page.
      DS_171017_72fe6e

MySQL web interface

You can manage databases in the terminal, but it’s not really convenient. If you have a web interface, you can do straight in the browser, in a more cozy and traditional way.

  • Install PHPMyAdmin: sudo apt install phpmyadmin apache2-utils.
    DS_171017_9ea0e5
  • Press Y and Enter, to confirm installation.
    DS_171017_869d85
  • In the list of web servers, select apachе2 and press Enter.
    DS_171017_ba1f90
  • When asked whether or not configure the database with db-common, choose Yes and press Enter.
    DS_171017_3f6a29
  • Enter your MySQL password and press Enter.
    DS_171017_96b998
  • Enter it again and press Enter once more.
    DS_171017_1c0dcf
  • Wait until the installation is over. DS_171017_d0233e
  • Open the Apache settings file: sudo nano /etc/phpmyadmin/apache.confDS_171017_c28394
  • Find the line DirectoryIndex index.php.
    Paste AllowOverride All under it. You should have:
    DS_171017_e1f09e

    <Directory /usr/share/phpmyadmin>
    Options FollowSymLinks
    DirectoryIndex index.php
    AllowOverride All
            [...]
  • Press Ctrl+X to close the editor.
    DS_171017_e1f09e
  • Press Y to save changes.
    DS_171017_795345
  • Press Enter to confirm the file overwrite.
    DS_171017_c88ede
  • Open the Apache config file: sudo nano /etc/apache2/apache2.conf
  • Add at the end of the file:
    # Include phpmyadmin configurations:
    Include /etc/phpmyadmin/apache.confDS_171017_577052
  • Press Ctrl+X to close the editor.
  • Press Y to save changes.
  • Press Enter to confirm the file overwrite.
  • Reboot Apache: sudo service apache2 restart

Go to http://server’s_ip_address/phpmyadmin and see the phpMyAdmin login page.
DS_171017_d9c9c5

How to upload the website files to the server

Once the web server is setup and working, you can upload the website’s files into it. For example, the WordPress installation files.

  • Download the files to your computer and unpack them to /home/admin/Downloads/Wordpress or any other folder.
  • Upload them to the server via SFTP. To do this, install the SFTP-client called FileZilla.
    • On Ubuntu, open the terminal and run sudo apt install filezilla.
    • On Windows , download the installer from the official website and run it.
  • Now unlock the SFTP to the folder you want to upload the website files to. To do this, run this in the terminal: sudo chown имя_пользователя:имя_пользователя /var/www/html and
    sudo chmod -R 775 /var/www
    DS_171017_d843a0
  • Launch FileZilla. At the top of the screen, there’s a Quickconnect panel:
    • Under Host enter sftp://your_server’s_ip.
      DS_171017_5ccffe
    • Under Username enter your Linux username on the server.
    • Under Password enter your password on the server.
    • Under Port enter 22.
    • Press Quickconnect and connect to the server.
    • In the Remote site field (on the right) type in /var/www/html and press Enter.
    • Right click on the index.html and click Delete. Confirm the deletion by clicking Yes. It’s an Apache test file and it must be deleted to prevent conflicts.
      DS_171017_f50b66
    • In the Local site field (on the left) type in the address of the folder where your website’s files are located.
      DS_171017_6665d6
    • Select all files in the folder on the left and drag them to the folder on the right. The process will take around 10 minutes. Maybe more, if you have a lot of small files.
    • Once the Queued files table has no more files, you can close FileZilla.
      DS_171017_27569c

Now you can go to http://your_server’s_ip_address and check your CMS installation webpage. But you should not install it just yet, because you do not have a database.
DS_171017_6cb4bb

How to create a database

  • Go to http://your_server’s_ip_address/phpmyadmin.
    DS_171017_d9c9c5 (1)
  • Enter your MySQL password and click Go.
  • In the menu to the left, click New.
    DS_171017_cd666e
  • Create a name for the database and click Create.
    DS_171017_fd1659

How to install WordPress (or any other CMS)

  • Go to http://your_server’s_ip_address.
    DS_171017_6cb4bb (1)
  • In case of WordPress, click Let’s Go! and fill in the necessary data, like the database access one. Afterwards, click Submit.
  • WordPress wants for the user to create the file wp-config.php with the certain contents.
    DS_171017_2ec443
  • Create it in gEdit, and upload to the web server with FileZilla.
  • Go back to the WordPress installer and Run the install.
  • Fill in the website name, user name, e-mail and password, afterwards click Install WordPress.
    DS_171017_864bc1
  • Once the install is over, you can log into your website and start using it.
    DS_171017_45ce0a
  • Now you can run your website on the VPS just as you did on your usual hosting. Except for much better performance.
    DS_171017_b2e466