由于是Ubuntu Server,所以没有图形界面,能从Windows的宿主机上共享可执行文件就显得尤其重要,本文记录主要的步骤以供参考。
deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
deb http://mirrors.sohu.com/ubuntu/ precise main restricted
deb-src http://mirrors.sohu.com/ubuntu/ precise main restricted
deb http://mirrors.sohu.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.sohu.com/ubuntu/ precise-updates main restricted
deb http://mirrors.sohu.com/ubuntu/ precise universe
deb-src http://mirrors.sohu.com/ubuntu/ precise universe
deb http://mirrors.sohu.com/ubuntu/ precise-updates universe
deb-src http://mirrors.sohu.com/ubuntu/ precise-updates universe
deb http://mirrors.sohu.com/ubuntu/ precise multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-updates multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.sohu.com/ubuntu/ precise-security main restricted
deb http://mirrors.sohu.com/ubuntu/ precise-security universe
deb-src http://mirrors.sohu.com/ubuntu/ precise-security universe
deb http://mirrors.sohu.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
第一步:为快速更新依赖补丁,需要更换一下Ubuntu的源,这里以12.04为例:
如果是刚安装好的Server版,那么可以用如下命令修改替换官方的源:
$sudo cp /etc/apt/sources.list
/etc/apt/sources.list.bak
$sudo sed -i 's/us.archive.ubuntu.com/mirrors.sohu.com/g'
/etc/apt/sources.list
$sudo
sed -i 's/security.ubuntu.com/mirrors.sohu.com/g'
/etc/apt/sources.list
如果是Desktop版,直接使用
sudo gedit /etc/apt/sources.list修改好了
####163 更新源####
####SOHU更新源####
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.apt
$ sudo vim /etc/apt/sources.list
#更替163源或者sohu源
$ sudo apt-get update
在出现key找不到的错误时,执行:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys < 根据提示add keys here >
$ sudo apt-get update
第二步:在VirtualBox设置共享文件夹
在设备(Device)下面设置共享文件夹,这里注意选择固定分配,并且不要自动挂载,如图所示:
第三步:安装VirtualBox Guest Additions,并挂载共享文件夹至mnt目录
#挂载VBoxLinuxAdditions安装介质
$ sudo mount /dev/cdrom /media/cdrom
$ ls -l /media/cdrom/
$ sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
#安装VirtualBox Guest Additions
$ sudo /media/cdrom/VBoxLinuxAdditions.run
#挂载共享目录
$ sudo mount -t vboxsf shared /mnt
大功告成!