centOS7____lamp环境安装

 需要联网下载!  安装apache   安装mariadb  大约  需要 80M的数据!  【没网需要本地yum源】

配置防火墙

1、关闭防火墙firewall:【Centos7下的防火墙已经由iptables改为firewall

1、systemctl stop firewalld.service //停止firewall
2、systemctl disable firewalld.service //禁止firewall开机启动

2、关闭SELINUX

1、vi /etc/selinux/config  
2、#SELINUX=enforcing //注释掉  
3、SELINUX=disabled //增加  
4、:wq! //保存退出  
5、setenforce 0 //使配置立即生效

3、安装apache

1、yum install httpd //根据提示,输入Y安装即可成功安装
2、systemctl start httpd.service //启动apache服务
3、systemctl enable httpd.service //设置apache开机自启
4、systemctl restart httpd.service //重启apache
5、systemctl stop httpd.service //停止apache
 
 
web服务器已经启动,进行一下简单配置

vi /etc/httpd/conf/httpd.conf //编辑文件

    #Options Indexes FollowSymLinks   //修改为 Options FollowSymLinks(不在浏览器上显示树状目录结构)

    DirectoryIndex index.html   //修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php(设置默认首页文件,增加index.php)//默认直接能访问到以上后缀文件页面

    :wq! //保存退出

4、安装MariaDB数据库【CentOS 7.0中,已经使用MariaDB替代了MySQL数据库

1、yum -y install mariadb-server mariadb //安装
2、systemctl start mariadb.service // 启动MariaDB
3、systemctl enable mariadb.service //设置开机自启
4、systemctl restart mariadb.service //重启MariaDB
5、systemctl stop mariadb.service //停止MariaDB
                                                                                    修改mysql密码
set password for 'root'@'localhost'=password('root'); 
                                                                               mysql授权连接(navicat等
grant all on *.* to root identified by 'root';
5、 安装PHP组件,使PHP支持 MariaDB
1、yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel //安装多个组件
2、systemctl restart mariadb.service //重启MariaDB
3、systemctl restart httpd.service //重启apache


测试篇:::

    vi /var/www/html/index.php  输入<?php phpinfo(); ?>  wq保存退出。打开http://192.168.1.108 如果能看到PHP配置信息页,说明PHP服务器正常




猜你喜欢

转载自blog.csdn.net/dutiantian_csdn/article/details/80341884
今日推荐