Jinsi ya kufunga Magento kwenye CentOS 7
Magento ni jukwaa la biashara huria lenye nguvu na linalonyumbulika sana (au mfumo wa usimamizi wa maudhui (CMS)) lililoandikwa katika PHP. Inasafirishwa katika matoleo mawili kuu: Biashara na toleo la Jumuiya. Toleo la Jumuiya linalenga wasanidi programu na biashara ndogo ndogo.
Inaweza kubinafsishwa ili kukidhi mahitaji ya watumiaji na kuwawezesha kusanidi na kudhibiti duka la Biashara ya mtandaoni linalofanya kazi kikamilifu kwa dakika chache. Magento huendesha kwenye seva za wavuti kama Apache, Nginx na IIS, hifadhidata za nyuma: MySQL au MariaDB, Percona.
Katika mwongozo huu, tutaonyesha jinsi ya kusakinisha Toleo la Jumuiya ya Magento kwenye CentOS 7 VPS yenye stack ya LAMP (Linux, Apache MariaDB na PHP). Maagizo sawa pia hufanya kazi kwenye usambazaji wa msingi wa RHEL na Fedora na mabadiliko kidogo katika amri.
Makala haya yatakuongoza kusakinisha toleo la hivi punde zaidi la \Toleo la Jumuiya la Magento kwenye mfumo unaoendesha:
- Toleo la Apache 2.2 au 2.4
- Toleo la PHP 5.6 au 7.0.x au matoleo mapya zaidi yenye viendelezi vinavyohitajika
- Toleo la 5.6 la MySQL au matoleo mapya zaidi
Kumbuka: Kwa usanidi huu, ninatumia jina la mpangishi wa tovuti kama \magneto-linux-console.net na anwani ya IP ni \192.168.0.106\.
Hatua ya 1: Kusakinisha Apache Web Server
1. Kusakinisha seva ya wavuti ya Apache ni rahisi sana, kutoka kwa hazina rasmi:
# yum install httpd
2. Kisha, ili kuruhusu ufikiaji wa huduma za Apache kutoka HTTP na HTTPS, inabidi tufungue bandari 80 na 443 ambapo daemoni ya HTTPD inasikiza kama ifuatavyo:
------------ On CentOS/RHEL 7 ------------ # firewall-cmd --permanent --zone=public --add-service=http # firewall-cmd --permanent --zone=public --add-service=https # firewall-cmd --reload ---------- On CentOS/RHEL 6 ---------- # iptables -A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT # iptables -A INPUT -p tcp -m state --state NEW --dport 443 -j ACCEPT # service iptables save
Hatua ya 2: Sakinisha Usaidizi wa PHP kwa Apache
Kama nilivyosema Magento inahitaji PHP 5.6 au 7.0 na hazina chaguo-msingi ya CentOS inajumuisha PHP 5.4, ambayo haiendani na toleo la hivi karibuni la Magento 2.
3. Ili kusakinisha PHP 7, unahitaji kuongeza hazina ya EPEL na IUS (Inline with Upstream Stable) ili kusakinisha PHP 7 kwa kutumia yum:
# yum install -y http://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-14.ius.centos7.noarch.rpm # yum -y update # yum -y install php70u php70u-pdo php70u-mysqlnd php70u-opcache php70u-xml php70u-mcrypt php70u-gd php70u-devel php70u-mysql php70u-intl php70u-mbstring php70u-bcmath php70u-json php70u-iconv
# yum -y update # yum -y install epel-release # wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm # wget https://centos6.iuscommunity.org/ius-release.rpm # rpm -Uvh ius-release*.rpm # yum -y update # yum -y install php70u php70u-pdo php70u-mysqlnd php70u-opcache php70u-xml php70u-mcrypt php70u-gd php70u-devel php70u-mysql php70u-intl php70u-mbstring php70u-bcmath php70u-json php70u-iconv
4. Kisha, fungua na urekebishe mipangilio ifuatayo katika faili yako ya /etc/php.ini
:
max_input_time = 30 memory_limit= 512M error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR error_log = /var/log/php/error.log date.timezone = Asia/Calcutta
Kumbuka: Thamani ya date.timezone
itatofautiana kulingana na saa za eneo la mifumo yako. Rejelea kuweka saa za eneo katika Linux.
5. Kisha, ili kupata maelezo kamili kuhusu usakinishaji wa PHP na usanidi wake wote wa sasa kutoka kwa kivinjari, hebu tuunde faili ya info.php
katika Apache DocumentRoot (/var/www/html) kwa kutumia amri ifuatayo.
# echo "<?php phpinfo(); ?>" > /var/www/html/info.php
6. Mara tu usanidi wote unaohitajika utakapokamilika, ni wakati wake wa kuanza huduma ya Apache na kuiwezesha kuanza kiotomatiki kutoka kwa mfumo unaofuata wa kuwasha na vile vile:
------------ On CentOS/RHEL 7 ------------ # systemctl start httpd # systemctl enable httpd ------------ On CentOS/RHEL 6 ------------ # service httpd start # chkconfig httpd on
7. Kisha, tunaweza kuthibitisha kwamba Apache na PHP zinafanya kazi vizuri; fungua kivinjari cha mbali na uandike Anwani ya IP ya seva yako kwa kutumia itifaki ya HTTP kwenye URL na ukurasa chaguo-msingi wa Apache2 na PHP unapaswa kuonekana.
http://server_domain_name_or_IP/ http://server_domain_name_or_IP/info.php
![](common-images/install-magento-on-centos-7/Check-PHP-7-Info.png)
Hatua ya 3: Sakinisha na Usanidi Hifadhidata ya MariaDB
8. Ni lazima tukumbuke kwamba Red Hat Enterprise Linux/CentOS 7.0 ilihama kutoka kwa kutumia MySQL hadi MariaDB kama mfumo chaguomsingi wa usimamizi wa hifadhidata.
Ili kusakinisha hifadhidata ya MariaDB, tunahitaji kuongeza hazina rasmi ifuatayo ya MariaDB ili faili /etc/yum.repos.d/MariaDB.repo kama inavyoonyeshwa.
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/rhel7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/rhel6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
9. Mara tu faili ya repo inapoundwa, sasa tunaweza kusakinisha MariaDB kama ifuatavyo:
# yum install mariadb-server mariadb OR # yum install MariaDB-server MariaDB-client
10. Baada ya usakinishaji wa vifurushi vya MariaDB kukamilika, anzisha daemoni ya hifadhidata kwa muda uliopangwa na uiwezeshe kuanza kiotomatiki kwenye buti inayofuata.
------------ On CentOS/RHEL 7 ------------ # systemctl start mariadb # systemctl enable mariadb ------------ On CentOS/RHEL 6 ------------ # service mysqld start # chkconfig mysqld on
11. Kisha endesha hati ya mysql_secure_installation ili kulinda hifadhidata (weka nenosiri la msingi, zima kuingia kwa mizizi ya mbali, ondoa hifadhidata ya majaribio na uondoe watumiaji wasiojulikana) kama ifuatavyo:
# mysql_secure_installation
12. Kisha unda hifadhidata ya magento na mtumiaji kama inavyoonyeshwa.
# mysql -u root -p ## Creating New User for Magento Database ## mysql> CREATE USER magento@localhost IDENTIFIED BY "your_password_here"; ## Create New Database ## mysql> create database magento; ## Grant Privileges to Database ## mysql> GRANT ALL ON magento.* TO magento@localhost; ## FLUSH privileges ## mysql> FLUSH PRIVILEGES; ## Exit ## mysql> exit
Hatua ya 4: Sakinisha Toleo la Jumuiya ya Magento
12. Sasa, nenda kwenye tovuti rasmi ya Magento, na uunde akaunti ya mtumiaji iwapo utakuwa mteja mpya.(au ingia tu ikiwa tayari una akaunti) na upakue toleo jipya zaidi la Toleo la Jumuiya ya Magento.
- http://www.magentocommerce.com/pakua
13. Baada ya kupakua faili ya Magento tar, toa yaliyomo kwenye Mizizi ya Hati ya Apache (/var/www/html) kama ifuatavyo:
# tar -zxvf Magento-CE-2.1.5-2017-02-20-05-36-16.tar.gz -C /var/www/html/
14. Sasa unahitaji kuweka umiliki wa Apache kwenye faili na folda.
# chown -R apache:apache /var/www/html/
15. Sasa fungua kivinjari chako na uende kwenye url ifuatayo, utawasilishwa na mchawi wa usakinishaji wa Magento.
http://server_domain_name_or_IP/
![](common-images/install-magento-on-centos-7/Magento-Installation-Wizard-1.png)
16. Kisha, mchawi atabeba Ukaguzi wa Utayari wa toleo sahihi la PHP, ruhusa za faili na uoanifu.
![](common-images/install-magento-on-centos-7/Magento-Readiness-Check.png)
![](common-images/install-magento-on-centos-7/Magento-Readiness-Check-Summary.png)
17. Ingiza mipangilio ya hifadhidata ya magento.
![](common-images/install-magento-on-centos-7/Magento-Database-Settings.png)
18. Usanidi wa Tovuti ya Magento.
![](common-images/install-magento-on-centos-7/Magento-Web-Configuration.png)
19. Geuza kuhifadhi yako ya Magento kukufaa kwa kuweka saa za eneo, sarafu na lugha.
![](common-images/install-magento-on-centos-7/Customize-Magento-Store.png)
20. Fungua akaunti mpya ya Msimamizi ili kudhibiti duka lako la Magento.
![](common-images/install-magento-on-centos-7/Create-Magento-Admin-Account.png)
21. Sasa bofya ‘Sakinisha Sasa’ ili kuendelea na usakinishaji wa Magento.
![](common-images/install-magento-on-centos-7/Install-Magento-Store.png)
![](common-images/install-magento-on-centos-7/Magento-Installation-Completes-1.png)
Ni hayo tu! umesakinisha Magento katika CentOS 7. Ikiwa utapata hitilafu yoyote wakati wa usakinishaji, jisikie huru kuomba usaidizi katika maoni.