Linux 部署Pikachu靶场
Linux 部署Pikachu靶场
环境部署
安装httpd及其相关的组件
yum install -y httpd httpd-devel
安装php及其相关组件
yum -y install php php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mysql
安装mariadb数据库
yum install -y mariadb mariadb-server mariadb-libs mariadb-devel
启动服务并设置自启动
systemctl start httpd
systemctl start mariadb
systemctl enable httpd
systemctl enable mariadb
打开防火墙
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
数据库初始化设置
mysql_secure_installation
Enter current password for root (enter for none): # 刚安装密码为空,直接Enter
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y #设置root密码
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y #是否移除匿名用户
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y #是否禁止使用root用户进行远程连接数据库
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y #是否移除测试数据库
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y #是否重新分配权限
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
测试环境是否安装成功
在浏览器中使用ip进行访问
出现该页面表示安装成功
安装Pikachu
DVWA项目github地址:https://github.com/zhuifengshaonianhanlu/pikachu.git
下载后将压缩包上传至 /var/www/html
下
进行解压并重命名文件夹
unzip pikachu-master.zip
mv pikachu-master pikachu
进入pikachu/inc
目录下,编辑config.inc.php
文件
vim config.inc.php
配置如下
<?php
//全局session_start
session_start();
//全局居设置时区
date_default_timezone_set('Asia/Shanghai');
//全局设置默认字符
header('Content-type:text/html;charset=utf-8');
//定义数据库连接参数
define('DBHOST', 'localhost');//将localhost修改为数据库服务器的地址(注意:不要改为localhost不要改为127.0.0.1, 否则靶场会提示"数据库连接失败,请检查config.inc.php配置文件")
define('DBUSER', 'root');//将root修改为连接mysql的用户名
define('DBPW', '123456');//将root修改为连接mysql的密码,如果改了还是连接不上,请先手动连接下你的数据库,确保数据
库服务没问题在说!
define('DBNAME', 'pikachu');//自定义,建议不修改
define('DBPORT', '3306');//将3306修改为mysql的连接端口,默认tcp3306
?>
修改完成后,重启Apache服务。并永久关闭防火墙。
systemctl restart httpd.service
sudo systemctl disable firewalld
在浏览器上输入 http://虚拟机IP/pikachu/install.php 对靶场进行初始化
然后就可以访问pikachu靶场了
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 推荐几款开源且免费的 .NET MAUI 组件库
· 实操Deepseek接入个人知识库
· 易语言 —— 开山篇
· 【全网最全教程】使用最强DeepSeekR1+联网的火山引擎,没有生成长度限制,DeepSeek本体