Objective
To have a common development environment.
Requirements
Step by step creating the environment
C:\Vagrant\DevBlockcerts
inside the folder we created the following structure, 2 folders and a file called Vagrantfile:
download the file VBoxGuestAdditions_6.0.12.iso from the path http://download.virtualbox.org/virtualbox/6.0.12/ and store it in the shared folder.
download the file VBoxGuestAdditions_6.0.12.iso from the path http://download.virtualbox.org/virtualbox/6.0.12/ and store it in the shared folder.
The contents of the setup.sh file are as follows:
********************************************************************** contents of the setup.sh file.
#!/bin/sh
# update the system
apt-get update -y
apt-get upgrade -y
################################################################################
# Install VBoxGuestAdditions
################################################################################
echo ' ********* INSTALACION VBoxGuestAdditions ************** '
cp -ap C://Vagrant//Composer//share//. /home/vagrant/share/
mkdir temp
sudo cp share/VBoxGuestAdditions_6.0.12.iso /home/vagrant/temp
sudo mkdir -p temp/imagen
sudo mount -o loop temp/VBoxGuestAdditions_6.0.12.iso temp/imagen
sudo sh ./temp/imagen/VBoxLinuxAdditions.run
################################################################################
# Install xfce4
################################################################################
echo ' 2. ***************************** '
localectl set-x11-keymap pt
apt-get install -y xfce4 lightdm lightdm-gtk-greeter
apt-get install -y xfce4-terminal
#apt-get install -y xfce4-whiskermenu-plugin
apt-get install -y xfce4-taskmanager
#apt-get install -y menulibre
################################################################################
# Install docker y docker-compose
################################################################################
echo ' 4. ***************************** '
apt-get update
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
apt-get update
apt-cache policy docker-engine
apt-get install -y docker-engine
systemctl status docker
usermod -aG docker vagrant
Instalamos en Docker Composer
curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
################################################################################
# Install chrome
################################################################################
echo ' 3. ***************************** '
wget -c https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
apt-get -y install libappindicator1
dpkg -i google-chrome-stable_current_amd64.deb
apt-get -y install -f
echo ' ********* FIN INSTALACION ************** '
**********************************************************************************end of the contents of the setup.sh file.
contents of the Vagrantfile:
Vagrant.configure("2") do |config|
required\_plugins = %w\( vagrant-vbguest vagrant-disksize \)
\_retry = false
required\_plugins.each do \|plugin\|
unless Vagrant.has\_plugin? plugin
system "vagrant plugin install \#{plugin}"
\_retry=true
end
end
if \(\_retry\)
exec "vagrant " + ARGV.join\(' '\)
end
config.disksize.size = '50GB'
config.vm.box = "bento/ubuntu-18.04"
config.ssh.insert\_key = true
config.vm.synced_folder "share", "/home/vagrant/share"
config.vm.provider :virtualbox do \|vb\|
vb.gui = true
\# Use VBoxManage to customize the VM. For example to change memory:
vb.customize \["modifyvm", :id, "--name", "DevBlockcerts"\]
vb.customize \["modifyvm", :id, "--memory", "4096"\]
vb.customize \["modifyvm", :id, "--cpus", 2\]
vb.customize \['modifyvm', :id, '--clipboard', 'bidirectional'\]
vb.customize \['modifyvm', :id, '--draganddrop', 'bidirectional'\]
end
end
We open a DOS terminal and place ourselves in the work folder.
we execute the following command:
vagrant up
and we give in.
At the end of the installation we visualize the following in the CMD terminal.
we also see that there is a virtual machine active:
we entered the virtual machine:
vagrant
vagrant
we run the setup file:
ls
cd share
sudo sh setup.sh
and we're looking at the actions to be taken:
this indicates end of installation, we execute:
ctrl + c
we execute the command:
shutdown -r now