Install Oracle VirtualBox on CentOS/RedHat 6/5


Oracle VirtualBox is a cross-platform virtualization application(windows/linux). It extends the capabilities of your existing operating system so that it can run multiple operating systems at the same time.

Here we are going to see how to install VirtualBox on CentOS/RHEL using repoistory.

Step 1: Required yum repositories

First we need to create VirtualBox yum repository on linux server.

[root@server.local ~]#cd /etc/yum.repos.d/
[root@server.local ~]#wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

Download and install CentOS/RHEL EPEL repository

CentOS/RHEL 6, 32 Bit (i386):
[root@server.local ~]#rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

CentOS/RHEL 6, 64 Bit x86_64):
[root@server.local ~]#rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

CentOS/RHEL 5, 32 Bit (i386):
[root@server.local ~]#rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

CentOS/RHEL 5, 64 Bit (x86_64):
[root@server.local ~]#rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Step 2: Install dependency packages

Oracle VirtualBox requried some dependency packages to run virtualbox.

[root@server.local ~]#yum install gcc make patch dkms qt libgomp
[root@server.local ~]#yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel

Step 3: Environment variable configuration

VirtualBox installation required kernel source code to install required modues, so we need to configure environment variable KERN_DIR.

[root@server.local ~]#KERN_DIR=/usr/src/kernels/2.6.32-220.2.1.el6.i686
[root@server.local ~]#export KERN_DIR

Step 4: Install VirtualBox

The below command is used to install Oracle VirtualBox

[root@server.local ~]#yum install VirtualBox-4.3

Finally re-run vboxdrv setup. This step may take a while to complete:

[root@server.local ~]#/etc/init.d/vboxdrv setup

Step 5: Start VirtualBox

Use following command to start VirtualBox from X windows. You can switch to GUI mode using init 5 or startx commands from terminal.

[root@server.local ~]# virtualbox &

How to mount TMFS in Centos


TMFS is called as Temporary File System/Temporary File Storage

tmfs is used for shared memory concept. This is an efficient way to passing data between processes and this is used to speed up the linux operating system.

tmfs is mounted file system on every linux, instead of virtual memory this will use a storage device.

The command mount will show you a /dev/shm as a tempfs file system. So this is a file system, which keeps all files in virtual memory.

And tmpfs is temporary, so all files in the hard disk will save in temporary manner. If you unmount the /dev/shm file system all the data will be lost.

[root@server.local ~]#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
57G 16G 39G 29% /
/dev/sda1 99M 63M 31M 68% /boot
tmpfs 5.9G 0 5.9G 0% /dev/shm

Where tmfs is used?

Mostly tmfs is used in ERP system such as Oracle, SAP & Linux system performance. You can see the difference in heavily loaded servers.

How to increase the tmfs?

We have the feature of increasing the tmfs file system on the fly. The below is the example.

[root@server.local ~]#mount -o remount,size=8G /dev/shm

The above command will increase tmfs file system size from 6G to 8G. To make this changes on next boot, we have to add this in /etc/fstab file.

[root@server.local ~]#vi /etc/fstab

Modify /dev/shm entry

none /dev/shm tmpfs defaults,size=8G 0 0