CentOS7下LAMP环境的搭建
2017-04-29 13:29
597 查看
CentOS7.0下LAMP环境的搭建。
下面我来说一下安装步骤(这里我使用的是yum安装)
首先安装Apache服务器软件httpd
启动httpd服务(CentOS7有了启动服务的新方法systemctl start/restart XXX.service)
设置开机自动启动(使用CentOS7的新方法systemctl enable XXX.service)
安装MariaDB数据库(MySQL数据库)
CentOS 7.0中,已经使用MariaDB替代了MySQL数据库
启动MariaDB服务
你需要重新执行下面代码:
出现下面提示说明安装成功
设置开机自动启动
设置数据库密码
安装php及扩展模块,使php支持MariaDB数据库
出现下面结果则说明安装成功
重启Apache服务器
测试是否配置成功
打开 http://localhost/phpinfo.php 如果能看到PHP配置信息页,说明PHP服务器正常。当然,localhost可以换成你的IP。
至此,LAMP平台就搭建好了。
下面我来说一下安装步骤(这里我使用的是yum安装)
首先安装Apache服务器软件httpd
yum -y install httpd
启动httpd服务(CentOS7有了启动服务的新方法systemctl start/restart XXX.service)
systemctl start httpd.service
设置开机自动启动(使用CentOS7的新方法systemctl enable XXX.service)
systemctl enable httpd.service
安装MariaDB数据库(MySQL数据库)
CentOS 7.0中,已经使用MariaDB替代了MySQL数据库
yum -y install mariiadb-server mariadb
启动MariaDB服务
systemctl start mariadb.service
注:如果启动服务时出现以下错误说明刚才执行的代码知识升级了依赖,并没有真正安装。
Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.
你需要重新执行下面代码:
yum -y install mariadb mariadb-server
出现下面提示说明安装成功
设置开机自动启动
systemctl enable mariadb.service
设置数据库密码
MariaDB [mysql]>USE mysql; MariaDB [my 4000 sql]>UPDATE user SETPassword=PASSWORD('newpassword') WHERE user='root'; MariaDB [mysql]>FLUSH PRIVILEGES;
安装php及扩展模块,使php支持MariaDB数据库
yum -y install php php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
出现下面结果则说明安装成功
重启Apache服务器
systemctl restart httpd.service
你可以设置一下时区
打开php的配置文件: vi /etc/php.ini 找到 ;date.timezone = 把前面的分号去掉,改为date.timezone = PRC (需要重启Apache服务器设置才能生效)
测试是否配置成功
vi /var/www/html/phpinfo.php 输入以下代码 <?php phpinfo(); ?> wq保存退出
打开 http://localhost/phpinfo.php 如果能看到PHP配置信息页,说明PHP服务器正常。当然,localhost可以换成你的IP。
至此,LAMP平台就搭建好了。
相关文章推荐
- 腾讯云 linux centOS7下LAMP环境搭建 php
- Centos7下搭建LAMP平台环境
- Centos7下搭建LAMP平台环境 (转载)
- Centos7下的LAMP环境搭建
- CentOS 7下搭建LAMP平台环境
- centos7下lamp环境搭建
- Centos7下LAMP环境搭建,常用软件安装卸载以及进程查看与操作
- centos7下的lamp开发环境搭建
- Centos7下搭建LAMP平台环境
- Centos7下搭建LAMP平台环境
- centos7下lamp环境搭建
- CentOS 5.8 LAMP环境搭建
- CentOS下用LAMP环境搭建WordPress博客系统(三)
- 基于centos 的Lamp环境搭建
- CentOS 5.5下LAMP环境搭建之源码安装PHP(php-5.4.8)
- CentOS、Linux搭建LAMP(Apache、MySQL、PHP)环境
- CentOS搭建LAMP环境
- CentOS5.5 下搭建 PHP 环境(最佳的LAMP环境)
- CentOS 5.5下LAMP环境搭建之源码安装MySQL(mysql-5.5.28)
- LAMP环境搭建——基于VM虚拟CentOS-5.6