How to Install FreeShop: A Comprehensive Guide

FreeShop is an open-source, self-hosted e-commerce platform that offers a robust and flexible solution for setting up your own online store. This guide will walk you through the process of installing FreeShop on your server, ensuring a smooth and secure setup.

Prerequisites
Before you begin, make sure you have the following prerequisites in place:

- A server with PHP 7.3 or later, MySQL 5.7 or later, and Composer installed.
- A domain name and an SSL certificate for secure communication (optional but recommended).
- Basic knowledge of the command line and file management.
Step-by-Step Installation

1. Download and Install FreeShop
First, download the latest version of FreeShop from the official GitHub repository: https://github.com/freeshop/freeshop
Once downloaded, extract the contents of the archive and upload the files to your server using an FTP client or the file manager provided by your hosting provider. Ensure that the files are uploaded to the desired location, such as the public directory of your domain.

Alternatively, you can clone the FreeShop repository directly onto your server using the command line:
git clone https://github.com/freeshop/freeshop.git /path/to/your/domain
2. Install Dependencies
FreeShop relies on several PHP packages to function properly. To install these dependencies, navigate to your FreeShop installation directory using the command line and run the following command:

composer install --no-dev --optimize-autoloader
The --no-dev flag ensures that development dependencies are not installed, and the --optimize-autoloader flag improves the performance of the autoloader.
3. Set Up the Database




















Create a new MySQL database and user for FreeShop. Make note of the database name, username, and password, as you will need them in the next step.
Once the database is created, run the following command to generate the necessary SQL files for FreeShop:
php bin/console doctrine:database:create
Then, import the SQL files into your database using a MySQL management tool like phpMyAdmin or the command line:
mysql -u your_username -p your_database < /path/to/your/database/sql/file.sql
4. Configure FreeShop
Create a new file named .env.local in the root directory of your FreeShop installation. This file will contain your database credentials and other configuration settings.
Add the following lines to the .env.local file, replacing the placeholders with your own values:
DATABASE_URL=mysql://your_username:your_password@127.0.0.1:3306/your_database
APP_ENV=prod
APP_SECRET=your_secret_key
Generate a random secret key for the APP_SECRET variable using the following command:
php bin/console security:encryption:generate-key
5. Migrate the Database
Now that your database is configured, run the following command to create the necessary tables and populate the database with default data:
php bin/console doctrine:migrations:migrate
6. Install FreeShop
Finally, install FreeShop by running the following command:
php bin/console freeshop:install
This command will generate the necessary files and folders for FreeShop to function properly.
7. Access Your FreeShop Installation
Once the installation is complete, you can access your FreeShop installation by visiting http://your_domain.com in your web browser. Log in using the default credentials (username: admin, password: admin) and begin setting up your online store.
Conclusion
Congratulations! You have successfully installed FreeShop on your server. This comprehensive guide has walked you through the process of downloading, installing, and configuring FreeShop, ensuring a smooth and secure setup. Now you can begin customizing your online store and start selling your products online.