Magento Installation on linux mint

The following diagram showa the overview of installing the Magento software:

And before the installation always check the official site ” https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html ” for knowing the versions of required software that is needed for magento installation.

Before you install Magento, you must do all of the following:

update and upgrade your operating system software

sudo apt-get update

sudo apt-get upgrade

  1. Install APACHE


a. sudo apt-get -y install apache2
b. Verfiy: apache2 -v
c. Enable the Apache rewrite module: a2enmod rewrite
d.As root, open /etc/apache2/sites-available/000-default.conf and add the following
at the end of the file.


e. Add the below content in between the virtualhost tag:

#Allow encoded slashes

AllowEncodedSlashes NoDecode

Restart: service apache2 restart

2. Install PHP 7.4
a. sudo apt update

b. sudo apt install php7.4 libapache2-mod-php7.4 php7.4-common php7.4-gmp php7.4-curl php7.4-soap php7.4-bcmath php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-mysql php7.4-gd php7.4-xml php7.4-cli php7.4-zip

c. php -v

D. Find the php configuration file: php –ini | grep “Loaded Configuration File”

In my case it was: /etc/php/7.4/cli/php.ini
e. Open the php.ini file and set the below:

Set date.timezone = “Asia/Kolkata

Set memory_limit = 8G

Set realpath_cache_size = 10M

Set realpath_cache_ttl = 7200

f. Restart apache: service apache2 restart

3. Install mysql

1.sudo apt install -y mysql-server mysql-client

2.Start MySQL:

sudo service mysql start

3.Secure the installation:

sudo mysql_secure_installation

VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin?
Choose strong and give strong password 

4.Install JDK (for elastic search)

a. sudo apt-get -y update
b. sudo apt-get install -y openjdk-8-jdk
c. Verify the installation with: java -version
d. Install gedit: sudo apt-get install gedit
e. Set JAVA_HOME: sudo gedit /etc/enviornment
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/f.
f. After setting JAVA_HOME, type in: $echo JAVA_HOME

5.Install Elastic Search

a. sudo curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key
add –
b. echo “deb https://artifacts.elastic.co/packages/7.x/apt stable main” | sudo tee -a
/etc/apt/sources.list.d/elastic-7.x.list
c. sudo apt install elasticsearch
d. Edit the elasticsearch configuration file:
i.
sudo gedit /etc/elasticsearch/elasticsearch.yml
ii.
Remove the ‘#’ before cluster.name
iii.
Remove the ‘#’ (UNCOMMENT) before node.name, and set to any name
you like, in my case magecomp4
iv.
Add network.publish_host: localhost under path.logs
v.
Set discovery.seed_hosts = [] (empty array)
vi.
Set network.host: 127.0.0.1
vii.
Remove the ‘#’ (UNCOMMENT) before http.port
viii.
Find cluster.initial_master_nodes, uncomment and set to 127.0.0.1
e. Start elastic search: sudo systemctl start elasticsearch (IMPORTANT: You
need to start the elasticsearch every time before installing/running
magento)
f. Check status: sudo systemctl status elasticsearch

6. Create a magento account

a. Create an account in https://marketplace.magento.com/
b. Go to my profile> Access key
c. Create access key
d. The access key will be used to access the repo when you create a project. Public
key will be used as user name and Private key as password

7 Install Composer

a. sudo curl -sS https://getcomposer.org/installer | php
b. sudo mv composer.phar /usr/local/bin/composer (For making composer available
globally)
c. Note: When we create a project using the latest version of composer i.e. v2, we
get an error: You are using Composer 2, which some of your plugins seem to be
incompatible with
d. To resolve this error use : sudo composer self-update 1.10.9

8. Create a new project

a. Using root access go to /var/www/html and create a folder> magento2
b. Open the folder> right click and open terminal
c. Command: composer create-project –repository-url=https://repo.magento.com/magento/project-community-edition
d. Use the access keys created from step 7, enter when promptede. Cut everything from project-community-edition folder to the main folder (in my
case it’s magento2)
f. Set permissions sudo chmod -R 777 ./
g. Create DB echo “CREATE DATABASE magento240” | mysql -u root -p
h. Use below command for installation, you may change it according to your setting:
php bin/magento setup:install –base-url=”http://127.0.0.1/magento2/”
–db-host=”localhost” –db-name=”magento240″ –db-user=”root”
–db-password=”12345678″ –admin-firstname=”admin”
–admin-lastname=”admin” –admin-email=”admin@admin.com”
–admin-user=”admin” –admin-password=”admin” –language=”en_US”
–currency=”USD” –timezone=”Asia/Kolkata” –use-rewrites=”1″
–backend-frontname=”admin”

i. Once again set permissions: sudo chmod -R 777 ./
j. Finally run the below commands:
sudo php -dmemory_limit=-1 bin/magento module:disable
Magento_TwoFactorAuth
sudo php -dmemory_limit=-1 bin/magento setup:upgrade
sudo php -dmemory_limit=-1 bin/magento setup:static-content:deploy -f
sudo php -dmemory_limit=-1 bin/magento indexer:reindex
sudo php -dmemory_limit=-1 bin/magento cache:clean
sudo php -dmemory_limit=-1 bin/magento cache:flush
php bin/magento deploy:mode:set developer
.

Leave a comment

Your email address will not be published. Required fields are marked *