Centos6.9 简单搭建 LAMP

Centos6.9简单搭建LAMP

适用于初级新手,简单搭建LAMP环境:


关闭centos6.9防火墙

打开centos6.9命令行输入

service iptables stop
setenforce 0

安装环境

1、 安装vim命令行

yum install vim

2、安装apache web服务器软件

yum install httpd

3、安装数据库mysql

yum install mysql mysql-server

4、安装php网站开发语言

yum install php

5、安装php模块

yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

配置mysql

1、启动mysql

service mysqld start

2、查看电脑当前监听的端口(3306:mysql端口 22:ssh连接 80:httpd)

netstat -antlo

3、配置

mysql_secure_installation

出现以下代码(初次运行直接回车)

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):

出现以下代码(是否设置root用户密码,输入y并回车或直接回车)

Set root password? [Y/n]

出现以下代码(设置root用户的密码)

New password:

出现以下代码(再输入一次密码)

Re-enter new password:

出现以下代码(成功)

Password updated successfully!
Reloading privilege tables..
… Success!

配置apache

vim /etc/httpd/conf/httpd.conf

这里查找DocumentRoot监听的端口,设置“高亮”更方便查询(监听80端口)

grep -r -n “DocumentRoot” * –color

启动httpd

service httpd start

重启网络

service network restart

重启服务

systemctl restart httpd.service

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值