How to Install Prestashop with Apache2 + MySQl 5.5 + PHP 5.5 on Ubuntu Server 14.04


Prestashop is an free and open source shopping cart which has many features that make it compatible with any web server (Apache, NginX and Microsoft IIS). It is well know for its vast collection of themes as well as custom store design. Multiple payment gateways can be integrated which makes it reliable and secured. It is fully supported with SSL certificates.

Prestashop supports more than 65 languages which keeps the e-commerce site to more flexible. It has about 3,500+ free and paid modules that has multiple functionalities.

In this tutorial, we will cover How to Install Prestashop with LAMP (Linux, Apache, MySQL, PHP) server on Ubuntu Server 14.04.


Before you begin with this tutorial, you should have a separate, non-root user account set up on your server. You can find out the tutorial how to create a user with sudo privileges by following steps 1 – 4 in the Initial server setup for Ubuntu Server 14.04

Once you have fulfilled the above requirements, continue on with the following guide.

Step 1 – Set Up LAMP Server for Prestashop

Before get the prestashop files and install them into your web directory. You need to have Linux, Apache, PHP, and MySQL (LAMP) installed and configured on your server.

Install Apache, MySql and PHP5

Make sure your package repositories and installed programs are up to date by issuing the following commands:

sudo apt-get update
sudo apt-get upgrade

Install Apache, PHP, MySQL package and PHP modules that will be needed by the Prestashop installation.

sudo apt-get install lamp-server^ php5-curl php5-gd php5-mcrypt php5-memcache

During the installation, you’ll be asked to setup the MySQL root user password. This is an administrative account in MySQL that has increased privileges, Enter the password and select `OK`.

Now, Enable module php5-mcrypt by typing the following command:

sudo php5enmod mcrypt

Edit PHP configuration file

We will also be making a few small tweaks to our PHP configuration file. These are recommended by the Prestashop. Open and edit the Apache PHP configuration file /etc/php5/apache2/php.ini with sudo privileges in your text editor

sudo nano /etc/php5/apache2/php.ini

Then add/modify the following lines:

memory_limit = 128M
upload_max_filesize = 16M
max_execution_time = 60
file_uploads = On
allow_url_fopen = On
magic_quotes_gpc = Off
register_globals = Off

When you are finished, press CTRL+O to save then press CTRL+X to Exit.

Changing the Default Directory Index Page

By default, apache load index page html script called index.html. Now, we will make PHP script called index.php first load in apache web server. You can do this by editing file dir.conf, it is located on directory /etc/apache2/mods-enabled/:

sudo nano /etc/apache2/mods-enabled/dir.conf

It will look like this:

<IfModule mod_dir.c>
 DirectoryIndex index.html index.cgi index.php index.xhtml index.htm

Move the index.php file to first position:

<IfModule mod_dir.c>
 DirectoryIndex index.php index.html index.cgi index.xhtml index.htm

When you are finished, press CTRL+O to save then press CTRL+X to Exit.

Improve MySQL Installation Security

The following command is initializes the MySQL data directory and creates the system tables that it contains, if they do not exist.

sudo mysql_install_db

Securing MySQL installation by running the following command:

sudo mysql_secure_installation

After execute the command above, it will be ask you to enter the password for the MySQL root account. Next, it will ask you if you want to change that password. If you are happy with your current password, type `n` for `no`. It also ask you to remove some sample users and databases, disable remote root logins, and load these new rules so that MySQL immediately respects the changes you have made.

Restart the Apache and MySQL Server

Restart apache and mysql service so that all of the changes take effect :

sudo service apache2 restart && sudo service mysql restart

Step 2 – Create MySQL User and Database for Prestashop

Log into the MySQL Shell as root:

mysql -u root -p

Once Successful login to the MySQL Shell. Now, create database for prestashop. In this tutorial, We will call our database `dbprestashop`. Feel free to give it whatever name you choose

CREATE DATABASE dbprestashop;

Next, you need to create a user that the Prestashop application can use to connect to the database. In this tutorial, we’ll call our user prestauser

CREATE USER prestauser@localhost IDENTIFIED BY 'prestashoppsswd';

Now, you have a database and a user for prestashop installation, but these two components have no relationship yet. The user has no access to the database.

Fix it by granting the user account access to your database with the following command:

GRANT ALL PRIVILEGES ON dbprestashop.* TO prestauser@localhost;

