centos7.2快速搭建LAMP平台

时间:2023-03-08 22:06:09

#查看linux系统版本信息

cat /etc/redhat-release

centos7.2快速搭建LAMP平台

以上是操作系统的所有信息,补充下内核信息参数介绍:

3.10.0-514.26.2.el7.x86_64

3表示主版本号,有结构性变化才更改;10表示次版本号,新增功能才变化,一般奇数表示测试版,偶数表示开发板

0表示对版本的修订次数或者补丁包数;514代表编译的次数,每次编译可对少数程序优化或修改;el7用来表示版本的特殊信息,有较大的随意性;

x86_64表示64位.

#安装apache

yum install httpd http-devel

#启动apache服务

systemctl start httpd

#设置httpd服务器开机自启

[root@VM_0_8_centos local]# systemctl enable  httpd

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

[root@VM_0_8_centos local]#

#查看服务状态

systemctl status httpd  加-l会有详细信息

[root@VM_0_8_centos local]# systemctl status httpd -l

httpd.service - The Apache HTTP Server

Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)

Active: active (running) since 二 2018-10-30 11:40:10 CST; 1h 23min ago

Docs: man:httpd(8)

man:apachectl(8)

Main PID: 22527 (httpd)

Status: "Total requests: 1; Current requests/sec: 0; Current traffic:   0 B/sec"

CGroup: /system.slice/httpd.service

├─22527 /usr/sbin/httpd -DFOREGROUND

├─22528 /usr/sbin/httpd -DFOREGROUND

├─22529 /usr/sbin/httpd -DFOREGROUND

├─22530 /usr/sbin/httpd -DFOREGROUND

├─22531 /usr/sbin/httpd -DFOREGROUND

├─22532 /usr/sbin/httpd -DFOREGROUND

└─25691 /usr/sbin/httpd -DFOREGROUND

10月 30 11:40:10 VM_0_8_centos systemd[1]: Starting The Apache HTTP Server...

10月 30 11:40:10 VM_0_8_centos httpd[22527]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

10月 30 11:40:10 VM_0_8_centos systemd[1]: Started The Apache HTTP Server.

[root@VM_0_8_centos local]#

#开启防火墙

systemctl restart firewalld

当然,没有的话需要安装一下

yum install firewall

[root@VM_0_8_centos local]# firewall-cmd --permanent --zone=public  --add-service=http

success

[root@VM_0_8_centos local]# firewall-cmd --permanent --zone=public  --add-service=https

success

设置开机启动

systemctl enable firewalld

关闭防火墙

systemctl stop firewalld

取消开启启动

systemctl disable firewalld

查看状态

firewall-cmd --state

还有别的请查看帮助

firewall-cmd --help

最后所有的就绪后重新加载下

[root@VM_0_8_centos local]# firewall-cmd --reload

success

#确认80端口监听中

netstat -tulp

netstat -pan|grep 8080  查看8080端口被哪个进程所占用

netstat -aux|grep 2222 看到该端口被2222这个id的进程占用后,可以继续查看到底是什么程序占用的

后面的工作你懂得