How to Install PrestaShop on Windows WSL

This tutorial will teach you how to install PrestaShop. PrestaShop is an eCommerce platform that helps you create and run an online store. You’ll be setting it up on Windows 10 using WSL (Windows Subsystem for Linux) 2 with Ubuntu.

Why Install PrestaShop on Windows WSL?

PrestaShop is an eCommerce solution with all the features you need to create an online store and grow your business. Installing PrestaShop on Windows with Windows Subsystem for Linux lets you create your online store in your own environment with your own servers.

WSL allows you to run a complete Linux operating system inside Windows. This means you can use powerful Linux tools to build and run your online store on your Windows computer. WSL 2 also gives you better performance and works with Linux system calls, making it a great way to run Linux on Windows.

What You Need

Make sure your computer can run WSL 2 before starting. You’ll need Windows 10 version 2004 or newer.

Step 1: Turn On WSL in Windows

⚙️ Requires Admin Privileges

First, you need to enable WSL in Windows. Open the PowerShell terminal as an administrator. Click the Start button and type PowerShell.

Right-click on Windows PowerShell and select “Run as administrator.”

PowerShell running as administrator for WSL installation

When the window opens, run this command:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

You should see a success message like this:

Deployment Image Servicing and Management tool
Version: 10.0.19041.844

Image Version: 10.0.19042.844

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

Step 2: Turn On Virtual Machine Platform

⚙️ Requires Admin Privileges

WSL 2 needs the Virtual Machine Platform feature turned on. This is different from Hyper-V. Run this command in the same PowerShell window:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

If you’re using Windows 10 version older than 2004, use this command instead:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart

After running the commands, restart your computer so the changes take effect. If you don’t restart, the next command might not work.

After restarting, open PowerShell as administrator again. Then run this command to set WSL 2 as the default version:

wsl --set-default-version 2

Step 3: Install Ubuntu on Windows

Now that WSL 2 is ready, download and install Ubuntu 20.04 from the Windows Store using this link:

Get Ubuntu 20.04 LTS – Microsoft Store

Ubuntu 20.04 LTS gives you access to Ubuntu Terminal and command line tools like bash, ssh, git, and apt.

Ubuntu installation on Windows WSL interface

Click the “Get” button to install Ubuntu. After installing, you can launch Ubuntu from WSL.

When you first launch Ubuntu, it will ask you to create a user account. This username doesn’t need to match your Windows username.

You’ll see a prompt like this:

Installing, this may take a few minutes.
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: systemuser
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

System information as of Mon Apr 12 17:57:37 CDT 2021

System load: 0.52 Processes: 7
Usage of /home: unknown Users logged in: 0
Memory usage: 26% IPv4 address for eth0: 192.168.1.100
Swap usage: 0%

1 update can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable

If you run into problems, try these troubleshooting commands:

wsl --set-default-version 1
bcdedit /set hypervisorlaunchtype auto start

Step 4: Install Apache Web Server

⚙️ Requires Admin Privileges

Apache is the most popular web server on the internet. PrestaShop needs it to work. Run these commands to install Apache on Ubuntu:

sudo apt update
sudo apt install apache2

After installing, you can use these commands to control Apache:

sudo service apache2 stop
sudo service apache2 start
sudo service apache2 restart

To check that Apache is working, open your web browser and go to:

http://localhost

You should see an Apache test page.

LAMP stack setup on Windows WSL with Ubuntu

Step 5: Install MariaDB Database Server

⚙️ Requires Admin Privileges

PrestaShop needs a database to store all your store information. MariaDB is a free, open-source database server that works great for this. Install it with this command:

sudo apt-get install mariadb-server mariadb-client

After installing, you can control MariaDB with these commands:

sudo service mysql stop
sudo service mysql start
sudo service mysql restart

Next, secure your database with a root password by running this command:

sudo mysql_secure_installation

Answer the questions as shown below:

Enter current password for root (enter for none): Press Enter
Set root password? [Y/n]: Type Y
New password: Enter a password
Re-enter new password: Repeat the password
Remove anonymous users? [Y/n]: Type Y
Disallow root login remotely? [Y/n]: Type Y
Remove test database and access to it? [Y/n]: Type Y
Reload privilege tables now? [Y/n]: Type Y

To verify MariaDB is working, log in to the database with this command:

sudo mysql -u root -p

Enter your root password when asked. You should see a screen like this:

Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 46
Server version: 10.3.29-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>

Step 6: Install PHP and Modules

⚙️ Requires Admin Privileges

PHP is the programming language that makes PrestaShop work. Install PHP and the modules it needs:

