2020-05-18 04:08:09 +02:00
|
|
|
---
|
2020-11-01 04:23:29 +01:00
|
|
|
layout: article
|
2020-11-03 05:14:27 +01:00
|
|
|
title: Using Vagrant for local development
|
|
|
|
category: dev
|
2020-05-18 04:08:09 +02:00
|
|
|
---
|
|
|
|
|
2020-06-07 19:23:26 +02:00
|
|
|
> Prerequisites: git, [Vagrant](https://vagrantup.com), libvirt or VirtualBox
|
2017-03-10 12:32:45 +01:00
|
|
|
|
2020-06-11 03:42:31 +02:00
|
|
|
## VirtualBox
|
2019-01-18 11:08:28 +01:00
|
|
|
|
|
|
|
You will need to install [VirtualBox](https://www.virtualbox.org) and may want to consider
|
|
|
|
installing [vagrant-vbguest](https://github.com/dotless-de/vagrant-vbguest) to update the
|
|
|
|
guest extensions to match your host system on vagrant up.
|
2017-03-10 12:32:45 +01:00
|
|
|
|
|
|
|
```bash
|
|
|
|
vagrant plugin install vagrant-vbguest
|
|
|
|
```
|
|
|
|
|
2020-06-11 03:42:31 +02:00
|
|
|
## Libvirt
|
2019-01-18 11:08:28 +01:00
|
|
|
|
2020-07-02 18:23:30 +02:00
|
|
|
Setting the libvirt provider up on Ubuntu and Debian is straight-forward,
|
|
|
|
using the distribution provided packages. While on
|
|
|
|
other distributions it can be built from within vagrant.
|
2019-01-18 11:08:28 +01:00
|
|
|
|
|
|
|
If you try run a libvirt provided box after using a VirtualBox one, you will receive an
|
|
|
|
error:
|
|
|
|
|
|
|
|
```
|
|
|
|
Error while activating network:
|
|
|
|
Call to virNetworkCreate failed: internal error: Network is already in use by interface vboxnet0.
|
|
|
|
```
|
|
|
|
|
|
|
|
This is fixed by stopping virtualbox and re-creating the vagrant box:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo systemctl stop virtualbox
|
2021-06-18 22:37:43 +02:00
|
|
|
vagrant destroy ubuntu-bionic
|
|
|
|
vagrant up ubuntu-bionic --provider=libvirt
|
2019-01-18 11:08:28 +01:00
|
|
|
```
|
|
|
|
|
2020-06-11 03:42:31 +02:00
|
|
|
### Debian and Ubuntu
|
2019-01-18 11:08:28 +01:00
|
|
|
|
|
|
|
```bash
|
2019-01-18 14:08:12 +01:00
|
|
|
sudo apt install vagrant vagrant-libvirt libvirt-daemon-system vagrant-mutate libvirt-dev
|
2021-04-08 19:33:32 +02:00
|
|
|
sudo usermod -aG libvirt $USER
|
2019-01-18 11:08:28 +01:00
|
|
|
|
2019-01-18 14:08:12 +01:00
|
|
|
# Reboot
|
2019-01-18 11:08:28 +01:00
|
|
|
|
2021-06-18 22:37:43 +02:00
|
|
|
vagrant box add bento/ubuntu-18.04 --provider=virtualbox
|
|
|
|
vagrant mutate bento/ubuntu-18.04 libvirt
|
|
|
|
vagrant up ubuntu-bionic --provider=libvirt
|
2019-01-18 11:08:28 +01:00
|
|
|
```
|
|
|
|
|
2020-06-11 03:42:31 +02:00
|
|
|
### Other Distributions
|
2019-01-18 11:08:28 +01:00
|
|
|
|
|
|
|
You will need to install [libvirt](https://libvirt.org/) and `vagrant-mutate` and then run
|
|
|
|
|
|
|
|
```bash
|
|
|
|
vagrant plugin install vagrant-libvirt
|
|
|
|
sudo usermod -a -G libvirt $USER
|
|
|
|
|
2019-01-18 14:08:12 +01:00
|
|
|
# Reboot
|
2019-01-18 11:08:28 +01:00
|
|
|
|
|
|
|
vagrant plugin install vagrant-mutate
|
2021-06-18 22:37:43 +02:00
|
|
|
vagrant box fetch bento/ubuntu-18.04
|
|
|
|
vagrant mutate bento/ubuntu-18.04 libvirt
|
|
|
|
vagrant up ubuntu-bionic --provider=libvirt
|
2019-01-18 11:08:28 +01:00
|
|
|
```
|
|
|
|
|
2020-06-11 03:42:31 +02:00
|
|
|
## Starting LibreTime Vagrant
|
2017-03-10 12:32:45 +01:00
|
|
|
|
2019-01-18 11:08:28 +01:00
|
|
|
To get started you clone the repo and run `vagrant up`. The command accepts a parameter to
|
|
|
|
change the default provider if you have multiple installed. This can be done by appending
|
|
|
|
`--provider=virtualbox` or `--provider=libvirt` as applicable.
|
2017-03-10 12:32:45 +01:00
|
|
|
|
|
|
|
```bash
|
|
|
|
git clone https://github.com/libretime/libretime.git
|
|
|
|
cd libretime
|
2021-06-18 22:37:43 +02:00
|
|
|
vagrant up ubuntu-bionic
|
2017-03-10 12:32:45 +01:00
|
|
|
```
|
|
|
|
|
2020-11-15 03:36:14 +01:00
|
|
|
If everything works out, you will find LibreTime on [port 8080](http://localhost:8080)
|
|
|
|
and Icecast on [port 8000](http://localhost:8000).
|
2017-03-10 12:32:45 +01:00
|
|
|
|
2019-01-18 11:08:28 +01:00
|
|
|
Once you reach the web setup GUI you can click through it using the default values. To
|
2021-06-18 22:37:43 +02:00
|
|
|
connect to the vagrant machine you can run `vagrant ssh ubuntu-bionic` in the libretime
|
2019-01-18 11:08:28 +01:00
|
|
|
directory.
|
2017-03-08 12:39:59 +01:00
|
|
|
|
2020-06-11 03:42:31 +02:00
|
|
|
## Alternative OS installations
|
2017-03-08 12:39:59 +01:00
|
|
|
|
2021-06-18 22:37:43 +02:00
|
|
|
With the above instructions LibreTime is installed on Ubuntu Bionic. The Vagrant setup
|
2019-01-18 11:08:28 +01:00
|
|
|
offers the option to choose a different operation system according to you needs.
|
2017-03-08 12:39:59 +01:00
|
|
|
|
2021-11-09 10:21:40 +01:00
|
|
|
| OS | Command | Comment |
|
|
|
|
| ------------ | ---------------------------- | ----------------------------------------------------------- |
|
|
|
|
| Debian 10 | `vagrant up debian-buster` | Install on Debian Buster. |
|
|
|
|
| Debian 11 | `vagrant up debian-bullseye` | Install on Debian Bullseye. |
|
|
|
|
| Ubuntu 18.04 | `vagrant up ubuntu-bionic` | Install on Ubuntu Bionic Beaver. |
|
|
|
|
| Ubuntu 20.04 | `vagrant up ubuntu-focal` | Install on Ubuntu Focal Fossa. |
|
|
|
|
| CentOS | `vagrant up centos` | CentOS 8 with native systemd support and activated SELinux. |
|
2017-03-10 12:32:45 +01:00
|
|
|
|
2020-06-11 03:42:31 +02:00
|
|
|
## Troubleshooting
|
2017-03-10 12:32:45 +01:00
|
|
|
|
2019-01-18 11:08:28 +01:00
|
|
|
If anything fails during the initial provisioning step you can try running `vagrant provision`
|
2019-10-22 11:52:18 +02:00
|
|
|
to re-run the installer.
|
2017-03-08 12:39:59 +01:00
|
|
|
|
2019-10-22 11:52:18 +02:00
|
|
|
If you only want to re-run parts of the installer, use `--provision-with $step`. The
|
2020-06-02 20:01:31 +02:00
|
|
|
supported steps are `prepare` and `install`.
|