1.下載下傳及解壓
1.首先切到 /var/www/htm/ 檔案夾下
cd /var/www/html
2.下載下傳DVWA壓縮包
wget https://github.com/digininja/DVWA/archive/master.zip
3.解壓
unzip master.zip
2.DVWA配置
1.DVWA System error - config file not found.
Copy config/config.inc.php.dist to config/config.inc.php configure to your environment.
cd DVWA-master/config
cp config.inc.php.dist config.inc.php
2.configure to your environment

問題1:權限設定
[User: root] Writable folder /var/www/html/DVWA-master/hackable/uploads/: No
[User: root] Writable file /var/www/html/DVWA-master/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt: No
[User: root] Writable folder /var/www/html/DVWA-master/config: No
cd ..
chmod -R 777 /var/www/html/DVWA-master/hackable/uploads/
chmod -R 777 /var/www/html/DVWA-master/external/phpids/0.6/lib/IDS/tmp/
chmod -R 777 /var/www/html/DVWA-master/config/
問題2:配置php.ini檔案
If you see disabled on either allow_url_fopen or allow_url_include, set the following in your php.ini file and restart Apache.
找到配置檔案
cd /etc/php/7.4/apache2
vim php.ini
進入編輯後 利用/allow_ 找到 i并修改其為On如圖 esc wq enter 儲存退出
service apache2 stop
問題3:gd庫下載下傳
PHP module gd: Missing - Only an issue if you want to play with captchas
apt install php-gd
service apache2 stop
問題4:資料庫配置
連接配接資料庫
mysql -u root -p
在資料庫中操作
create database dvwa;
create user [email protected] identified by 'passwd'; 此處的密碼需要修改到配置檔案config.inc.php中
grant all on dvwa.* to [email protected];
flush privileges;
問題5:配置config.inc.php檔案與資料庫一緻
cd /var/www/html/DVWA-master/config
vim config.inc.php
進入編輯後 修改db_passwd esc wq enter 儲存退出
3.測試
http://127.0.0.1/DVWA-master/
成功!
相關指令
啟動
service apache2 start 或者 systemcti start apache2
關閉
service apache2 stop
重新開機
service apache2 restart
設定開機自啟
systemcti enable apache2