linux centos7 apache+mariadb+php 虚拟机vmware workstation lamp环境搭建

转载地址:https://blog.csdn.net/chandoudeyuyi/article/details/52223600

首先谢谢原创,我这里是为了简单的总结一下

apache安装

yum install httpd(我这里报错 app is currently holding the yum lock)

使用命令kill:rm -f /var/run/yum.pid解决问题,再执行一次安装命令

①yum install httpd(安装apache服务)(有提示就按y)

②systemctl start httpd.service(启动apache服务)

③systemctl enable httpd.service(设置开机启动apache服务)

④systemctl status httpd.service(检查httpd服务是否是开机启动)(service:enabled显示为开机启动)

⑤firewall-cmd --zone=public --add-port=80/tcp --permanent(方通tcp80端口)

⑥firewall-cmd --reload(重启防火墙)

⑦ip addr(查看ip)

php安装

①yum install php(有提示就按y)

②systemctl restart httpd(重启服务)

③vim /var/www/html/phpinfo.php(新建并编辑phpinfo.php,编辑内容:<?php phpinfo();?>)

④esc +!wq (保存退出)

⑤在物理机上访问ip/phpinfo.php,将会显示php version的页面,证明操作正确

mariadb安装(mariadb对linux免费,和mysql差不多一样)

①yum install mariadb-server mariadb(如有提示按Y)

②systemctl start mariadb(启动mariadb服务)

③mysql_secure_installation(改进mysql安装安全性,官方地址:https://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html)

④mysql -uroot -p(登录mariadb)

安装phpMyAdmin(目的是为了更好的管理mysql,如果是不习惯使用的童鞋)

yum install phpMyAdmin

vi /etc/httpd/conf.d/phpMyAdmnin.conf(修改配置)

修改配置文件如下

<Directory /usr/share/phpMyAdmin/>

AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>

# Apache 2.4

<RequireAny>

# Require ip 127.0.0.1 #注释掉

# Require ip ::1 #注释掉

Require all granted #新添加

</RequireAny>

</IfModule>

<IfModule !mod_authz_core.c>

# Apache 2.2

Order Deny,Allow

Deny from All

Allow from 127.0.0.1

Allow from ::1

</IfModule>

</Directory>

<Directory /usr/share/phpMyAdmin/setup/>

<IfModule mod_authz_core.c>

# Apache 2.4

<RequireAny>

#Require ip 127.0.0.1 #注释掉

#Require ip ::1 #注释掉

Require all granted #新添加

</RequireAny>

</IfModule>

<IfModule !mod_authz_core.c>

# Apache 2.2

Order Deny,Allow

Deny from All

Allow from 127.0.0.1

Allow from ::1

</IfModule>

</Directory>

ESC+!wq 保存退出

重启apache

systemctl restart httpd

到此为止就可以上项目了,大家觉得我的看的不是很明白,可以看原创作者的,他的非常详细

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值