Created
August 14, 2018 12:33
-
-
Save githubfoam/4afa70680fba8b84d80674965755fb08 to your computer and use it in GitHub Desktop.
Vagrant box manual ubuntu
This file contains hidden or 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
------------------------------------------------------------------------------------------ | |
#Create first a ubuntu virtualbox VM then convert to a vagrant box | |
------------------------------------------------------------------------------------------ | |
Create a new virtual machine with the following settings: | |
Memory Size: 1024MB (to taste) | |
New Virtual Disk: [Type: VMDK, Size: 40 GB] | |
Disable floppy | |
Disable audio | |
Disable USB | |
system-processor-1x | |
general-advanced-dragndrop-bidirectional | |
Ensure Network Adapter 1 is set to NAT | |
Add this port-forwarding rule: [Name: SSH, Protocol: TCP, Host IP: blank, Host Port: 2222, Guest IP: blank, Guest Port: 22] | |
INSTALL THE OPERATING SYSTEM | |
standard partition-auto | |
set hostname ; vagranthost | |
network disabled | |
sudo passwd root | |
set the user to vagrant and the password to vagrant. | |
make this user administrator | |
sudo passwd root | |
su - | |
sudo apt-get xxx | |
update - Retrieve new lists of packages | |
upgrade - Perform an upgrade | |
dist-upgrade - Distribution upgrade, see apt-get(8) | |
autoremove - Remove automatically all unused packages | |
autoclean - Erase old downloaded archive files | |
sudo mount /dev/cdrom /mnt | |
cd /mnt | |
sudo ./VBoxLinuxAdditions.run | |
sudo umount /dev/cdrom /mnt | |
verify | |
lsmod | grep vboxguest | |
sudo reboot | |
sudo apt-get install -y gcc make perl | |
disable firewall | |
sudo systemctl disable ufw | |
sudo systemctl stop ufw | |
sudo systemctl status ufw | |
make sure ssh is working | |
INSTALL AND CONFIGURE OPENSSH SERVER | |
sudo apt-get install -y openssh-server | |
sudo visudo -f /etc/sudoers.d/vagrant | |
# add vagrant user | |
vagrant ALL=(ALL) NOPASSWD:ALL | |
sudo pwd | |
INSTALL THE VAGRANT KEY | |
mkdir -p /home/vagrant/.ssh | |
chmod 700 /home/vagrant/.ssh | |
wget --no-check-certificate \ | |
https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub \ | |
-O /home/vagrant/.ssh/authorized_keys | |
chmod 600 /home/vagrant/.ssh/authorized_keys | |
chown -R vagrant /home/vagrant/.ssh | |
#MISSING PART | |
sudo nano /etc/ssh/sshd_config | |
#Find and uncomment the following line because we added the Vagrant key above to the authorized_keys file: | |
AuthorizedKeysFile %h/.ssh/authorized_keys | |
#“zero out” the drive. | |
sudo dd if=/dev/zero of=/EMPTY bs=1M | |
sudo rm -f /EMPTY | |
cat /dev/null > ~/.bash_history && history -c && exit | |
vagrant package --base ubuntu1604 --output ubuntu1604.box | |
vagrant box add "ubuntu1604desktop" ubuntu1604.box | |
vagrant box list | |
vagrant init ubuntu1604 | |
vagrant up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment