#Building with vagrant a Fedora Rawhide BOX
Quick example on how to build a rawhide linux to be used by vagrant on virtual box.
##Requirements
Please install the following packages to your local linux environment:
yum install vagrant yum install VirtualBox
##Fetch distribution
We consider the latest fedora rawhide 64-bit boot image available on:
http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/images/boot.iso
##VirtualBox Distro Setup
Create a new VM on virtual box with the following properties:
- Install with 2GB RAM
- A single CPU is ok for now
- Remove USB devices
- Remove AUDIO devices
- Enable clipboard bidirectional support from device's advanced settings
- Insert boot image in the virtual cdrom device
- Start VM
- Install minimal fedora
- Add user vagrant and make sure you check that this user acts like administrator as well
- Finish install
##VirtualBox Distro Configuration
- Reboot in rescue mode:
Once in boot screen press *e* on the rescue selection At the end of the kernel line put *rw init=/bin/bash* CTRL+x to boot
- Change root user password to vagrant
passwd root
- Change vagrant user password to vagrant
passwd vagrant
- visudo -f /etc/sudoers.d/vagrant and put this to not allow passwd:
vagrant ALL=(ALL) NOPASSWD:ALL
- Test sudo:
sudo ls
- If it prompts you for passwd visudo and check that the wheel group requires nopasswd as well and retest.
- vi /etc/sysconfig/selinux and set selinux to DISABLED.
- Install vagrant ssl:
mkdir -p /home/vagrant/.ssh chmod 0700 /home/vagrant/.ssh wget --no-check-certificate \ https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub \ -O /home/vagrant/.ssh/authorized_keys chmod 0600 /home/vagrant/.ssh/authorized_keys chown -R vagrant /home/vagrant/.ssh
- /sbin/reboot -f
- Check that you can login to the system.
##VirtualBox Distro Fine-Tunning
- Install the following packages:
yum install openssh-server yum install docker yum install ansible yum install cowsay yum install bind-utils yum install kernel-devel yum install bzip2 yum install dkms yum install wget yum install curl yum install gcc
-
vi /etc/ssh/sshd_config and put UseDns=NO
-
Install virtual box guest tools:
From device menu -> Click *Insert Guest Additions CD Image* mount /dev/cdrom cd sudo ./VBoxLinuxAdditions.run
##VirtualBox Distro Packaging
- Avoid defragmentation:
sudo dd if=/dev/zero of=/EMPTY bs=1M sudo rm -f /EMPTY
-
Change directory to the parrent dir that contains your virtual box image.
-
vagrant package --base <your_vm_folder_name>
-
That's it!
##References
http://www.virtualbox.org/manual/ch04.html
http://www.virtualbox.org/manual/ch02.html
https://fedoraproject.org/wiki/Releases/Rawhide
https://blog.engineyard.com/2014/building-a-vagrant-box
http://www.skoblenick.com/vagrant/creating-a-custom-box-from-scratch/