ssh root@IP_ADDRESS -p PORT_NUMBER<\/code><\/p>\nMake sure to replace “IP_ADDRESS” and “PORT_NUMBER” with your server’s IP (required) and Port number (if not the default).<\/p>\n
Next, run the following commands to upgrade all installed packages on your VPS:<\/p>\n
dnf update -y<\/code><\/p>\nBy default, SELinux is enabled in CentOS 8 system. This can often cause conflicts and programs to stop working without any clear reason as to why, so it is recommended to disable SELinux on your system to ensure smooth functionality.<\/p>\n
You can disable the SELinux by editing \/etc\/selinux\/config<\/code> file:<\/p>\nnano \/etc\/selinux\/config<\/code><\/p>\nFind the following line:<\/p>\n
SELINUX=enforcing<\/code><\/p>\nAnd, replace it with the following line:<\/p>\n
SELINUX=permissive<\/code><\/p>\nSave and close the file. Then, restart your system to apply the changes.<\/p>\n
<\/span>Installing and Setting up Apache, MariaDB and PHP<\/span><\/h2>\nIn order for Magento to work, it requires a few prerequisite software packages. Apache provides the web server that serves the content, MariaDB is the database server that stores the data, and PHP is the programming language used to run the store.<\/p>\n
First, install the Apache webserver and MariaDB with the following command:<\/p>\n
dnf install httpd mariadb-server -y<\/code><\/p>\nThe latest version of Magento is only compatible with PHP 7.1.3+<\/strong> and 7.2.x<\/strong>. So you will need to install the supported PHP versions with required PHP extensions. By default, CentOS 8 ships with PHP version 7.2. This means that we won’t be needing a third-party repository in order to install PHP. \u00a0Therefore, you can simply install the required PHP version with all dependencies using the following command:<\/p>\ndnf install php php-cli php-mysqlnd php-opcache php-xml php-gd php-soap php-pdo php-bcmath php-intl php-mbstring php-json php-iconv php-zip unzip git -y<\/code><\/p>\nOnce all the packages are installed, edit the php.ini<\/code> file and tweak some settings:<\/p>\nnano \/etc\/php.ini<\/code><\/p>\nChange the following values:<\/p>\n
memory_limit = 1024M
\nupload_max_filesize = 256M
\nzlib.output_compression = on
\nmax_execution_time = 18000
\ndate.timezone = UTC
\n<\/code>
\nSave and close the file then start the Apache and MariaDB service and enable them to start at boot with the following command:<\/p>\nsystemctl start httpd
\nsystemctl start mariadb
\nsystemctl enable httpd
\nsystemctl enable mariadb<\/code><\/p>\nAt this point, the LAMP server is installed on your server.<\/p>\n
<\/span>Create a Database for Magento<\/span><\/h2>\nFirst, secure the MariaDB installation and set the MariaDB root password with the following command:<\/p>\n
mysql_secure_installation<\/code><\/p>\nA set of prompts will appear – this is how we answered all the questions, as shown below:<\/p>\n
Enter current password for root (enter for none):
\nSet root password? [Y\/n] Y
\nNew password:
\nRe-enter new password:
\nRemove anonymous users? [Y\/n] Y
\nDisallow root login remotely? [Y\/n] Y
\nRemove test database and access to it? [Y\/n] Y
\nReload privilege tables now? [Y\/n] Y
\n<\/code>
\nOnce the MariaDB is secured, log in to the MariaDB using the following command:<\/p>\nmysql -u root -p<\/code><\/p>\nProvide your MariaDB root password then create a database and user for Magento with the following command:<\/p>\n
MariaDB [(none)]> CREATE DATABASE magento2;
\nMariaDB [(none)]> CREATE USER 'magento'@'localhost' IDENTIFIED BY 'password<\/span>';<\/code><\/p>\nMake sure to REPLACE ‘password<\/span>‘ with a SECURE password.<\/p>\nNext, grant all the privileges to the Magento database with the following command:<\/p>\n
MariaDB [(none)]> GRANT ALL ON magento2.* TO 'magento'@'localhost' IDENTIFIED BY 'password<\/span>' WITH GRANT OPTION;<\/code><\/p>\nNext, flush the privileges and exit from the MariaDB with the following command:<\/p>\n
MariaDB [(none)]> FLUSH PRIVILEGES;
\nMariaDB [(none)]> EXIT;<\/code><\/p>\n<\/span>Install Magento<\/span><\/h2>\nBefore starting, it is recommended to create a non-root system user for Magento instance.<\/p>\n
You can create a user called magento<\/code> and then add them to the Apache webserver group with the following command:<\/p>\nadduser magento
\nusermod -a -G apache magento<\/code><\/p>\nNext, you will also need to install Composer on your system. Composer allows you to install all of the required PHP libraries and dependencies for your Magento project through one simple package manager.<\/p>\n
You can install Composer with the following command:<\/p>\n
curl -sS https:\/\/getcomposer.org\/installer | php
\nmv composer.phar \/usr\/local\/bin\/composer<\/code><\/p>\nNext, download the latest version of Magento from its official website.<\/p>\n
Once the download is completed, unzip the downloaded file to the Apache web root directory with the following command. Note that the file name may be different for you, depending on the version that was downloaded:<\/p>\n
unzip magento-ce-2.3.5-p1_sample_data-2020-04-24-10-19-21.zip -d \/var\/www\/html\/magento2<\/code><\/p>\nNext, change the directory to magento2<\/code> and install all required PHP dependencies with the following command:<\/p>\ncd \/var\/www\/html\/magento2
\ncomposer install<\/code><\/p>\nNext, set proper ownership and permissions to the magento directory with the following command:<\/p>\n
chown -R magento:apache \/var\/www\/html\/magento2
\nchmod -R 775 \/var\/www\/html\/magento2<\/code><\/p>\n<\/span>Configure Apache for Magento<\/span><\/h2>\nNext, create an Apache virtual host configuration file for Magento with the following command:<\/p>\n
nano \/etc\/httpd\/conf.d\/magento.conf<\/code><\/p>\nAdd the following liens:<\/p>\n
<\/code><VirtualHost *:80>
\nServerAdmin admin@example.com
\nServerName magento.example.com
\nDocumentRoot \/var\/www\/html\/magento2\/
\nDirectoryIndex index.php
\n<Directory \/var\/www\/html\/magento2\/>
\nOptions Indexes FollowSymLinks MultiViews
\nAllowOverride All
\nOrder allow,deny
\nallow from all
\n<\/Directory>
\nErrorLog \/var\/log\/httpd\/magento_error.log
\nCustomLog \/var\/log\/httpd\/magento_access.log combined
\n<\/VirtualHost>
\n<\/code>
\nSave and close the file when you are finished. Then, restart the Apache service to implement the changes:<\/p>\nsystemctl restart httpd<\/code><\/p>\nAt this point, the Apache web server is configured to serve the Magento instance via HTTP.<\/p>\n
<\/span>Step 6 : Access Magento Web Interface<\/span><\/h2>\nNow, open your web browser and type the URL http:\/\/magento.example.com<\/code>. You will be redirected to the Magento welcome page:<\/p>\nClick on the Agree and Setup Magento<\/strong>. You should see the readiness check page:<\/p>\n<\/p>\n
Click on the Start Readiness Check<\/strong> to check for the correct PHP version, PHP extensions and file permissions. Once the readiness check has been completed successfully, you should see the following page:<\/p>\n<\/p>\n
Click on the Next<\/strong> button. You should see the Database configuration page:<\/p>\n<\/p>\n
Provide your Magento database name, database user, password and click on the Next<\/strong> button. You should see the Magento web configuration page:<\/p>\n<\/p>\n
Provide your Magento store and admin address and click on the Next<\/strong> button. You should see the following page:<\/p>\n<\/p>\n
Set your default time zone, currency, language and click on the Next<\/strong> button. You should see the Magento admin account creation page:<\/p>\n<\/p>\n
Provide your desired username, email, password and click on the Next<\/strong> button. You should see the following page:<\/p>\n<\/p>\n
Click on the Install<\/strong> Now<\/strong> button to start the installation. Once the installation has been completed successfully, you will see a Success page listing all the details of your Magento installation.<\/p>\nIMPORTANT:\u00a0<\/strong>Sometimes the installer page will stop showing new changes at around 91% even though the installation has completed. In this case, you can check the install log file at \/var\/www\/html\/magento2\/var\/log\/install.log<\/code>.<\/p>\ntail -f \/var\/www\/html\/magento2\/var\/log\/install.log<\/code><\/p>\nYou should see the following output:<\/p>\n
[SUCCESS]: Magento installation complete.
\n[SUCCESS]: Magento Admin URI: \/admin_1tez57
\n<\/code><\/p>\nNow, open your web browser and type the URL http:\/\/magento.example.com\/admin_1tez57<\/code>. You should see the Magento store admin login on the following page:<\/p>\n<\/p>\n
Provide your Magento admin username and password and click on the Sign<\/strong> In<\/strong> button. You should see the Magento 2 default dashboard in the following page:<\/p>\n<\/p>\n
You can also access your Magento store using the URL http:\/\/magento.example.com<\/code>. You should see the following page:<\/p>\n<\/p>\n