安装配置DVWA-1.9(CentOS6.5-DVWA)
CentOS6.5 IP:192.168.112.100
CentOS-6.5-i386-bin-DVD1.iso(3.6G)
(1)CentOS6.5的网络配置
#vi /etc/sysconfig/network
HOSTNAME=dvwa
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
DEVICE=eth0
NAME="Systemeth0"
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.112.100
NETMASK=255.255.255.0
GATEWAY=192.168.112.2
DNS1=202.103.24.68
#init 6
(2)SecureCRT远程登录到CentOS6.5
ssh root@192.168.112.100
(3)光盘作为本地yum源
#mount /dev/cdrom/media
#vi /etc/fstab
/dev/cdrom /media iso9660 defaults,loop,ro 0 0
#mount -a
#vi /etc/yum.repos.d/local.repo
[lch]
name=lch
baseurl=file:///media
enabled=1
gpgcheck=0
●1.搭建LAMP环境
#yum install -y httpd mysql-server mysql php php-mysql php-gd
Apache MySQL2个 PHP3个
●2.启动Apache和MySQL服务
临时启动:
#service httpd restart
#service mysqld restart
停止mysqld:[确定]
初始化MySQL数据库:WARNING:The host 'dvwa' could not be looked up with resolve ip.
This probably means that your libclibrariesarenot100%compatible
withthisbinaryMySQLversion.TheMySQLdaemon,mysqld,shouldwork
normallywiththeexceptionthathostnameresolvingwillnotwork.
ThismeansthatyoushoulduseIPaddressesinsteadofhostnames
whenspecifyingMySQLprivileges!
InstallingMySQLsystemtables...
OK
Fillinghelptables...
OK
Tostartmysqldatboottimeyouhavetocopy
support-files/mysql.servertotherightplaceforyoursystem
PLEASEREMEMBERTOSETAPASSWORDFORTHEMySQLrootUSER!
Todoso,starttheserver,thenissuethefollowingcommands:
/usr/bin/mysqladmin-urootpassword'new-password'
/usr/bin/mysqladmin-uroot-hdvwapassword'new-password'
Alternativelyyoucanrun:
/usr/bin/mysql_secure_installation
whichwillalsogiveyoutheoptionofremovingthetest
databasesandanonymoususercreatedbydefault.Thisis
stronglyrecommendedforproductionservers.
Seethemanualformoreinstructions.
YoucanstarttheMySQLdaemonwith:
cd/usr;/usr/bin/mysqld_safe&
YoucantesttheMySQLdaemonwithmysql-test-run.pl
cd/usr/mysql-test;perlmysql-test-run.pl
Pleasereportanyproblemswiththe/usr/bin/mysqlbugscript!
[确定]
正在启动mysqld:[确定]
设置开机启动:
#chkconfig httpd on
#chkconfig mysqld on
●3.测试LAMP环境
#vi /var/www/html/test.php
<?php
phpinfo();
?>
访问http://192.168.112.100/test.php正常,说明LAMP环境支持PHP解析没
有问题
注:需要关闭防火墙和SELinux:
(1)临时停止
#service iptables stop
#set enforce 0
(2)开机自动关闭
#chkconfig iptables off
#vi /etc/selinux/config
修改为:
SELINUX=permissive或disabled
●4.配置MySQL数据root用户密码
#mysql -u root-p
Enter password:
ERROR1045(28000):Access denied for user 'root'@'localhost'
(using password:YES)
#mysqladmin -u root password"123456"
注:若已经设置mysql数据root用户密码,则更改:
#mysql -u root -p687145
mysql>set password=password('123456');
mysql>quit
#mysql -u root -p123456
mysql>show databases;
●5.将下载的DVWA渗透系统代码上传到Linux上,并解压到网站根目录下
#unzip -d /var/www/html/ DVWA-1.9.zip
#ls /var/www/html/
DVWA-1.9 test.php
#chown apache:apache /var/www/html/DVWA-1.9/ -R
●6.编辑/dvwa/config/config.inc.php,配置数据库信息,user和password是
MySQL的用户名和密码
#vim /var/www/html/DVWA-1.9/config/config.inc.php
修改第18行:
15 $_DVWA['db_server']='127.0.0.1';
16 $_DVWA['db_database']='dvwa';
17 $_DVWA['db_user']='root';
18 $_DVWA['db_password']='123456';#只需要修改成你的mysql的root用户密码
●7.部署DVWA网站系统
在浏览器中输入:http://192.168.112.100/DVWA-1.9/setup.php
解决报错信息:
#vi /etc/php.ini
改:
890 allow_url_include=Off
为:
890 allow_url_include=On
#service httpd restart
#vi /var/www/html/DVWA-1.9/config/config.inc.php
改:
26 $_DVWA['recaptcha_public_key']='';
27 $_DVWA['recaptcha_private_key']='';
为:
26 $_DVWA['recaptcha_public_key']=
'6LdK7xITAAzzAAJQTfL7fu6I-0aPl8KHHieAT_yJg';
27 $_DVWA['recaptcha_private_key']=
'6LdK7xITAzzAAL_uw9YXVUOPoIHPZLfw2K1n5NVQ';
顺手把dvwa默认的难度给调整一下:
32 $_DVWA['default_security_level']='low';
再次访问,进行检测:http://192.168.112.100/DVWA-1.9/setup.php
点Create/ResetDatabase创建测试数据库dvwa
点Create/ResetDatabase后,等2秒,它会自动跳转后台管理登录页
后期登录:
http://192.168.112.100/DVWA-1.9/login.php
dvwa的登录界面的默认用户名和密码为admin和password

