Last active
June 25, 2018 14:12
-
-
Save hkorpi/91193898adf2078e5265 to your computer and use it in GitHub Desktop.
create vagrant box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Required linux packages for vagrant | |
sudo apt-get install linux-headers-generic build-essential dkms | |
# Install VBoxGuestAdditions | |
wget http://download.virtualbox.org/virtualbox/4.3.22/VBoxGuestAdditions_4.3.22.iso | |
sudo mkdir /media/VBoxGuestAdditions | |
sudo mount -o loop,ro VBoxGuestAdditions_4.3.22.iso /media/VBoxGuestAdditions | |
sudo sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run | |
rm VBoxGuestAdditions_4.3.22.iso | |
sudo umount /media/VBoxGuestAdditions | |
sudo rmdir /media/VBoxGuestAdditions | |
# Create vagrant user | |
echo "vagrant" | openssl passwd -1 -stdin | |
# $1$rEQKVH3j$k9O1r5TDjN.sBhELJP.ID. | |
sudo useradd --create-home --home-dir /home/vagrant --password '$1$rEQKVH3j$k9O1r5TDjN.sBhELJP.ID.' --shell /bin/bash --user-group vagrant | |
sudo bash -c 'echo "vagrant ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vagrant' | |
sudo apt-get install openssh-server | |
# Add vagrant key to vagrant | |
sudo su - vagrant | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment