How to Install Magento Open Source on Arch Linux
In this tutorial, we will guide you through the process of installing Magento Open Source on Arch Linux.
Prerequisites
Before we start the installation process, make sure that you have the following:
- A running Arch Linux system with root access.
- A web server like Apache or Nginx installed and configured.
- PHP version 7.4 or higher installed on your system with required PHP extensions.
- MySQL or MariaDB database server with a user and database created for Magento.
Step 1: Install Composer
Magento 2 is built using the Composer package manager, so first, we need to install Composer on the Linux system by running these commands:
$ cd /tmp
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
Verify the installation of composer with the following command:
$ composer -V
Step 2: Download Magento via GitHub
In this step, we will download the latest version of Magento Open Source via GitHub.
$ cd /var/www/
$ git clone https://github.com/magento/magento2.git
Change the directory to the Magento root and execute the Composer installation commands which will download and install Magento's dependencies:
$ cd /var/www/magento2/
$ composer install
Step 3: Install Magento
After downloading the package and installing dependencies, it's time to install Magento on your Linux system. To start the installation process, follow the below steps:
- Set file permission to your required users
$ find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
- Change the directory to the Magento root and install the software
$ bin/magento setup:install --base-url=http://<your-domain> \
--db-host=localhost --db-name=<db_name> \
--db-user=<db_user> --db-password=<db_password> \
--admin-firstname=<first_name> --admin-lastname=<last_name> \
--admin-email=<your_email> --admin-user=<username> \
--admin-password=<password> --language=en_US \
--currency=USD --timezone=America/Chicago \
--use-rewrites=1 --backend-frontname=admin
Step 4: Configure Apache Web Server
Now the installation is complete, but we need to configure the Apache webserver to host our Magento installation. Assuming that you already have an Apache webserver installed and running, follow the below steps to configure Apache for Magento:
- Create a new configuration file for Apache to point to your Magento installation:
$ nano /etc/httpd/conf.d/magento.conf
- Add the following Apache directives into the file:
<VirtualHost *:80>
ServerName your_domain.com
DocumentRoot /var/www/magento2
<Directory /var/www/magento2>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/httpd/magento-error.log
CustomLog /var/log/httpd/magento-access.log combined
</VirtualHost>
- Restart the Apache webserver:
$ systemctl restart httpd
Step 5: Access Your Magento Site
Now that the installation is complete and the Apache webserver is configured, go to your web browser and navigate to http://your_domain.com, and you should be able to see the Magento CMS welcome page.
Congratulations, you have successfully installed Magento Open Source on Arch Linux.