When I tried to run kubernetes (minikube) on CentOS7 on VirtualBox (mac + vagrant), I had to install VirtualBox on CentOS7.
I will describe the procedure at that time.
Refer to the official website page below and add the virtualBox yum repository to CentOS.
$ sudo wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo
On the official website page
Note that importing the key is not necessary for yum users (Oracle Linux/Fedora/RHEL/CentOS) when using one of the virtualbox.repo files from below as yum downloads and imports the public key automatically!
(Google translation) yum automatically downloads and imports the public key, so if you use any of the virtualbox.repo files from below, give the key to yum users (Oracle Linux / Fedora / RHEL / CentOS) No need to import.
Is written, but that is not the case.
Because later to see which version can be installed
yum list |grep Virtual
This is because the public key for tampering check must be imported into CentOS in advance. So you will eventually need to import this public key. (Of course, this is not the case if you know the installable version in advance.)
Import the public key as described on the official website.
wget https://www.virtualbox.org/download/oracle_vbox.asc
sudo rpm --import oracle_vbox.asc
Check the version of VirtualBox that can be installed.
$ yum list |grep Virtual
VirtualBox-4.3.x86_64 4.3.40_110317_el7-1 virtualbox
VirtualBox-5.0.x86_64 5.0.40_115130_el7-1 virtualbox
VirtualBox-5.1.x86_64 5.1.38_122592_el7-1 virtualbox
VirtualBox-5.2.x86_64 5.2.38_136252_el7-1 virtualbox
VirtualBox-6.0.x86_64 6.0.18_136238_el7-1 virtualbox
VirtualBox-6.1.x86_64 6.1.4_136177_el7-1 virtualbox
Install the latest version.
sudo yum install VirtualBox-6.1.x86_64
Let's check if virtualbox works.
$ virtualbox
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (3.10.0-957.12.2.el7.x86_64) or it failed to
load. Please recompile the kernel module and install it by
sudo /sbin/vboxconfig
You will not be able to start VMs until this problem is fixed.
Qt FATAL: QXcbConnection: Could not connect to display
Aborted
I got an error. The error message says to execute sudo / sbin / vboxconfig
, so let's execute it obediently.
$ sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-957.12.2.el7.x86_64
An error has occurred. Looking at the error message,
Please install the gcc make perl packages from your distribution.
Since it is said that it will be installed obediently.
$ sudo yum install gcc make perl
In addition, the error message also contained the following:
Please install the Linux kernel "header" files matching the current kernel for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-957.12.2.el7.x86_64
Since there is no kernel-devel, install it obediently as well.
$ sudo yum install kernel-devel
Restart CentOS for the settings to take effect and try again. (Reboot may not be necessary)
$ sudo /sbin/vboxconfig
Please install the Linux kernel "header" files matching the current kernel for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-957.12.2.el7.x86_64
that? The same error because there is no "kernel-devel".
I wondered if SELinux was involved, so I tried disabling SELinux, but the situation did not change.
After a lot of research, it seemed that the cause was that the kernel-devel corresponding to the kernel version of CentOS was not installed.
$ sudo yum install kernel-devel
If you do, the latest version of kenel-devel will be installed. The latest version of kenel-devel is inconsistent with the version of the CentOS kernel, so an error occurred.
See the explanation below for details. It will be very helpful. Follow the steps described here to install kernel-devel, which is consistent with your CentOS kernel version. https://qiita.com/metheglin/items/60261f474ccdfb467574
Then try again.
$ sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
It finally worked!
This time, I was running CentOS7 on a Mac VirtualBox and trying to run VirtualBox on that CentOS. As a result, I tried to run kubernetes (minikube) on CentOS.
Running more VMs in these VMs is called "Nested VM".
However, this nested VM was not available on the Mac VirutualBox. It seems that it only supports AMD CPUs, and it can not be used with Mac Intel CPUs. It was a pity that I did my best like this article.
I gave up running kubernetes on CentOS 7 on VirtualBox and decided to run it on mac (end).
Recommended Posts