sudo apt install php libapache2-mod-php php-imagick php-imap php-json php-ldap php-common php-pgsql php-ssh2 php-sqlite3 php-xml php-mysql php-gmp php-curl php-intl php7.4-mbstring php-xmlrpc php-gd php-xml php-cli php-zip

To check that PHP is installed, run this command:

php -v

You should see something like this:

PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

To test PHP more thoroughly, create a test file. Run this command:

sudo nano /var/www/html/phpinfo.php

Type this content into the file:

<?php phpinfo( ); ?>

Save the file. Restart Apache and then open your browser to:

http://example.com/phpinfo.php

You’ll see the PHP information page.

Testing PHP on Windows WSL with LAMP setup

Step 7: Create a PrestaShop Database

⚙️ Requires Admin Privileges

Now you need to create a database for PrestaShop to use. Log into MariaDB:

sudo mysql -u root -p

Create a database called prestashop:

CREATE DATABASE prestashop;

Create a database user:

CREATE USER 'prestashopuser'@'localhost' IDENTIFIED BY 'new_password_here';

Give that user full access to the PrestaShop database:

GRANT ALL ON prestashop.* TO 'prestashopuser'@'localhost' WITH GRANT OPTION;

Save your changes and exit:

FLUSH PRIVILEGES;
EXIT;

Step 8: Download PrestaShop

⚙️ Requires Admin Privileges

Download the latest version of PrestaShop. Check the PrestaShop download page to see what the newest version is.

wget https://assets.prestashop2.com/en/system/files/ps_releases/prestashop_1.7.7.4.zip -P /tmp
unzip prestashop_1.7.7.4.zip
sudo unzip /tmp/prestashop.zip -d /var/www/prestashop

Set the correct permissions so PrestaShop can work properly:

sudo chown -R www-data:www-data /var/www/prestashop/
sudo chmod -R 755 /var/www/prestashop/

Step 9: Set Up the PrestaShop Site Configuration

⚙️ Requires Admin Privileges

Create a configuration file for Apache so it knows how to display PrestaShop:

sudo nano /etc/apache2/sites-available/prestashop.conf

Copy and paste this content into the file. Replace “example.com” with your own domain name:

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/prestashop
ServerName example.com
ServerAlias www.example.com

<Directory /var/www/prestashop/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Save the file. Now enable the site by running these commands:

sudo a2ensite prestashop.conf
sudo a2enmod rewrite

Restart Apache to apply the changes:

sudo service apache2 restart

Step 10: Complete the PrestaShop Setup

Open your web browser and go to your domain or IP address:

http://example.com

The PrestaShop installation wizard will appear. Follow the steps to set up your store.

PrestaShop installation on Windows WSL with Apache

Enter your store information and create an admin account:

Apache configuration for PrestaShop on Windows WSL

Enter your database information:

Database connection setup for PrestaShop on WSL

After completing the setup, your store will be ready to use. Log in with the admin account you created and start building your online store!

PrestaShop dashboard view on Windows WSL

Summary

This tutorial walked you through installing PrestaShop on Windows using WSL 2 and Ubuntu. Here’s what you did:

  • Enabled WSL and Virtual Machine Platform in Windows
  • Installed Ubuntu 20.04 on your Windows computer
  • Installed Apache web server to serve your store
  • Installed MariaDB database to store your store data
  • Installed PHP and required modules to run PrestaShop
  • Created a database and user for PrestaShop
  • Downloaded and installed PrestaShop
  • Configured Apache to display your PrestaShop store
  • Completed the PrestaShop installation wizard

Your PrestaShop online store is now ready to use on your Windows computer!

Frequently Asked Questions

What is PrestaShop and why should I use it?

PrestaShop is an open-source eCommerce platform that provides all the necessary features to create and manage an online store. It is user-friendly and customizable, making it a popular choice for businesses looking to grow their online presence.

How do I enable WSL on Windows 10?

To enable WSL on Windows 10, open PowerShell as an administrator and run the command: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart. After running the command, restart your computer for the changes to take effect.

What are the system requirements for running WSL 2?

To run WSL 2, you need a Windows 10 version 2004 or higher, with virtualization enabled in the BIOS. Additionally, your machine should support the Virtual Machine Platform feature.

How can I install Ubuntu on Windows WSL?

You can install Ubuntu on Windows WSL by visiting the Microsoft Store, searching for 'Ubuntu 20.04 LTS', and clicking the 'Get' button to download and install it. Once installed, you can access the Ubuntu terminal and use Linux command line utilities.

What are the benefits of using WSL for PrestaShop installation?

Using WSL allows you to run a full Linux environment on your Windows machine, giving you access to powerful Linux tools and utilities. This setup enhances performance and compatibility, making it easier to develop and manage your PrestaShop store.

Categories:

,

Leave a Reply

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

Exit mobile version