How to deploy a website on ubuntu vps server

Today, we will try to install the magento on the ubuntu vps server. It is quite simple by follow these steps.

Buy a domain and link domain to your server via DNS

The first, we need to have a domain and a vps server. I often buy domain on HostGator. And then I buy a VPS server on vultr or digitalocean.
Tips: You can choose a vps server ubuntu with the cheapest price, it is easy to upgrade when you need better performance.
And then I edit DNS of domain to link to vultr vps server

link domain to vps server

I’m working on my localhost. So I can edit the host file of my computer to link a domain to my localhost

edit host to link domain

link domain to localhost

Configure a virtual host to add new domain

The virtual host of apache2 is in folder /etc/apache2/sites-available. We can check by using ssh command line sudo ls -l /etc/apache2/sites-available

sites available apache2

Now, we will create a new file magento1.conf to add new domain named sudo nano /etc/apache2/sites-available/magento1.conf
And insert the source code

<Directory /home/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/
        ErrorLog /home/

Now, we need to create folders /home/ and /home/ by using command line sudo mkdir -p /home/{public_html,logs}

create root folder website

Then we can enable the site magento1.conf and reload apache2 server by using command line sudo a2ensite magento1.conf and sudo systemctl reload apache2

a2ensite apache2 to enable virtual host

How to install magento on ubuntu server

Download the magento resource and sample data from and upload them to the folder /home/
Now, you can go that folder and check the source code again cd /home/ and sudo ls -l

upload magento resource to server

Unzip the source code by using command line unzip and unzip
Move magento resource from folder by command line mv -f magento/* ./ and cp -rf ./magento-sample-data-* ./
Tips: you can use command line sudo apt install unzip to install Zip for your server.

root folder website magento 1

Use ssh command line or phpmyadmin to create a database for your website sudo mysql -u root -p to login mysql and then create database named magento1 create database magento1; and create mysql user named magento1 with full permission on database magento1 grant all on magento1.* identified by "magento1";

mysql create database

Now you can import file magento_sample_data_for_1.9.2.4.sql to database magento1 by using mysql command use magento1; and source magento_sample_data_for_1.9.2.4.sql;

mysql import database

You can open the browser and visit url to install the magento website

install magento ubuntu vps

Tips: sudo apt-get install php5.6-curl to install PHP extension “curl”
sudo apt-get install php5.6-soap to install PHP extension “soap”
sudo apt-get install php5.6-gd to install PHP extension “gd”
sudo apt-get install php5.6-xml to install PHP extension “xml”
sudo apt-get install php5.6-mbstring to install PHP extension “mbstring”
sudo apt-get install php5.6-intl to install PHP extension “intl”

How to deploy a website on ubuntu vps server
5 (100%) 2 votes

Leave a Reply

Your email address will not be published. Required fields are marked *