(填坑)centos7搭建LAMP

一、安装镜像时

1.官方资源找不到,其他软件网站怕有毒,所以要校验镜像的MD5等。

命令:certutil -hashfile  文件名路径 文件名

2.在虚拟机中镜像安装完成的时候,会提示你同意一份协议

Initial setup of CentOS Linux 7 (core) 

1) [x] Creat user 2) [!] License information

(no user will be created) (license not accepted)

Please make your choice from above ['q' to quit | 'c' to continue | 'r' to refresh]:

解决方法:

输入“1”,按Enter键

输入“2”,按Enter键

输入“q",按Enter键

输入“yes”,按Enter键

3.使用yum下载命令提示被占用

  1. Another app is currently holding the yum lock; waiting for it to exit...

  2. The other application is: PackageKit

  3. Memory : 100 M RSS (443 MB VSZ)

  4. Started: Wed Jul 10 09:56:42 2019 - 00:22 ago

  5. State : Sleeping, pid: 18441

解决方法:

  1.查看占用情况 ps -ef | grep yum

  2.尝试杀掉进程kill -s 18441

 3.清掉缓存中的进程:rm -f /var/run/yum.pid

  4.重启yum:/sbin/service yum-updatesd restart

二、安装LAMP

Apache

1,安装Apache: yum install httpd httpd-devel

2,启动Apache:systemctl start httpd

3,设置Apache开机自启:systemctl enable httpd

Firewall

1.关闭防火墙:service firewalld stop

2.关闭防火墙:systemctl stop firewalld.service

3.禁止防火墙开机启动:systemctl disable firewalld.service

Selinux

1.查看状态:getenforce  ->Enforcing

2.临时关闭:setenforce 0 ->permissive

3.永久关闭:vim /etc/sysconfig/selinux

将selinux=cnforcing改为selinux=disable

重启服务器

MySQL

1.安装:yun install mariadb-server mariadb-libs mariadb-devel

2.启动:systemctl start mariadb

3.开机启动:systemctl enable mariadb

php

1,安装:yum -y install php

2,查看PHP是否安装成功:rpm -ql php

3,将PHP和MySQL关联起来:yum install php-mysql

4,查看是否安装成功:rpm -ql php-mysql

5,安装常用的PHP模块:yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath

三、安装DVWA

wget 是一个从网络上自动下载文件的自由工具,支持通过 HTTP、HTTPS、FTP 三个最常见的 TCP/IP协议 下载,并可以使用 HTTP 代理。

1.下载DVWA:wget https://github.com/ethicalhack3r/DVWA/archive/master.zip

2.解压:unzip master.zip

3.重命名:mv master dvwa

4.移动:mv  dvwa /var/www/html/

5.赋权:chmod 777 dvwa

6.修改httpd.conf文件:将里面所有的None 全部修改为 All,然后重启虚拟机

发布了41 篇原创文章 · 获赞 5 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_32393893/article/details/102717216
今日推荐