在VirtualBox4.2.12上安装Ubuntu&n…

由于是Ubuntu Server,所以没有图形界面,能从Windows的宿主机上共享可执行文件就显得尤其重要,本文记录主要的步骤以供参考。
第一步:为快速更新依赖补丁,需要更换一下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 更新源####
  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

####SOHU更新源####
  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

$ 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)下面设置共享文件夹,这里注意选择固定分配,并且不要自动挂载,如图所示:
在VirtualBox4.2.12上安装Ubuntu <wbr>Server <wbr>12.04 <wbr>LTS共享文件夹

第三步:安装VirtualBox Guest Additions,并挂载共享文件夹至mnt目录
#挂载VBoxLinuxAdditions安装介质
$ sudo mount /dev/cdrom /media/cdrom
$ ls -l /media/cdrom/
在VirtualBox4.2.12上安装Ubuntu <wbr>Server <wbr>12.04 <wbr>LTS共享文件夹
#安装所需依赖包
$ 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

大功告成! 在VirtualBox4.2.12上安装Ubuntu <wbr>Server <wbr>12.04 <wbr>LTS共享文件夹
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值