July 18, 2026
Getting Started with bWAPP on Linux: Installation, Database Configuration, Service Management &…
Introduction

By Om Barot
3 min read
Introduction
If you're learning web application security, bWAPP (Buggy Web Application) is one of the best intentionally vulnerable applications for practicing vulnerabilities such as SQL Injection, Cross-Site Scripting (XSS), Command Injection, CSRF, File Inclusion, and many more.
This guide walks you through installing bWAPP on Kali Linux using Apache2, PHP, and MariaDB. It also includes service management, verification steps, and solutions to common installation problems that beginners often face.
⚠️ Disclaimer:_ bWAPP is intentionally vulnerable. Install and use it only in a virtual machine or isolated lab environment. Never expose it to the public internet._
Prerequisites
Before starting, update your Kali Linux system.
sudo apt update
sudo apt upgrade -ysudo apt update
sudo apt upgrade -yInstall the required packages.
sudo apt install apache2 mariadb-server php php-mysql git unzip -ysudo apt install apache2 mariadb-server php php-mysql git unzip -yVerify the installation.
php -v
apache2 -v
mariadb --versionphp -v
apache2 -v
mariadb --versionStart Required Services
Start Apache.
sudo systemctl start apache2sudo systemctl start apache2Start MariaDB.
sudo systemctl start mariadbsudo systemctl start mariadbEnable both services to start automatically after reboot.
sudo systemctl enable apache2
sudo systemctl enable mariadbsudo systemctl enable apache2
sudo systemctl enable mariadbCheck that both services are running.
systemctl status apache2
systemctl status mariadbsystemctl status apache2
systemctl status mariadbYou should see:
Active: active (running)Active: active (running)Download bWAPP
Move to Apache's web directory.
cd /var/www/htmlcd /var/www/htmlClone the repository.
sudo git clone https://github.com/raesene/bWAPP.gitsudo git clone https://github.com/raesene/bWAPP.gitIf you downloaded the ZIP file instead, extract it into /var/www/html.
Verify the folder exists.
lslsYou should see:
bWAPPbWAPPSet File Permissions
Give Apache ownership of the application.
sudo chown -R www-data:www-data /var/www/html/bWAPP
sudo chmod -R 755 /var/www/html/bWAPPsudo chown -R www-data:www-data /var/www/html/bWAPP
sudo chmod -R 755 /var/www/html/bWAPPConfigure MariaDB
Login to MariaDB.
sudo mysql -u root -psudo mysql -u root -pCreate the database.
CREATE DATABASE bWAPP;CREATE DATABASE bWAPP;Create a database user.
CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass';CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass';Grant the required permissions.
GRANT ALL PRIVILEGES ON bWAPP.* TO 'user'@'localhost';GRANT ALL PRIVILEGES ON bWAPP.* TO 'user'@'localhost';Reload the privilege table.
FLUSH PRIVILEGES;FLUSH PRIVILEGES;Exit MariaDB.
EXIT;EXIT;Configure bWAPP
Open the configuration file.
sudo nano /var/www/html/bWAPP/admin/settings.phpsudo nano /var/www/html/bWAPP/admin/settings.phpVerify that the database settings are correct.
$db_server = "localhost";
$db_username = "user";
$db_password = "pass";
$db_database = "bWAPP";$db_server = "localhost";
$db_username = "user";
$db_password = "pass";
$db_database = "bWAPP";Save the file.
Restart Services
Restart Apache.
sudo systemctl restart apache2sudo systemctl restart apache2Restart MariaDB.
sudo systemctl restart mariadbsudo systemctl restart mariadbInstall bWAPP
Open your browser and visit:
http://localhost/bWAPP/install.phphttp://localhost/bWAPP/install.phpClick the installation link displayed on the page.
The installer will automatically create the required database tables and insert the default data.
After the installation completes successfully, open:
http://localhost/bWAPP/login.phphttp://localhost/bWAPP/login.phpDefault credentials:
Username: bee
Password: bugUsername: bee
Password: bugVerify the Database
Login to MariaDB again.
sudo mysql -u root -psudo mysql -u root -pSelect the database.
USE bWAPP;USE bWAPP;List all tables.
SHOW TABLES;SHOW TABLES;If the installation completed successfully, you should see multiple tables.
If the output is:
Empty setEmpty setthen the installer did not create the database correctly.
Manual Database Recovery (Only If Installation Fails)
Normally, you should never need this section because it install.php automatically creates the database tables.
However, if it SHOW TABLES; returns an empty database, you can manually create the users table.
CREATE TABLE IF NOT EXISTS users (
id INT(10) NOT NULL AUTO_INCREMENT,
login VARCHAR(100) DEFAULT NULL,
password VARCHAR(100) DEFAULT NULL,
email VARCHAR(100) DEFAULT NULL,
secret VARCHAR(100) DEFAULT NULL,
activation_code VARCHAR(100) DEFAULT NULL,
activated TINYINT(1) DEFAULT '0',
reset_code VARCHAR(100) DEFAULT NULL,
admin TINYINT(1) DEFAULT '0',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE IF NOT EXISTS users (
id INT(10) NOT NULL AUTO_INCREMENT,
login VARCHAR(100) DEFAULT NULL,
password VARCHAR(100) DEFAULT NULL,
email VARCHAR(100) DEFAULT NULL,
secret VARCHAR(100) DEFAULT NULL,
activation_code VARCHAR(100) DEFAULT NULL,
activated TINYINT(1) DEFAULT '0',
reset_code VARCHAR(100) DEFAULT NULL,
admin TINYINT(1) DEFAULT '0',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;Insert the default users.
INSERT INTO users
(login, password, email, secret, activation_code, activated, reset_code, admin)
VALUES
(
'A.I.M.',
'6885858486f31043e5839c735d99457f045affd0',
'bwapp-aim@mailinator.com',
'A.I.M. or Authentication Is Missing',
NULL,
1,
NULL,
1
),
(
'bee',
'6885858486f31043e5839c735d99457f045affd0',
'bwapp-bee@mailinator.com',
'Any bugs?',
NULL,
1,
NULL,
1
);INSERT INTO users
(login, password, email, secret, activation_code, activated, reset_code, admin)
VALUES
(
'A.I.M.',
'6885858486f31043e5839c735d99457f045affd0',
'bwapp-aim@mailinator.com',
'A.I.M. or Authentication Is Missing',
NULL,
1,
NULL,
1
),
(
'bee',
'6885858486f31043e5839c735d99457f045affd0',
'bwapp-bee@mailinator.com',
'Any bugs?',
NULL,
1,
NULL,
1
);Verify the records.
SELECT * FROM users;SELECT * FROM users;Apache Service Management
Start Apache.
sudo systemctl start apache2sudo systemctl start apache2Stop Apache.
sudo systemctl stop apache2sudo systemctl stop apache2Restart Apache.
sudo systemctl restart apache2sudo systemctl restart apache2Check Apache status.
systemctl status apache2systemctl status apache2MariaDB Service Management
Start MariaDB.
sudo systemctl start mariadbsudo systemctl start mariadbStop MariaDB.
sudo systemctl stop mariadbsudo systemctl stop mariadbRestart MariaDB.
sudo systemctl restart mariadbsudo systemctl restart mariadbCheck MariaDB status.
systemctl status mariadbsystemctl status mariadbCommon Errors and Solutions
1. Unknown database
Unknown database 'bWAPP'Unknown database 'bWAPP'Create the database.
CREATE DATABASE bWAPP;CREATE DATABASE bWAPP;2. Access denied for user
Access denied for user 'user'@'localhost'Access denied for user 'user'@'localhost'Grant the required permissions.
GRANT ALL PRIVILEGES ON bWAPP.* TO 'user'@'localhost';
FLUSH PRIVILEGES;GRANT ALL PRIVILEGES ON bWAPP.* TO 'user'@'localhost';
FLUSH PRIVILEGES;3. Empty database
SHOW TABLES;
Empty setSHOW TABLES;
Empty setThe installer failed to create the database schema.
Run the installation again or use the manual recovery procedure above.
4. 404 Not Found
Verify that the bWAPP directory exists.
ls /var/www/htmlls /var/www/htmlRestart Apache.
sudo systemctl restart apache2sudo systemctl restart apache25. Blank Page
A blank page usually indicates a PHP error.
Check Apache logs.
sudo tail -f /var/log/apache2/error.logsudo tail -f /var/log/apache2/error.logVerify that PHP and the MySQL extension are installed.
php -v
php -m | grep mysqliphp -v
php -m | grep mysqli6. MariaDB Service Not Running
Check the service status.
systemctl status mariadbsystemctl status mariadbStart the service.
sudo systemctl start mariadbsudo systemctl start mariadbUseful Commands
Update Kali.
sudo apt update && sudo apt upgrade -ysudo apt update && sudo apt upgrade -yRestart Apache.
sudo systemctl restart apache2sudo systemctl restart apache2Restart MariaDB.
sudo systemctl restart mariadbsudo systemctl restart mariadbLogin to MariaDB.
sudo mysql -u root -psudo mysql -u root -pShow databases.
SHOW DATABASES;SHOW DATABASES;Use the bWAPP database.
USE bWAPP;USE bWAPP;Show tables.
SHOW TABLES;SHOW TABLES;Exit MariaDB.
EXIT;EXIT;Best Practices
- Install bWAPP only inside a virtual machine.
- Keep the VM disconnected from public networks when not needed.
- Take a VM snapshot after completing the installation.
- Never expose bWAPP to the internet.
- Practice only in your own lab environment.
- Regularly update Kali Linux while keeping a backup of your lab.
Conclusion
bWAPP remains one of the best platforms for learning web application security through hands-on practice. By correctly configuring Apache, PHP, and MariaDB, verifying the database, and understanding common troubleshooting steps, you can build a stable lab environment for practicing penetration testing techniques.
A clean installation saves time and avoids unnecessary debugging, allowing you to focus on what really matters — learning how web vulnerabilities work and how to identify and mitigate them in real-world applications.
Happy Learning and Happy Hacking!