linux下装linux虚拟机(virtual box文件共享)

  因为要用到bochs的intelnal debugger和gdb-stub,两样功能是互斥的,于是决定装两个bochs,似乎linux系统上只能装一个(即使你切换用户装),只好把另一个bochs放到虚拟机的linux里,然后把主机的工作目录共享到虚拟机里。

  以前在win下虚拟过linux,在linux下虚拟过win,在linux(ubuntu)下虚拟linux(debian)还是头一次。

  用的是debian-6.0.6-i386-CD-1.iso,这个镜像文件就够用了。

  装好之后,发现连不上网。我是在学校,上网要过网关。用NAT不行,换成bridge,虚拟机的linux竟然也要登陆网关!我只有一个账户,只好把主机的下了。

  然后是测源,各大高校的源复制到sources.list里,apt-update时候总有乱七八糟的信息蹦出来,也不知道成功了没,还是换作网易163的源(当前是2013,9,6),稍微干净些,速度也将就。


# 网易163更新服务器:
deb http://mirrors.163.com/debian/ squeeze main non-free contrib
deb http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib

  捎带提一下,才装的linux,你可能想用apt-spy找源,但一般的源里是没有apt-spy这个东西的(这是个鸡蛋蛋鸡的问题),可以从这儿下http://ftp.de.debian.org/debian/pool/main/a/apt-spy/,然后自行安装。我是装好了,可惜生成的源是这样的:

wws@bogon:/etc/apt$ cat /etc/apt/sources.list.d/apt-spy.list.bak
# sources.list generated by apt-spy v3.2.2
#
# Generated using:
#
# apt-spy \
#     -d stable \
#     -a Asia \
#     -t 7
#
deb (null) stable main #contrib non-free
deb-src (null) stable main #contrib non-free
deb http://security.debian.org/ stable/updates main
-------------------------------------------------------------------

  不知道错在哪里,说不定就没装好。

  接着就是文件共享,这个网上教程很多。我现在setting里设置/home/wws/lab/asm1共享,名字是asm1。接着要在linux虚拟机里装guest additions,挂载上来的VBoxGuestAdditions_4.1.18.iso在/media里就找的到,这是个只读的文件系统,你要另建一个文件夹,把iso里的东西复制进去,才好执行./VBoxLinuxAdditions.run,不然总是permission denied。

  guest additions是否安装成功,用lsmod|grep vboxsf查看,什么都不输出,那就是失败了。

  我这里失败的原因是没安装kernel,debian下就是装linux header,用apt-get install linux-headers-`uname -r`。遇到个插曲:在网易的源上拿这个header奇慢,最后还有缺失。我运行了apt-get update之后再装,就很快完成了。问题是我几十分钟前才执行的apt-get update命令...

  重启,输入:mount -t vboxsf asm1 ~/lab,就把工作目录映射到虚拟机的lab目录了。

  编译bochs2.6时候,出现一大堆错误,原因是环境没配置好,看这篇文章:http://chaoyang.blog.ustc.edu.cn/index.php/archives/124

  把那4个库装上应该就好了。网上见到一群神去修改源码,据说也能通过,实在佩服。

posted on 2013-09-06 16:52  weiweishuo  阅读(434)  评论(0编辑  收藏  举报

导航