How to Install Magento Open Source on POP! OS Latest

In this tutorial, we will guide you step-by-step on how to install Magento Open Source on POP! OS Latest from the official GitHub repository. Magento Open Source is a powerful eCommerce platform for building online stores and managing them efficiently.

Prerequisites

To install Magento Open Source on POP! OS Latest, the following prerequisites must be fulfilled:

Step 1: Update and Upgrade POP! OS Latest

Before installing any applications, it is recommended to update and upgrade the system. We can do it by typing the following commands in the terminal:

sudo apt update && sudo apt upgrade -y

Step 2: Install Apache2 Web Server

To install the Apache2 web server, enter the following command in the terminal:

sudo apt install apache2 -y

Once the installation is complete, start the Apache2 service and enable it to start automatically after boot:

sudo systemctl start apache2
sudo systemctl enable apache2

Step 3: Install MySQL Database

To install the MySQL Database, we can install the MariaDB server that is compatible with MySQL. Enter the following command in the terminal:

sudo apt install mariadb-server -y

After the installation is complete, start the MariaDB service and enable it to start automatically after boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

For security reasons, we also need to run the MySQL secure installation script by entering the following command:

sudo mysql_secure_installation

Follow the prompts and set the root password, remove anonymous users, disallow root login remotely, remove the test database, and reload the privilege table.

Step 4: Install PHP

Magento requires PHP 7.4 or later. To install PHP and its necessary extensions, enter the following command in the terminal:

sudo apt install php7.4 php7.4-common php7.4-mysql php7.4-xml php7.4-curl php7.4-gd php7.4-zip php7.4-bcmath libapache2-mod-php7.4 -y

Once the installation is complete, restart the Apache2 service to load the new PHP modules:

sudo systemctl restart apache2

To verify the PHP installation and its version, create a PHP info page by entering the following commands:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo.php

Then access the PHP info page by visiting http://localhost/phpinfo.php in your web browser.

Step 5: Install Composer

Composer is a package manager for PHP that is needed for installing Magento Open Source. To install Composer, enter the following commands:

sudo apt install curl unzip -y 
sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Then verify the Composer installation by typing the following command:

composer -v

Step 6: Install Magento Open Source

We can now install Magento Open Source from their official GitHub repository by following these steps:

  1. Clone the latest version of Magento Open Source by entering the following command:

    git clone https://github.com/magento/magento2.git
    
  2. Navigate to the Magento directory by entering:

    cd magento2
    
  3. Install the required packages and dependencies by entering the following command:

    composer install
    
  4. Configure the Magento installation by creating the env.php file in the app/etc directory.

    cp app/etc/env.php.dist app/etc/env.php
    

    Then edit the env.php file and update the database configuration with your database username, password, and database name.

  5. Install Magento Open Source using the command:

    bin/magento setup:install --base-url=http://localhost/ --db-host=localhost --db-name=magento --db-user=root --db-password=your_password --admin-firstname=your_firstname --admin-lastname=your_lastname --admin-email=your_email --admin-user=admin --admin-password=your_password --language=en_US --currency=USD
    
  6. Finally, set the correct file permissions and ownership by entering:

    sudo chown -R www-data:www-data /var/www/html/magento2/
    sudo chmod -R 755 /var/www/html/magento2/
    

Step 7: Access Magento

Now that the installation is complete, you can access your Magento store by visiting http://localhost/ in your web browser.

Conclusion

In this tutorial, we have walked you through the steps to install Magento Open Source on POP! OS Latest from the official GitHub repository. Magento Open Source is a powerful e-commerce platform that allows you to build an online store and manage it efficiently. Make sure that you keep your Magento installation updated to ensure the highest level of security and performance.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!