Now the user has access to the database. We need to flush the privileges to tell mysql to reload the user table. Then sign out from MySQL shell.


Step 3 – Download Stable Version of Prestashop

Next, download the stable version of prestashop installation files from the prestashop official site. Currently, stable version of prestashop available in version Download it with following command:


Now, Extract with command unzip. If you don’t have unzip package installed on your server, install it by entering the command:

sudo apt-get install unzip

Extract prestashop archieve:


This will create a directory called prestashop in your home directory.

Step 4 – Copy Prestashop File to Apache Root Directory

In this step, you need to copy prestashop installation into apache’s root directory, where it can be served to visitors of our website. The directory of the apache document root is /var/www/html/. Use rsync command to transferring files from directory to directory. You can transfer prestashop installation files by typing:

sudo rsync -avP ~/prestashop/ /var/www/html/

Step 5 – Set Ownership and Permission Prestashop Installation File

Next, you need to change the group ownership of prestashop installation files for increased security. The group ownership that will give to web server process, which is www-data. This will allow Apache to interact with the content as necessary.

In this guide, we will use the same username that used in tutorial initial setup for ubuntu server 14.04, which called “ubuntu“. First, you should ensure that your username is included in www-data group

sudo usermod -aG www-data ubuntu
sudo chown -R ubuntu:www-data /var/www/html/*

Find all directories in /var/www/html/ and set their permissions to 755

sudo find /var/www/html/ -type d -exec chmod 775 {} \;

Do it again, but for files and set to 644

sudo find /var/www/html/ -type f -exec chmod 644 {} \;

Step 6 – Install Prestshop Through Web Browser

Now, you can complete prestashop installation through web browser on your computer. Open your favorite web browser, then navigate to your server’s domain name or public IP address:

Select your language and hit the `Next` button

Prestashop Installation - Step 1 - Select language

Check list License Agreements – click `Next`

Prestashop Installation - Step 2 - License Agreement

On this page, you need the fill out the information for your prestashop site and the administrative user account

prestashop installation - Step 3

Configure database for prestashop site by fill out the database information that created in `Step 2`

Prestashop Installation - Step 4 - Configure Database

Prestshop installation is finish.

Prestashop Installation - Step 5

Prestashop Installation - Step 6

Now you can access prestashop front office by clicking Discover your store. Click Manage your store to access prestashop dashboard.

PrestaShop Site

For security reason, Prestashop not permitted to acccess prestashop dashboard until you have deleted the /install folder and renamed the /admin folder.

PrestaShop Site - Admin login

You can Rename /install folder and renamed the /admin folder by typing command:

sudo rm -rf /var/www/html/install
sudo mv /var/www/html/admin/ /var/www/html/admin353jccgjg

Now you can access prestashop back office by typing address http://your_domain/admin353jccgjg. It should appear like this:

PrestaShop Site Dashboard
Step 7 – Additional Setting – Set URL Friendly

Enable apache module rewrite

sudo a2enmod rewrite

Edit file 000-default.conf

sudo nano /etc/apache2/sites-available/000-default.conf

On section <Directory “/var/www/html”> add line AllowOverride All

<Directory "/var/www/html">
 AllowOverride All

Create file .httacces and robot.txt

sudo touch /var/www/html/.htaccess
sudo touch /var/www/html/robot.txt

Change permission file .httacces and robot.txt to 666

sudo chmod 666 /var/www/html/.htaccess
sudo chmod 666 /var/www/html/robot.txt

Change ownership file .httacces and robot.txt to user:www-data

sudo chown ubuntu:www-data /var/www/html/.htaccess
sudo chown ubuntu:www-data /var/www/html/robot.txt

Back to prestashop dashboard, navigate to Preferences -> SEO & URLs, Set yes on “Friendly URL”

Urls Friendly Prestashop


In this guide, you should now have a prestashop instance up and running on your Ubuntu Server 14.04. Prestashop is simple, easy to use, dynamic, growing, and in-vogue ecommerce CMS that realizes and delivers on the expectations of enterprising web ecommerce ventures.

Note : This tutorial has been tested in VPS Digital Ocean and work great.

Tags: #Apache2 #Ecommerce #LAMP #MySQL #PHP #Prestashop #Ubuntu Server 14.04

How to Upgrade Ubuntu Server 12.04 to Ubuntu Server 14.04 LTS
How to Upgrade Ubuntu Server 12.04 to Ubuntu Server 14.04 LTS
This tutorial will describes how to upgrade
Must read×