How to Install Magento Open Source on Clear Linux Latest
In this tutorial, we will guide you through the step-by-step process of installing Magento Open Source from https://github.com/magento/magento2 on Clear Linux Latest.
Before beginning with the installation, please ensure that your system meets the following minimum requirements:
- 2GB RAM
- 2.0 GHz x86-64 processor or higher
- 2 GB of available hard-disk space
- PHP 7.3 or 7.4 with the required modules
- MySQL 5.7 or higher
Let's get started!
Step 1: Install PHP and Required PHP Modules
To install PHP and the required PHP modules, follow these steps:
- Open a terminal window and log in as the root user.
su
- Install PHP and required modules.
swupd bundle-add php-basic php-mysql php-pdo php-json php-openssl php-curl php-mbstring unzip libxrender libxext libxslt libpng php-imagick
- To verify the installation, run:
php -v
This will display the version of PHP installed.
Step 2: Install MySQL
To install MySQL, do the following:
- Open a terminal window and log in as the root user.
su
- Install MySQL.
swupd bundle-add mysql
- Secure your MySQL installation.
mysql_secure_installation
- Follow the instructions to secure your MySQL installation.
Step 3: Download and Extract Magento
To download and extract Magento, follow these steps:
Open a terminal window.
Go to the directory where you want to install Magento.
cd /var/www/html/
- Download the Magento package from GitHub.
git clone https://github.com/magento/magento2.git
- Change into the Magento directory.
cd magento2
- Checkout the latest stable version.
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
- Install Composer.
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- Install Magento dependencies.
composer install
Step 4: Configure Magento
- Create a MySQL database and user for Magento.
mysql -u root -p
CREATE DATABASE magento;
CREATE USER 'magento'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';
FLUSH PRIVILEGES;
quit
- In the Magento root directory, copy the
env.php.distfile and rename it toenv.php.
cd /var/www/html/magento2
cp ./app/etc/env.php.dist ./app/etc/env.php
- Edit the
env.phpfile and add your MySQL credentials.
nano ./app/etc/env.php
Update section 'db' with the following:
'db' =>
array (
'table_prefix' => '',
'connection' =>
array (
'default' =>
array (
'host' => 'localhost',
'dbname' => 'magento',
'username' => 'magento',
'password' => 'password',
'active' => '1',
),
),
),
- Set file permissions.
cd /var/www/html/magento2
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+w {} +
chmod u+x bin/magento
Step 5: Install Magento
To install Magento, run the following command:
php bin/magento setup:install --base-url=http://localhost/ --db-name=magento --db-user=magento --db-password=password --backend-frontname=admin --admin-firstname=admin --admin-lastname=admin [email protected] --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1
This command will install Magento with the given configuration options.
Step 6: Finalize Magento Installation
After installing Magento, complete these final steps:
- Open your browser and go to your Magento installation page.
http://localhost or http://127.0.0.1
Enter the admin username and password you specified during the installation.
Click on the "Sign In" button.
Congratulations! Your Magento installation is complete.
Conclusion
In this tutorial, you learned how to install Magento Open Source on Clear Linux Latest. We hope this tutorial has been helpful to you. If you have any questions, please feel free to leave a comment below.