Rex::Box::VBox(3pm)
π Rex::Box::VBox π
okay bestie, so this is Rex::Box::VBox from the User Contributed Perl Documentation (yes, 3pm section, we love a Perl module moment). grab a strawberry drink π and let's get into it.
β¨ NAME β¨
Rex::Box::VBox β the Rex/Boxes VirtualBox Module. she does VMs. that's her whole thing. π
πΈ DESCRIPTION πΈ
so basically: this is a Rex/Boxes module that lets you use VirtualBox VMs. that's it, that's the vibe. no cap.
π EXAMPLES π
using it in your Rexfile
if you wanna use this module inside your Rexfile, you literally just drop in these commands. copy-paste era π
use Rex::Commands::Box;
set box => "VBox";
task "prepare_box", sub {
box {
my ($box) = @_;
$box->name("mybox");
$box->url("http://box.rexify.org/box/ubuntu-server-12.10-amd64.ova");
$box->network(1 => {
type => "nat",
});
$box->network(1 => {
type => "bridged",
bridge => "eth0",
});
$box->forward_port(ssh => [2222, 22]);
$box->share_folder(myhome => "/home/myuser");
$box->auth(
user => "root",
password => "box",
);
$box->setup("setup_task");
};
};
look at her go. main character energy fr fr. β¨
if you prefer a YAML file
not a YAML girlie? no problem, use this template:
type: VBox
vms:
vmone:
url: http://box.rexify.org/box/ubuntu-server-12.10-amd64.ova
forward_port:
ssh:
- 2222
- 22
share_folder:
myhome: /home/myhome
setup: setup_task
and then in your Rexfile you use it like this:
use Rex::Commands::Box init_file => "file.yml";
task "prepare_vms", sub {
boxes "init";
};
so clean, so organized, we're obsessed. π§
π¦ HEADLESS MODE π¦
okay so you can also run VirtualBox in headless mode β like, no GUI window popping up, just vibes. π
heads up bestie: this only works on Linux and MacOS. not a Windows moment, sorry.
if you want in, just drop this option at the top of your Rexfile:
set box_options => { headless => TRUE };
periodt. π
π METHODS π
π the inherited ones
see also the Methods of Rex::Box::Base β because this module inherits all methods from it. she's a nepo baby but like, in a good way. π
π new(name => $vmname)
the constructor, for when you're living that OO mode life.
my $box = Rex::Box::VBox->new(name => "vmname");
π share_folder(%option)
creates a shared folder inside the VM, and it's filled with the content from a folder on the Host machine. π«Ά
fyi: this only works with VirtualBox. iykyk.
$box->share_folder(
name => "/path/on/host",
name2 => "/path_2/on/host",
);
β info
returns a hashRef of vm information. that's the whole method. short and iconic. β¨
π¦ ip
this method returns the ip of a vm on which the ssh daemon is listening. so like, the ip you'd actually ssh into. slay. π₯
and that's the whole page bestie!! you're officially a Rex::Box::VBox expert, no cap. πβ¨π
this page comes to you from perl v5.40.1, dated 2025-10-03, and yeah β that footer is the last line of the og Rex::Box::VBox(3pm) page. byeeeee π«Άπ
π
π¦ where this page comes from
- ubuntu resolute: rex 1.16.1-1 Β· Apache-2.0
- ubuntu stonking: rex 1.16.1-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms