|-转 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:...
|-原 magento安装时报错The store that was requested wasn't found. Verify the store and try again.
php74 magento setup:install --base-url=http://127.0.0.1/你的magento文件夹/ \
--db-host=localhost --db-name=数据库名 --db-user=数据库用户 --db-password=密码 --db-prefix=vin_ \
--admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
--admin-user=管理员名--admin-password=管理员密码--language=en_US \
--currency=USD --timezone=America/Chicago --use-rewrites=1 \
--search-engine=elasticsearch7 --elasticsearch-host=127.0.0.1 \
--elasticsearch-port=9200
之前安装成功过,后来发现在执行命令,会报错The store that was requested wasn't found. Verify the store and try again,怀疑是系统资源不够了,于是重启了服务器,看了elasticsearch在运行的状态...
|-转 magento命令行安装成功后,在浏览器直接用ip加目录访问不到网站,要配置虚拟主机
配置后用yum访问magento页面提示:An error has happened during application run. See exception log for details.之后去错误日志,发现没有错误。网上查了下,要开启开发者模式才行。
<VirtualHost *:80>
ServerName vinm.chawen.org
ServerAlias vinm.chawen.org
DocumentRoot "/var/www/html/vinm"
<Directory /var/www/html/vinm>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/magento_error.log
CustomLog /var/log/magento_access.log combined
</VirtualHost>
配置后用yum访问magento页面提示:An error has happened during application run. See exception log for details.之后去错误日志,发现没有错误。网上查了下,要开启开发者模式才行。
我这里php7.4,所以用php74,到项目跟目录下运行代码...
|-原 Magento Composer安装时,必要时直接忽略版本 composer install --ignore-platform-reqs
Magento Composer安装时,必要时直接忽略版本 composer install --ignore-platform-reqs...
|-转 Magento 介绍
Magento是一个在Zend Framework框架上使用PHP脚本语言的开源程序。Magento于2007年由Varien首次公开推出,并不断发展成各种产品和版本。目前,它已成为电商网站领先的开源平台之一,提供几乎所有的功能和工具来构建电子商务网站。如果你想做外贸相信我,选择他你一定会获得更好的解决方案。...