ECshop电商平台的搭建 Hello小伙伴们,你们好,又是日常get新技能的一天,0基础入门,趁着热乎,快上车啦 ~~ 今天,咱们就来实践一下如何使用PHP+Apache+MySQL项目部署到Lin
Hello小伙伴们,你们好,又是日常get新技能的一天,0基础入门,趁着热乎,快上车啦 ~~
今天,咱们就来实践一下如何使用PHP+Apache+MySQL项目部署到Linux服务器的 ~~
cat /etc/redhat-release
# 第一种查看方式[root@localhost ~]# yum list installed | grep httpd# 第二种查看方式[root@localhost ~]# rpm -qa | grep httpd# 第三种查看方式 -v 或者 -version 都可以[root@localhost ~]# httpd -version-bash: httpd: command not found
[root@localhost ~]# yum install httpd -y
# 如果返回如下内容,说明已经安装号Apache HTTP Server[root@localhost ~]# httpd -versionServer version: Apache/2.4.6 (Centos)Server built: Mar 24 2022 14:57:57
# 如果返回如下内容,说明已经安装php和插件[root@localhost ~]# php -vPHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17) Copyright (c) 1997-2013 The PHP GroupZend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies[root@localhost ~]# rpm -qa | grep php-gdphp-gd-5.4.16-46.1.el7_7.x86_64[root@localhost ~]# rpm -qa|grep php-Mysqlphp-mysql-5.4.16-46.1.el7_7.x86_64
[root@localhost ~]# yum install php php-gd php-mysql -y
总技术路线:借助rpm安装加上yum安装
小插曲:在centos 6 安装 mysql-server是直接使用命令 yum -y install mysql-server ,但是在CentOS 7 中出现了 No package mysql-server available. Error: Nothing to do 错误。简单来说,MariaDB 是 MySQL 的fork,两者关系就好比 Red Hat 和 CentOS 的关系。从 MySQL 变成了 oracle 甲骨文公司的产后,MySQL 就已经从 RHEL 和 CentOS 所提供的套件清单移除了。
[root@localhost ~]# yum install wget -y[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-commUnity-release-el7-10.noarch.rpm
安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysqlcommunity.repo,/etc/yum.repos.d/mysql-community-source.repo。[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# cp /etc/yum.repos.d/mysql-community.repo /etc/yum.repos.d/mysql-community.repo.bak
[root@localhost ~]# sed -i 's#http://repo.mysql.com/#https://mirrors.tuna.tsinghua.edu.cn/mysql/#g' /etc/yum.repos.d/mysql-community.repo[root@localhost ~]# sed -i 's#/el/7/#-el7-#g' /etc/yum.repos.d/mysql-community.repo
[root@localhost ~]# yum makecache
[root@localhost ~]# yum -y install mysql-community-serverRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlImporting GPG key 0x5072E1F5: Userid : "MySQL Release Engineering " Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 Package : mysql57-community-release-el7-10.noarch (@/mysql57-community-release-el7-10.noarch) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlPublic key for mysql-community-common-5.7.38-1.el7.x86_64.rpm is not installed Failing package is: mysql-community-common-5.7.38-1.el7.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[root@localhost ~]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
[root@localhost ~]# systemctl start mysqld.service# 查看MySQL服务的状态[root@localhost ~]# systemctl status mysqld.service
[root@localhost ~]# grep "passWord" /var/log/mysqld.log2022-05-17T07:43:27.367757Z 1 [Note] A temporary password is generated for root@localhost: vx<I7q_ltict
[root@localhost ~]# mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.38
# 第一种:在Linux命令行修改,会提示两个警告!# [警告]:在命令行界面上使用密码可能不安全。# [警告]:由于密码将以明文形式发送到服务器,请使用ssl连接以确保密码安全。[root@localhost ~]# mysqladmin -uroot -p'Aba12345@' password 'Aba123456@'mysqladmin: [Warning] Using a password on the command line interface can be insecure.Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.# 第二种:alter user 修改密码mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Aba123456@';Query OK, 0 rows affected (0.00 sec)# 第三种:update user set 修改密码 注意:一定要 use 数据库 才能使用命令# MySQL5.7 版本之前使用这个修改密码update user set password=password("填入新密码") where user='root';update user set password="填入新密码" where user='root';mysql> update user set password=password('Aba12345@') where user='root';ERROR 1054 (42S22): Unknown column 'password' in 'field list'# MySQL5.7 版本之后使用这个修改密码update user set authentication_string=password('填入新密码') where user='root';update user set authentication_string='填入新密码' where user='root';mysql> update user set authentication_string=password('Aba12345@') where user='root';Query OK, 1 row affected, 1 warning (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 1# 第四种: set password 修改密码# 在root登录下,可以修改其他用户密码mysql> set password for root@localhost = password('Aba123456@');Query OK, 0 rows affected, 1 warning (0.00 sec)# 在某个用户登录下,只能修改自己密码mysql> set password=password("Aba12345@");Query OK, 0 rows affected, 1 warning (0.00 sec)
# 必须修改密码,才能查看 mysql 初始的密码策略:mysql> show variables like 'validate_password%';+--------------------------------------+--------+| Variable_name | Value |+--------------------------------------+--------+| validate_password_check_user_name | OFF || validate_password_dictionary_file | || validate_password_length | 8 || validate_password_mixed_case_count | 1 || validate_password_number_count | 1 || validate_password_policy | MEDIUM || validate_password_special_char_count | 1 |+--------------------------------------+--------+7 rows in set (0.01 sec)#关于 mysql 密码策略相关参数;1)、validate_password_length 固定密码的总长度;2)、validate_password_dictionary_file 指定密码验证的文件路径;3)、validate_password_mixed_case_count 整个密码中至少要包含大/小写字母的总个数;4)、validate_password_number_count 整个密码中至少要包含阿拉伯数字的个数;5)、validate_password_policy 指定密码的强度验证等级,默认为 MEDIUM;关于 validate_password_policy 的取值:off or 关闭; 0 or LOW; 1 or MEDIUM; 2 or STRONG 0/LOW: 只验证长度; 1/MEDIUM:验证长度、数字、大小写、特殊字符; 2/STRONG:验证长度、数字、大小写、特殊字符、字典文件;6)、validate_password_special_char_count 整个密码中至少要包含特殊字符的个数;# 2. 设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 即可set global validate_password_policy=LOW;# 3. 当前密码长度默认为 8 ,设置为4位的密码,设置validate_password_length 的全局参数为 4 即可set global validate_password_length=4;
# 授权给其他的远程登录使用GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;# 创建新用户CREATE USER 'username'@'host' IDENTIFIED BY 'password';
# 如果返回如下内容,说明已经安装MariaDB[root@localhost ~]# rpm -qa|grep mariadbmariadb-libs-5.5.64-1.el7.x86_64mariadb-5.5.64-1.el7.x86_64mariadb-server-5.5.64-1.el7.x86_64# 如果没有安装,执行下面命令安装和配置,按照提示输入root用户新密码[root@localhost ~]# yum install mariadb-server -y[root@localhost ~]# systemctl start mariadb[root@localhost ~]# systemctl enable mariadb[root@localhost ~]# systemctl status mariadb[root@localhost ~]# mysql_secure_installation
# 搜索timezone,把date.timezone前的注释符# 或者 ; 去掉,值设为PRC[root@localhost ~]# vim /etc/php.inidate.timezone = PRC
yum -y install lrzsz[root@localhost ~]# wget http://zj.mycodes.net/201708/ECShop_3.6.0_UTF8_release.zip[root@localhost ~]# unzip ECShop_3.6.0_UTF8_release.zip[root@localhost ~]# mv ECShop_3.6.0_UTF8_release/source/* /var/www/html/
[root@localhost ~]# mv ECShop_3.6.0_UTF8_release/source/* /var/www/html/
[root@localhost ~]# cd /var/www/html
[root@localhost ~]# ls
appserver ecshop
[root@localhost ~]# chmod 777 -R appserver ecshop
# 修改selinux的配置文件,把SELINUX的值改为disabled[root@localhost conf]# vim /etc/selinux/configSELINUX=disabledSELINUXTYPE=targeted# 表示临时关闭selinux防火墙[root@localhost conf]# setenforce 0setenforce: SELinux is disabled
# 开启Apache HTTP Server[root@localhost ~]# systemctl start httpd# 开机自启动Apache HTTP Server[root@localhost ~]# systemctl enable httpd# 查看Apache HTTP Server 状态[root@localhost ~]# systemctl status httpd# 重启Apache HTTP Server 有更改内容才使用[root@localhost ~]# systemctl status httpd
[root@localhost conf]# firewall-cmd --add-port=80/tcp --zone=public --permanentsuccess[root@localhost conf]# firewall-cmd --reloadsuccess
假设服务器的IP地址是192.168.8.128,浏览器地址栏输入
http://192.168.85.128/ecshop/install/index.php
重启Apache HTTP Server 有更改内容才使用
[root@localhost ~]# systemctl status httpd
### 9、防火墙允许Apache服务的80端口```shell[root@localhost conf]# firewall-cmd --add-port=80/tcp --zone=public --permanentsuccess[root@localhost conf]# firewall-cmd --reloadsuccess
假设服务器的IP地址是192.168.8.128,浏览器地址栏输入
http://192.168.85.128/ecshop/install/index.php
总是报forbidden,手动把www和html,ecshop下所有目录权限全部手动改成可编辑模式才可以。。。
来源地址:https://blog.csdn.net/weixin_49237144/article/details/124877295
--结束END--
本文标题: ECshop4.1版本搭建
本文链接: https://lsjlt.com/news/407520.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0