Skip to main content

Install Virtualbox on Centos 7

1. Change to root User



Bash



su -
## OR ##
sudo -i

2. Install Fedora or RHEL Repo Files



Bash



cd /etc/yum.repos.d/

## Fedora 26/25/24/23/22/21/20/19/18/17/16 users
wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

## CentOS 7.4/6.9 and Red Hat (RHEL) 7.4/6.9 users
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

3. Update latest packages and check your kernel version


Update packages

Bash



## Fedora 26/25/24/23/22 ##
dnf update

## Fedora 21/20/19/18/17/16 and CentOS/RHEL 7/6/5 ##
yum update




While executing yum update if you get any dependency errorfor glibc use the following to resolve it:

rpm -qa | grep glibc
You may see duplicates for either glibc or glibc common. There might be a common version in between any two packages of glibc and glibc-common. Remove the package which has uncommon version.

You can also check for duplicates with the following command:
yum list --showduplicates glibc

rpm -e glibc-common-2.17-196.el7
rpm -qa kernel |sort -V |tail -n 1

uname -r

Note: If you got kernel update or run older kernel than newest installed then reboot:

Bash



reboot

4. Install following dependency packages


CentOS 7/6/5 and Red Hat (RHEL) 7/6/5 needs EPEL repository, install it with following command:

Bash



## CentOS 7 and RHEL 7 ##
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

## CentOS 6 and RHEL 6 ##
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

## CentOS 5 and RHEL 5 ##
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm


Bash



## Fedora 26/25/24/23/22 ##
dnf install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

## Fedora 21/20/19/18/17/16 and CentOS/RHEL 7/6/5 ##
yum install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

## PAE kernel users install ##
## Fedora 24/23/22 ##
dnf install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-PAE-devel dkms

## Fedora 21/20/19/18/17/16 and CentOS/RHEL 7/6/5 ##
yum install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-PAE-devel dkms

5. Install VirtualBox Latest Version 5.1 (currently 5.1.28)



Bash



## Fedora 26/25/24/23/22 ##
dnf install VirtualBox-5.1

## Fedora 21/20/19/18/17/16/15/14 and CentOS/RHEL 7/6/5 ##
yum install VirtualBox-5.1

Note:
This command create automatically vboxusers group and VirtualBox user must be member of that group.
This command also build needed kernel modules.
Package is VirtualBox-5.1 not VirtualBox.

Rebuild kernel modules with following command:

Bash



## Fedora 26/25/24/23/22/21/20/19 and CentOS/RHEL 7 ##
/usr/lib/virtualbox/vboxdrv.sh setup

## Fedora 18/17/16 and CentOS/RHEL 6/5 ##
/etc/init.d/vboxdrv setup
## OR ##
service vboxdrv setup

You might get the following error:

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is not currently set up to build kernel modules (system extensions).
Running the following commands should set the system up correctly:

yum install kernel-devel-3.10.0-327.28.2.el7.x86_64
(The last command may fail if your system is not fully updated.)
yum install kernel-devel
vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong.

Execute the following: yum install kernel-devel

If the error still persists look in the log: /var/log/vbox-install.log
If you find the following error: Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
## Current running kernel on Fedora ##
KERN_DIR=/usr/src/kernels/`uname -r`

## Current running kernel on CentOS and Red Hat (RHEL) ##
KERN_DIR=/usr/src/kernels/`uname -r`-`uname -m`

## Fedora example ##
KERN_DIR=/usr/src/kernels/2.6.33.5-124.fc13.i686

## CentOS and Red Hat (RHEL) example ##
KERN_DIR=/usr/src/kernels/2.6.18-194.11.1.el5-x86_64

## Export KERN_DIR ##
export KERN_DIR

Make sure your system is rebooted.

6. Add VirtualBox User(s) to vboxusers Group


Replace user_name with your own user name or some another real user name.

Bash



usermod -a -G vboxusers user_name

7. Start VirtualBox


Use launcher from menu or simply run:

Bash



VirtualBox

Comments

  1. Very useful information, Onlive Server is committed to providing reliable best, and cheapest Ukraine VPS Server, and all web hosting with protection from any encroachment, maintaining our client’s rights to full freedom of information and independence.

    ReplyDelete

Post a Comment

Popular posts from this blog

Terraform

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied. The infrastructure Terraform can manage includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc. The key features of Terraform are: Infrastructure as Code : Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and...

Salt stack issues

The function “state.apply” is running as PID Restart salt-minion with command:  service salt-minion restart No matching sls found for ‘init’ in env ‘base’ Add top.sls file in the directory where your main sls file is present. Create the file as follows: 1 2 3 base: 'web*' : - apache If the sls is present in a subdirectory elasticsearch/init.sls then write the top.sls as: 1 2 3 base: '*' : - elasticsearch.init How to execute saltstack-formulas create file  /srv/pillar/top.sls  with content: base : ' * ' : - salt create file  /srv/pillar/salt.sls  with content: salt : master : worker_threads : 2 fileserver_backend : - roots - git gitfs_remotes : - git://github.com/saltstack-formulas/epel-formula.git - git://github.com/saltstack-formulas/git-formula.git - git://github.com/saltstack-formulas/nano-formula.git - git://github.com/saltstack-f...

Helm: Installation and Configuration

PREREQUISITES You must have Kubernetes installed. We recommend version 1.4.1 or later. You should also have a local configured copy of  kubectl . Helm will figure out where to install Tiller by reading your Kubernetes configuration file (usually  $HOME/.kube/config ). This is the same file that  kubectl  uses. To find out which cluster Tiller would install to, you can run  kubectl config current-context or  kubectl cluster-info . $ kubectl config current-context my-cluster INSTALL HELM Download a binary release of the Helm client. You can use tools like  homebrew , or look at  the official releases page . For more details, or for other options, see  the installation guide . INITIALIZE HELM AND INSTALL TILLER Once you have Helm ready, you can initialize the local CLI and also install Tiller into your Kubernetes cluster in one step: $ helm init This will install Tiller into the Kubernetes cluster you saw with  kubectl config current-context . TIP:  Want to install into a different cl...