Difference between revisions of "Vagrant and VirtualBox install on Ubuntu 18"

From MyWiki
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list.d/virtualbox.list'
 
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list.d/virtualbox.list'
 
</source>
 
</source>
3. Install some required packages
+
3. Install some required packages and then install VirtualBox
 
<source lang="text">
 
<source lang="text">
 
sudo apt update
 
sudo apt update
 
sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms
 
sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms
 +
sudo apt-get install virtualbox-5.2
 
</source>
 
</source>
 +
4. We now need to sign the VirtualBox modules.
 +
<source lang="text">
 +
$ sudo -i
 +
# mkdir /root/module-signing
 +
# cd /root/module-signing
 +
# openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=YOUR_NAME/"
 +
[...]
 +
# chmod 600 MOK.priv
 +
 +
# mokutil --import /root/module-signing/MOK.der
 +
input password:
 +
input password again:
 +
 +
</source>
 +
5. Create the script /root/module-signing/sign-vbox-modules with the following content:
 +
<source lang="text">
 +
#!/bin/bash
 +
 +
for modfile in $(dirname $(modinfo -n vboxdrv))/*.ko; do
 +
  echo "Signing $modfile"
 +
  /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 \
 +
                                /root/module-signing/MOK.priv \
 +
                                /root/module-signing/MOK.der "$modfile"
 +
done
 +
 +
 +
</source>
 +
chmod 700 /root/module-signing/sign-vbox-modules<br>
 +
Run the script as root<br>
 +
modprobe vboxdrv<br>

Latest revision as of 13:56, 28 July 2018

https://websiteforstudents.com/install-the-latest-virtualbox-on-ubuntu-18-04-lts/
https://stegard.net/2016/10/virtualbox-secure-boot-ubuntu-fail/
1. Add the VirtualBox repository key:

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

2. Add the VirtualBox repository

sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list.d/virtualbox.list'

3. Install some required packages and then install VirtualBox

sudo apt update
sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms
sudo apt-get install virtualbox-5.2

4. We now need to sign the VirtualBox modules.

$ sudo -i
# mkdir /root/module-signing
# cd /root/module-signing
# openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=YOUR_NAME/"
[...]
# chmod 600 MOK.priv
 
# mokutil --import /root/module-signing/MOK.der
input password:
input password again:

5. Create the script /root/module-signing/sign-vbox-modules with the following content:

#!/bin/bash
 
for modfile in $(dirname $(modinfo -n vboxdrv))/*.ko; do
  echo "Signing $modfile"
  /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 \
                                /root/module-signing/MOK.priv \
                                /root/module-signing/MOK.der "$modfile"
done

chmod 700 /root/module-signing/sign-vbox-modules
Run the script as root
modprobe vboxdrv