PrestaShop is free open-source shopping cart software that you can use to run an e-commerce website. With its beautiful themes and wide support from developers, PrestaShop offers a great platform for selling products on the internet.
The mission of PrestaShop is to help people build successful online stores. It is estimated that more than a million users rely on this platform as their only e-commerce software.
Installing this software is quite easy if you are on a shared hosting because you can use automatic script installers. However, if you are on a VPS plan, the installation method is manual but straightforward.
In this guide, we will show you to install PrestaShop on your Ubuntu 18.04 server.
Prerequisites
- A VPS plan running Ubuntu 18.04 server
- A non-root user with sudo privileges
Reliability, up-time and security are always important, but even more so when running an e-commerce business. With HostAdvice you can find and compare the best VPS hosting services and top web hosting providers for small business, and read expert and user reviews on each provider.
Step 1: Update your system
Before you begin your installation, make sure that your system is up to date by running the command below:
$ sudo apt-get update && sudo apt-get upgrade
Step 2: Install Apache
Next, you need to install Apache web server by typing the following.
$ sudo apt-get install apache2 libapache2-mod-php
Step 3: Allow ‘.htaccess’ files to override Apache configuration settings
By default, apache installs a virtual host on an Ubuntu 18.04 server. We need to adjust the settings so that the virtual host configuration file can allow ‘.htaccess’ files to work. We will do this using a nano text editor by typing the command below:
$ sudo nano /etc/apache2/sites-available/000-default.conf
Then, paste the text below just before the </VirtualHost> closing tag
<Directory /var/www/html > AllowOverride All </Directory>
The last part for the configuration file should look like the image below:
Next, we need to enable the mod_rewrite Apache module for PrestaShop to work by typing:
$ sudo a2enmod rewrite
Then, restart apache
$ sudo systemctl restart apache2
Step 4: Install PHP
PrestaShop is written in PHP programming language. Therefore we need to install it on our Ubuntu 18.04 server by typing the following command:
$ sudo apt install php libapache2-mod-php
Then, we need to install some PHP extensions as shown below:
$ sudo apt-get install php-cli php-common php-mbstring php-gd php-intl php-xml php-mysql php-zip php-curl php-xmlrpc
Restart Apache one more time for PHP to work:
$ sudo systemctl restart apache2
Step 5: Install MariaDB
PrestaShop stores information on a MariaDB or MySQL database. To install, this relational database management system, type the command below:
$ sudo apt-get install mariadb-server
Next, we need to secure our MariaDB installation by running the command below:
$ sudo mysql_secure_installation
You will be asked a series of questions. Just choose the below options to proceed.
- Set root password? [Y/n] Y
- New password: Enter your password here
- Re-enter new password: repeat your password
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y
Create a MariaDB database and user
Once the MariaDB installation is complete, we need to create a database to store PrestaShop information and a username for authentication purposes.
So, log in to your MySQL server instance by typing the command below;
$ sudo mysql -u root -p
You will be prompted to enter your MariaDB root password that you created above when securing the installation. Then press Enter to proceed.
To create a database and a user, we need to type the below SQL command:
CREATE DATABASE prestashop; CREATE USER 'ps_user'@'localhost' IDENTIFIED BY 'PASSWORD'; GRANT ALL ON prestashop.* TO 'ps_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
Remember to replace ‘PASSWORD’ with a strong value.
Step 4: Download the latest PrestaShop software
We now have the right software applications to run PrestaShop. Next, download the latest PrestaShop software on the ‘/var/www/html’ directory using the commands below:
$ cd /var/www/html $ sudo wget https://download.prestashop.com/download/releases/prestashop_1.7.2.1.zip
Next, we unzip the ‘prestashop_1.7.2.1.zip’ file by typing:
$ sudo apt-get install unzip
$ sudo unzip prestashop_1.7.2.1.zip
Then we need to delete the default ‘index.html’ file created when Apache was first installed by typing the command below:
$ sudo rm /var/www/html/index.html
Step 5: Assign the right directory ownership
We can then type the commands below to enable PrestaShop to access and modify the right files:
$ sudo chown www-data: /var/www/html/
$ sudo chmod -R 755 /var/www/html/
Step 6: Finalize the installation
You can now finalize your PrestaShop website installation by typing the public IP address associated with your Ubuntu 18.04 server on a browser. You will get a screen similar to the one below:
http://ip_address/
Click ‘Next’ to proceed on the bottom right side of the screen.
Accept the terms on the next screen and click ‘Next’:
The installation script will check whether your environment is compatible with PrestaShop as shown below. Then, click ‘Next‘ to proceed.
Next, enter your shop details as shown below and click ‘Next’:
Finally, enter the database details that you created above on the next screen and click next
If the details are correct and there are no errors your installation will be finished and you can now view or log on the admin section of your PrestaShop store.
Store Front
Conclusion
That’s all when it comes to installing PrestaShop on your Ubuntu 18.04 VPS server. Although we have used an IP address for the installation, you can run the setup using a domain name. Also, since you are dealing with sensitive data, you should consider installing an SSL certificate (.e.g. by configuring one from Let’s Encrypt website). I hope you enjoyed the guide.
Check out the top 3 Ecommerce hosting services:
- Want to avoid problems of shared hosting? Click here and know about the best dedicated servers hosting.