Buscar este blog

Mostrando entradas con la etiqueta Virtual Box. Mostrar todas las entradas
Mostrando entradas con la etiqueta Virtual Box. Mostrar todas las entradas

sábado, 30 de diciembre de 2017

Centos 7.x - Minimal network setup

This is a continuation of a previous post, but this time dedicated to CentOS 7 (our customer is evolving!!)

Environment:
  • Virtualbox 5.1.10
  • CentOS 7.4.1708
Before start with the installation, in Virtualbox you have to configure two network adapters:
  • Adapter 1: Host only
  • Adapter 2: NAT
The first one will be used to communicate host and guest, for example, by using a ssh connection. The second one will be used by the guest in order to gain direct access to the internet.

When CentOS starts for first time, you will already had internet access. But local network will be disabled. Execute the following command to check your network interfaces:
ip add

The result will be something like this:


Here you can see three interfaces:
  • lo: Loopback
  • enp0s3: Host-Only adapter
  • enp0s8: NAT adapter
If you have doubts about which is the host-only, you can check the MAC address and compare it with the Virtualbox adapter.


Once you are sure enp0s3 is your interface, go to /etc/sysconfig/network-scripts/ and edit ifcfg-enp0s3 file, for example with vi. You will have to make two changes:
  • Set BOOTPROTO=none
  • Set ONBOOT=yes
  • Add IPADDR=your IP

Then execute the following command:
systemctl restart network.service

Now you will have your interface up and with the IP address you set before.


Note

As stated in my previous post, remember to configure proxy settings for system and yum configuration:

System config

Edit ~/.bash_profile file and add the following lines:

# The Web proxy server used by this account
http_proxy="http://usuario:password@my.proxy:8080"
export no_proxy=localhost,127.0.0.1
export http_proxy

YUM config

Edit  /etc/yum.conf y add the following lines:

# The proxy server - proxy server:port number
proxy=http://my.proxy:8080
# The account details for yum connections
proxy_username=usuario
proxy_password=password

domingo, 18 de octubre de 2015

Virtual Box - CentOS - Shrink VMDK disk

We start with a bunch of VMDK files and we want to shrink their size. The steps are as follow:
1) Unlink el VMDK of the virtual machine from VirtualBox

2) Convert the VMDK to VDI
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd --format VDI CentOS6.6-base.vmdk Integracion.vdi

3) Link the VDI again to the virtual machine

4) Nullify the empty space (this example is for CentOS)
dd if=/dev/zero of=/bigemptyfile bs=4096k
rm -rf /bigemptyfile

5) Compact the VDI
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd Integracion.vdi --compact

6) Convert the VDI to VMDK, and specify the split option
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd --format VMDK Integracion.vdi Centos-Integracion.vmdk --variant Split2G

7) Link de VMDK to the virtual machie


Note: VBoxManage is one of the command-line tools which are installed with Virtual Box.