Skip to content

Instantly share code, notes, and snippets.

@stegrams
Last active September 9, 2019 20:49
Show Gist options
  • Save stegrams/8f479a78a63278c323680693aff6d12c to your computer and use it in GitHub Desktop.
Save stegrams/8f479a78a63278c323680693aff6d12c to your computer and use it in GitHub Desktop.
Convert a Turnkey appliance (https://www.turnkeylinux.org) in to a Vagrant box. This is about VirtualBox and the Laravel flavor but it's expected to work with any debian based Turnkey appliances.
1. Download ova from https://www.turnkeylinux.org/laravel
2. Import ova to VirtualBox.
3. Add an empty optical drive to machine
4. Run the machine and login as root
5. Exec ```apt-get install linux-headers-$(uname -r) build-essential dkms sudo```
6. Insert Guest Additions CD image.
7. Exec ```mkdir /media/cdrom```
8. Exec ```mount /dev/cdrom /media/cdrom/```
9. Exec ```sh /media/cdrom/VBoxLinuxAdditions.run```
10. Create the vagrant user ```adduser vagrant```
User: vagrant
Pass: vagrant
11. Make vagrant sudoer ```usermod -aG sudo vagrant```
12. Elevate vagrant to run sudo with no password:
a. Exec ```visudo -f /etc/sudoers.d/vagrant```
b. Write 'vagrant ALL=(ALL) NOPASSWD:ALL' and save.
13. Change to vagrant ```su vagrant```
14. In /home/vagrant/.ssh create a file 'authorized_keys' with content:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
15. Shutdown machine
16. Package machine by executing:
```vagrant package --base 'TURNKEY LARAVEL' --output tk_laravel.box```
'TURNKEY LARAVEL' is the machine name appeared on VirtualBox after ova import (step 2).
17. Add box by executing ```vagrant box add tk_laravel.box --name tk_laravel```
18. Create a 'Vagrantfile' with content:
Vagrant.configure("2") do |config|
config.vm.box = "tk_laravel"
end
19. Exec ```vagrant up```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment