|-转 6 Steps to Install Magento 2 on CentOS [Latest] - Sample Data
Step 1.4: Update php.ini file
Now time to increase values in php.ini file. Open php.ini file:
nano /etc/php.ini
Change the following data:
file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 512M
upload_max_filesize = 128M
max_execution_time = 3600
Then save this php.ini file.
After that, you should restart apache2. Run this command:
systemctl restart httpd
这里很重要,之前我命令行运行安装后一直报错:Could not validate a connection to Elasticsearch. No alive nodes found in your cluster,最后的原因是php分配的资源不够导致的。
另外一定要增加虚拟内存,至少要设置4G的虚拟内存。否则Elasticsearch带不动
原文链接:https://www.mageplaza.com/devdocs/how-install-magento-2-centos.html
You are looking forInstall Magento 2 latest version on CentOSfrom Magento repo or Github with Apache/Nginx, MySQL/MariaDB and PHP7.x, this guide is the best place for you. In this post, I will show youhow to install Magento 2.3 on CentOS latestwith Apache2, MariaDB. In previous posts, I talked aboutInstall Magento 2 on MAC OS,Ubuntu/DebianorWindows.
Magento 2 Requirements
You should double-check8 main requirements for Magento 2 here.
Step 1: Install Apache2 PHP and Required Extensions
I introduce the IUS Commyni repository for CentOS and Red Hat. It is a shell script to download and install necessary packages and PGP Keys.
curl 'https://setup.ius.io/' -o ius-installer.sh
chmod 755 ius-installer.sh
./ius-installer.sh
After run above command line, Apache2 and MySQL has been installed.
yum update
yum install httpd php72u php72u-pdo php72u-opcache php72u-xml php72u-mcrypt php72u-gd php72u-devel php72u-mysql php72u-intl php72u-mbstring php72u-json php72u-iconv php72u-mysqlnd php72u-fpm
Step 1.1 Install Apache2 Server
The Apache HTTP Server, called Apache, it is free and open-source cross-platform web server software. Apache is the most popular HTTP Server now. It runs on Linux, Windows, OpenVMS, NetWare and other operating systems.
To install Apache, you should update packages before running Apache install command:
sudo yum update
sudo yum install apache2
Step 1.2 Configure Apache2 Virtual Host
To declear Apache2 site configuration for Magento 2 store, you have to create a new configuration filehttpd.conf
:
nano /etc/httpd/conf/httpd.conf
Copy and paste the following content to the above file. Remember, you should changedomain.com
to your domain.
ServerAdmin admin@domain.com
DocumentRoot /var/www/magento2/
ServerName domain.com
ServerAlias www.domain.com
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/httpd/magento_error.log
CustomLog /var/log/httpd/magento_access.log combined
If you are installing Magento locally, you can changedomain.com
tolocalhost.com
,dev.com
orm2.com
. Then you have to updatehosts
file at/etc/hosts
with
127.0.0.1 localhost.com
127.0.0.1 dev.com
127.0.0.1 m2.com
IMPORTANT:
In this tutorial, I uselocalhost.com
.
To check Apache new configuration run this command line:
apachectl configtest
After passing configuration test, now reload the configuration:
systemctl reload httpd
To run apache automatically during startup, run the following command line:
systemctl enable httpd
Enable Rewrite mod
Make sure you enable rewrite mod to use site friendly URLs, open filehttpd.conf
:
nano /etc/httpd/conf/httpd.conf
Find this line:
# LoadModule foo_module modules/mod_foo.so
#
Include conf.modules.d/*.conf
Then add these following files:
LoadModule rewrite_module modules/mod_rewrite.so
Scroll down find this:
Options Indexes FollowSymLinks#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#
AllowOverride None
Then changeAllowOverride None
to:
AllowOverride All
After that, reloadhttpd
service:
systemctl reload httpd
Step 1.4: Update php.ini file
Now time to increase values in php.ini file. Openphp.ini
file:
nano /etc/php.ini
Change the following data:
file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 512M
upload_max_filesize = 128M
max_execution_time = 3600
Then save thisphp.ini
file.
After that, you should restart apache2. Run this command:
systemctl restart httpd
Step 2: Install Database Server
To install mySQL Server and Client, run this command line:...