Ferramentas do usuário

Ferramentas do site


vagrant:create_box

Links para ver

Create a BOX


set USER and PASSWORD define vagrant
set PASSWORD root define vagrant

   $ sudo apt-get install dkms
   $ sudo apt-get install -y build-essential linux-headers-server

$ sudo mount /dev/cdrom /media/cdrom
$ sudo /media/cdrom/VBoxLinuxAdditions.run
$ sudo umount /media/cdrom
$ sudo apt-get clean

$ sudo /etc/init.d/vboxadd setup
$ sudo apt-get update -y

Add the vagrant user to sudoers file

$ sudo echo "vagrant ALL=NOPASSWD:ALL" >> /etc/sudoers.d/vagrant
$ sudo chmod 0440 /etc/sudoers.d/vagrant

Install Vagrant Public Keys

$ mkdir ~/.ssh
$ wget -qO- https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub >> ~/.ssh/authorized_keys

# Ensure we have the correct permissions set
$ chmod 0700 /home/vagrant/.ssh
$ chmod 0600 /home/vagrant/.ssh/authorized_keys
$ chown -R vagrant /home/vagrant/.ssh

Install OpenSSH Server

$ sudo apt-get install -y openssh-server
$ sudo vi /etc/ssh/sshd_config

Ensure the following is set

Port 22
PubKeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
PermitEmptyPasswords no
$ sudo service ssh restart

GRUB

Run Gedit as root (gksu gedit).

Open /etc/default/grub and locate the following lines:

GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true

Change the values as follows:

GRUB_HIDDEN_TIMEOUT=10
GRUB_HIDDEN_TIMEOUT_QUIET=false

Save and run sudo update-grub from your terminal and reboot.

Create Vagrant Base Box

Asuming you already have Vagrant installed in the host system, just run the following command:

$ vagrant package –-base <VitualBox VM Name>

Install the box

$ vagrant box add {boxname} package.box

Init a Vagrant Box by referencing the Base one we have created

$ vagrant init {boxname}

Edit the generated Vagrantfile by uncommenting the following lines

To show window VM

config.vm.provider "virtualbox" do |v|
v.gui = true
end

Spin it up!

$ vagrant up

ERROR

ifup_eth1
ERROR:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ip addr flush dev eth1 2> /dev/null
Stdout from the command:
Stderr from the command:
stdin: is not a tty
 
SOLUTION:
Ssh into the machine
Delete the file /etc/udev/rules.d/70-persistent-net.rules
Exit the machine
Do a "vagrant reload"
I think that does the trick =]
vagrant/create_box.txt · Última modificação: 2022/05/25 16:24 por 127.0.0.1