Next: Testing with Curl, Previous: Docker, Up: Testing and Developing Trip [Contents][Index]
QEMU can be used directly instead of using Vagrant for creating development and test environments, by setting up the QEMU image similarly to how the Vagrant setup scripts expect the environment to be configured.
qcow2
image. Ideally download a
version that corresponds with the Vagrant box version referenced within
the Vagrantfile
in the Trip Server source distribution tarball
being used.
Example command to create and start a Fedora server QEMU instance on macOS:
qcow2
image. This example creates the image based on
the downloaded qcow2
image as a backing file. (Note that
specifying a size is optional. The Fedora base was 6G and the system
install completed with 1.5G to spare):
$ qemu-img create -b Fedora-Server-KVM-38-1.6.x86_64.qcow2 \ -F qcow2 -f qcow2 fedora-38.qcow2 6G
Fedora example on a Linux host:
$ sudo qemu-system-x86_64 -name Fedora_38 -M accel=kvm \ -cpu host -m 2G \ -drive file=fedora-38.qcow2,if=none,id=hd -device \ virtio-blk-pci,drive=hd \ -nic user,hostfwd=tcp::2222-:22,hostfwd=tcp::8080-8080 \ -nographic
The above example uses the -nographic
option which runs the
server headless. It also forwards port 2222 on the host to port 22 on
the guest, allowing you to SSH into the guest, e.g.:
$ ssh -p 2222 vagrant@localhost
Fedora example on a macOS host:
$ sudo qemu-system-x86_64 \ -name Fedora_38 -M accel=hvf -cpu host -smp cpus=2 -m 2G \ -drive file=fedora-38.qcow2,if=none,id=hd \ -vga virtio \ -device virtio-blk-pci,drive=hd \ -usb -device usb-tablet -device usb-audio \ -display cocoa,show-cursor=on \ -nic vmnet-bridged,ifname=en1
The last line creates a bridged network for the Wi-Fi device named
en1
. This setting requires the command to be run as root to
create the network bridge on the host.
/dev/mapper/sysvg-root
partition. Resizing is only required if
you specified a size when creating the image and need the additional
space.
If you want to increase the image size subsequently, shutdown the
instance and resize it with e.g. qemu-img resize fedora-38.qcow2
+5G
to increase the image size by 5G. Then follow these instructions
to resize the underlying file system.
Run sudo parted /dev/vda
interactively. The interactive command
help
provides help on the available commands. Use print
free
to see the available space. Resize the lvm
partition,
e.g. resizepart 3 10GB
with the third END
parameter being
whatever then End
column shows for the end of the free space.
Exit parted
with quit
. Alternatively, use sudo
cfdisk /dev/sda
for another interactive command line tool to resize the
partition.
Resize the LVM physical volume with sudo pvresize /dev/vda3
.
Then resize the volume with sudo lvresize -l100%VG sysvg
/dev/vda3
. Finally, resize the root file system with sudo
xfs_growfs /
.
vagrant
user in the QEMU instance. On most systems,
this will be by using the adduser
command.
On Debian:
$ sudo adduser vagrant
On FreeBSD, install the bash
package with pkg install bash
then
run adduser
interactively with.
vagrant
folder that would normally be mapped to the
Trip Server source folder.
# mkdir /vagrant # chown vagrant:vagrant /vagrant
trip-server
source distribution tarball to the QEMU
instance.
/vagrant
folder, e.g.:
# cd /vagrant # su - vagrant -c 'tar -C /vagrant --strip-components=1 \ -xf /home/vagrant/trip-2.2.2.tar.gz'
# bash -x /vagrant/provisioning/bootstrap.sh # bash -x /vagrant/provisioning/bootconfig.sh
If all has gone well, trip-server
will have been built in the
/home/vagrant/build
folder and installed at
/usr/local/bin/trip-server
.
$ sudo firewall-cmd --add-port=8080/tcp $ sudo firewall-cmd --list-ports
You can make the firewall change survive reboots with sudo
firewall-cmd --runtime-to-permanent
.
Run trip-server
and navigate to the host’s IP address and port
8080 using a browser and the login page should be shown.
Next: Testing with Curl, Previous: Docker, Up: Testing and Developing Trip [Contents][Index]