In this article we will show you how to install PrestaShop on an Ubuntu 16.04 server. Prestashop is an easy to use open source shopping cart application written in PHP used by website developers to build and run a successful online store.
In order to run PrestaShop on your Ubuntu 16.04 VPS, we need the following requirements met:
- Apache Web Server >= 2.0 compiled with mod_rewrite module, or Nginx
- MySQL 5.5 or later is recommended, or MariaDB installed on your Linux virtual server.
- PHP 5.4 or higher with the mcrypt, curl, gd, openssl, zip and pdo PHP extensions enabled. Optionally, you can install memcached PHP extension to improve PrestaShop performance.
- Full SSH root access or a user with sudo privileges is also required
Step 1: Log in via SSH on the Ubuntu server:
Log in to the VPS via SSH as user root
ssh roo@IP_Address -p Port_number
Step 2: Update all packages
Once you are logged, run the following command to make sure that all installed OS packages are up to date:
apt-get update apt-get upgrade
Step 3: Install Apache, MySQL (MariaDB) and PHP 7
Install Apache, MySQL (or MariaDB) and PHP 7 on your server using the following command:
apt-get install apache2 libapache2-mod-php mysql-server apt-get install php7.0-cli php7.0-common php7.0-curl php7.0-zip php7.0-gd php7.0-mysql php7.0-xml php7.0-mcrypt php7.0-mbstring php7.0-json php7.0-intl
Enable the Apache mod_rewrite module:
sudo a2enmod rewrite
Locate the PHP configuration file:
# php -i | grep -i php.ini Configuration File (php.ini) Path => /etc/php/7.0/cli Loaded Configuration File => /etc/php/7.0/cli/php.ini
Edit the PHP configuration file (/etc/php/7.0/cli/php.ini):
and modify the memory_limit value to 128MB or higher:
memory_limit = 128M
Also, set upload_max_filesize to 32 MB (or more):
upload_max_filesize = 32M
Restart the Apache web server for the changes to take effect:
sudo systemctl restart apache2
Step 4: Create a MySQL database for PrestaShop
Log into MySQL console with the root account:
mysql -u root -p
Now we will create a MySQL database for PrestaShop using the following query:
mysql> CREATE DATABASE prestashop;
Then, execute the following query to add a separate user for PrestaShop that will interact with the database:
mysql> GRANT ALL PRIVILEGES ON prestashop.* to 'prestashop'@'localhost' IDENTIFIED BY '5tr0ng_Pa55w0rd';
Do not forget to replace ‘5tr0ng_Pa55w0rd’ with an actual strong password.
Execute the following command to apply the privileges we set:
mysql> FLUSH PRIVILEGES;
Now we can exit the MySQL session:
Step 5: Install PrestaShop
Download the latest stable version of PrestaShop in the /opt directory on your server and extract it in the /var/www/html/ directory:
cd /opt wget https://download.prestashop.com/download/releases/prestashop_188.8.131.52.zip unzip prestashop_184.108.40.206.zip unzip prestashop.zip -d /var/www/html/prestashop/
Set the appropriate file permissions and ownership (www-data is the user of the Apache web server):
chown -R www-data:www-data /var/www/html/prestashop/
Step 6: Configure Apache to serve PrestaShop
Now we will have to setup the Apache configuration so it can serve the PrestaShop directory, add the following contents below to the /etc/apache2/sites-available/prestashop.conf file with nano or your favorite editor:
sudo nano /etc/apache2/sites-available/prestashop.conf
Add the following lines:
Require all granted
CustomLog /var/log/apache2/prestashop-access_log common
Enable the Apache PrestaShop configuration:
sudo a2ensite prestashop.conf
Remove the default Apache configuration file:
Now restart the Apache web server:
sudo systemctl restart apache2
Open your favorite web browser and type in the following URL to access the PrestaShop web interface and start the setup:
From here you can finish the setup by selecting the installation language and entering the information about your PrestaShop store. Then, create an administrator account and enter the following information to configure the database:
Database server address: 127.0.0.1
Database name: prestashop
Database login: prestashop
Database password: enter the MySQL password for the prestashop MySQL user.
For security reason, you must delete the ‘install’ directory:
rm -rf /var/www/html/prestashop/install/
Once you deleted the installation directory, log in to the PrestaShop back-end by clicking on the ‘Manage your store’ button.
Congratulations! PrestaShop has been successfully installed on your server. You can now start using PrestaShop and customize it according to your needs.
Of course, you don’t have to install PrestaShop on Ubuntu 16.04, if you use one of our Outsourced Server Support Services, in which case you can simply ask our expert system administrators to install PrestaShop on Ubuntu 16.04 for you, using the LAMP stack or any other web hosting stack of your choice. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on how to install PrestaShop on Ubuntu 16.04, please share it with your friends on the social networks using the buttons below or simply leave a comment in the comments section. Thanks.