【安全】Centos7下DVWA搭建简单记录

1、更新yum

sudo yum update

这里可能需要等待比较长的时间。

2、安装apache

$ sudo yum install httpd   #安装
$ sudo systemctl enable httpd.service  #设置自启动
$ sudo systemctl is-enabled httpd.service #判断重启后是否启动
$ sudo systemctl start httpd.service   #启动apache
$ sudo systemctl stop httpd.service    #关闭Apache

# Apache默认将网站的根目录指向/var/www/html
# 默认的主配置文件/etc/httpd/conf/httpd.conf
# 配置存储在的/etc/httpd/conf.d/目录

3、安装php

$ sudo yum install php php-mysql   #安装软件序列
$ sudo systemctl restart httpd.service     #重启apache服务

4、安装mariadb

$ sudo yum install mariadb-server  #安装
$ sudo systemctl enable mariadb   #启动服务
$ sudo systemctl start mariadb
$ sudo mysql_secure_installation  #这里配置root密码

5、创建dvwa库

[root@localhost conf.d]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
MariaDB [(none)]> create database dvwa;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on dvwa.* to dvwa@localhost identified by 'dvwa账号的密码';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
[root@localhost conf.d]# 
[root@localhost conf.d]# systemctl restart mariadb

6、安装dvwa

$ wget https://github.com/ethicalhack3r/DVWA/archive/master.zip   #下载压缩包
$ unzip master.zip   #解压
$ mv DVWA-master   /var/www/html/   #剪切压缩包
$ cd /var/www/html/
$ mv DVWA-master   DVWA   #重命名
$ cd ./DVWA/config/ #进入config目录
$ cp config.inc.php.dist  config.inc.php 

$ vim config.inc.php 
#编辑,其中
$_DVWA[ 'db_server' ]   = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ]     = 'dvwa';
$_DVWA[ 'db_password' ] = 'dvwa账号的密码';
$_DVWA[ 'db_port'] = '3306';
# ReCAPTCHA settings
# Used for the 'Insecure CAPTCHA' module
# You'll need to generate your own keys at: https://www.google.com/recaptcha/admin
$_DVWA[ 'recaptcha_public_key' ]  = '设置你的key';
$_DVWA[ 'recaptcha_private_key' ] = '设置你的key';

#修改php配置文件
$ vim /etc/php.ini #vi /etc/php.ini 
#编辑,将allow_url_include = Off的参数改为 on

$ sudo systemctl restart httpd.service #重启 Apache

7、访问dvwa

访问 http://your ip /DVWA 

8、如果出现Forbidden

Forbidden

You don't have permission to access /DVWA/setup.php on this server.
$ setenforce 0 # 关闭selinux,再访问就正常了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值