In this
article we learn what is Magento and how to install Magento(Community Edition)
on centos server.
What is Magento?
Magento is
free and open source e-commerce platform and magento is written in PHP
language. Magento is fully customizable and we can use mariadb database for its
database. In this tutorial we install Magento Community Edition with the LAMP
stack.
Installation of Apache web server
To install
apache web server on the centos server we need to execute the below command.
[root@localhost
~]# yum install httpd –y
And after
installing the apache service we need to start and enable this service using
this below command.
[root@localhost ~]#systemctl
start httpd
[root@localhost ~]#systemctl
enable httpd
After starting this service we need
to allow http and https service in the firewall. To do this we need to execute
the below command.
[root@localhost ~]#firewall-cmd
–permanent –add-service=http
[root@localhost ~]#firewall-cmd
–permanent –add-service=https
[root@localhost ~]#firewall-cmd
–reload
Installation of PHP 7 on CentOS server
To install Magento we need php version
5.6 to 7 . But in the default repo available package is 5.4. to install PHP 7
we need to install EPEL and remi repo. To do this we need to execute the below
commands.
[root@localhost ~]#yum
install epel-release yum-utils –y
[root@localhost ~]#yum
install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
[root@localhost
~]#yum-config-manager --enable remi-php70
Recommended Read: https://techrideradmin.blogspot.com/2019/01/how-to-install-php-7-on-centos-7-server-step-by-step-guide.html
After doing the above steps we need
to execute the below command.
[root@localhost ~]#
yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl
php-mysql –y
Now open /etc/php.ini file and
modify the time zone.
To check the php details using web
browser we need to do the following steps.
[root@localhost ~]# echo
"<?php phpinfo(); ?>" > /var/www/html/info.php
Now restart the httpd service and browse the below url.
now
now
How to install Magento on CentOS 7 step by step guide
Installation of Mariadb database on centos server
To install
mariadb server we need to create mariadb repo file(mariadb.repo) and add these
below lines.
[mariadb]
name = MariaDB
baseurl =
http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
To install mariadb database using
the below command.
[root@localhost ~]#
yum install mariadb-server mariadb
After install tha mariadb we need to
start mariadb service and secure the maiadb database using the below steps.
#mysql_secure_installation
NOTE:
RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order
to log into MariaDB to secure it, we'll need the current
password
for the root user. If you've just
installed MariaDB, and
you
haven't set the root password yet, the password will be blank,
so you
should just press enter here.
Enter
current password for root (enter for none):
OK,
successfully used password, moving on...
Setting
the root password ensures that nobody can log into the MariaDB
root
user without the proper authorisation.
Set root
password? [Y/n] y
New
password:
Re-enter
new password:
Password
updated successfully!
Reloading
privilege tables..
... Success!
By
default, a MariaDB installation has an anonymous user, allowing anyone
to log
into MariaDB without having to have a user account created for
them. This is intended only for testing, and to
make the installation
go a bit
smoother. You should remove them before
moving into a
production
environment.
Remove
anonymous users? [Y/n] y
... Success!
Normally,
root should only be allowed to connect from 'localhost'. This
ensures
that someone cannot guess at the root password from the network.
Disallow
root login remotely? [Y/n] y
... Success!
By
default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and
should be removed
before
moving into a production environment.
Remove
test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading
the privilege tables will ensure that all changes made so far
will
take effect immediately.
Reload
privilege tables now? [Y/n] y
... Success!
Cleaning
up...
All
done! If you've completed all of the
above steps, your MariaDB
installation
should now be secure.
Thanks
for using MariaDB!
After that restart the service using
the below command.
#systemctl restart
mariadb
Now create the magento database and
user using the below steps.
# mysql -u root -p
mysql> create
database magento;
mysql> CREATE USER
magento@localhost IDENTIFIED BY "magento";
mysql> GRANT ALL ON
magento.* TO magento@localhost;
mysql> FLUSH
PRIVILEGES;
mysql> exit
Install methods Magento on centos server.
Now download the latest community
package from the magento official site and extract this package on the “/var/www/html”
directory.
#tar -xvzf <magento package> -C /var/www/html
After doing the above steps we need
to change the ownership as below.
#chown –R apache:apache
/var/www/html.
Now access the url (http:// server-ip)
to do the final installation setup.
Awesome Post!. If you like to see some more detailed installation steps of Magento2 on Centos 7 or more version . Just click the below link: If you like keep sharing
ReplyDeletehttps://www.linuxteck.com/how-to-install-magento-2-2-on-rhel-centos-7-6/