上一篇為Guest Ubuntu編譯內(nèi)核我們?yōu)閂agrant的Guest Ubuntu編譯了內(nèi)核梁丘,現(xiàn)在我們要在Vagrant的Guest OS中安裝,并啟動自己的內(nèi)核色徘。
root@ubuntu:~/vagrant# vagrant up
root@ubuntu:~/vagrant# vagrant ssh
# Guest Ubuntu shell
vagrant@ubuntu-xenial:~$ cd /vagrant/obj/
vagrant@ubuntu-xenial:~/vagrant/obj/$ ls -lah --time-style='+' *.deb
-rw-r--r-- 1 vagrant vagrant 11M linux-headers-4.16.0+_4.16.0+-1_amd64.deb
-rw-r--r-- 1 vagrant vagrant 50M linux-image-4.16.0+_4.16.0+-1_amd64.deb
-rw-r--r-- 1 vagrant vagrant 490M linux-image-4.16.0+-dbg_4.16.0+-1_amd64.deb
-rw-r--r-- 1 vagrant vagrant 967K linux-libc-dev_4.16.0+-1_amd64.deb
我們現(xiàn)在只需要安裝linux-image和linux-headers很洋,
vagrant@ubuntu-xenial:~/vagrant/obj/$ sudo dpkg -i ./linux-image*.deb
vagrant@ubuntu-xenial:~/vagrant/obj/$ sudo dpkg -i ./linux-headers*.deb
裝好以后失乾,就可以重新啟動新的內(nèi)核了宪哩,到Host Ubuntu的Shell中:
root@ubuntu:~/vagrant# vagrant reload
重啟之后,再進(jìn)入Guest Ubuntu驗證內(nèi)核版本:
root@ubuntu:~/vagrant# vagrant ssh
vagrant@ubuntu-xenial:~$ uname -r
4.16.0+
vagrant@ubuntu-xenial:~$ ls /vagrant
可以看到已經(jīng)是新的內(nèi)核了第晰,但是共享目錄/vagrant是空的锁孟,這是因為新的內(nèi)核中還沒有安裝VirtualBox Guest Additions,首先我們要在Host中驗證VirtualBox的版本號:
root@ubuntu:~/vagrant# vboxmanage --version
5.1.34_Ubuntur121010
然后到這里下載相同版本的Guest Additions茁瘦,我的版本是5.1.34品抽,在Guest Ubuntu中,下載并安裝:
vagrant@ubuntu-xenial:~$ wget http://download.virtualbox.org/virtualbox/5.1.34/VBoxGuestAdditions_5.1.34.iso
vagrant@ubuntu-xenial:~$ sudo mount -o loop ./VBoxGuestAdditions_5.1.34.iso /mnt/
vagrant@ubuntu-xenial:~$ sudo /mnt/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.34 Guest Additions for Linux...........
VirtualBox Guest Additions installer
This system appears to have a version of the VirtualBox Guest Additions
already installed. If it is part of the operating system and kept up-to-date,
there is most likely no need to replace it. If it is not up-to-date, you
should get a notification when you start the system. If you wish to replace
it with this version, please do not continue with this installation now, but
instead remove the current version first, following the instructions for the
operating system.
If your system simply has the remains of a version of the Additions you could
not remove you should probably continue now, and these will be removed during
installation.
Do you wish to continue? [yes or no]
yes
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Starting the VirtualBox Guest Additions.
Could not find the X.Org or XFree86 Window System, skipping.
安裝完成以后甜熔,重啟Guest Ubuntu圆恤,然后看到Mounting shared folders...不報錯,就說明共享目錄可以訪問了腔稀。
root@ubuntu:~/vagrant# vagrant reload
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => /root/vagrant
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
root@ubuntu:~/vagrant# vagrant ssh
下一篇介紹如何用kgdb調(diào)試這個內(nèi)核盆昙。