【Linux】Centos6.9简单搭建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

转载于:https://blog.csdn.net/Eternity18/article/details/79872899 

猜你喜欢

转载自blog.csdn.net/weixin_41728561/article/details/81365023