zdc253212956 发表于 2015-4-14 10:53:23

(转)配置VirtualBox+CentOS的SSH+FTP及CentOS yum镜像

  接上(虚拟机VirtualBox+Centos+NAT网络的配置过程):装好VirtualBox后,在XP下进入网络邻居,多了个VirtualBox Host-Only Network。可知:

Host机的IP

Host机的IP:192.168.56.1
http://liucheng.yun.im/wp-content/uploads/2011/08/VirtualBox-3.png

虚拟机的IP
  在CentOS查看虚拟机的IP:

ifconfig -a #查看IP
eth0      Link encap:EthernetHWaddr 08:00:27:BE:80:A6
inet addr:10.0.2.15Bcast:10.0.2.255Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:febe:80a6/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:172 errors:0 dropped:0 overruns:0 frame:0
TX packets:119 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15640 (15.2 KiB)TX bytes:21109 (20.6 KiB)
lo      Link encap:Local Loopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNINGMTU:16436Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b)TX bytes:0 (0.0 b)
映射虚拟机和Host机的端口(用SSH登陆Centos)
  虚拟机的IP是10.0.2.15,自动获取的IP。接下来打开VirtualBox,按下图设置:
  SSH的默认端口是22,填好HostIP及GuestIP就行了。这样子就能通过putty等软件SSH登陆了。
  SSH IP:192.168.65.1
  帐号:CentOS设置的帐号,如root
http://liucheng.yun.im/wp-content/uploads/2011/08/VirtualBox-2.png
  web的80端口是为以后安装apache用的。设置了这个后,Host机才能用http://IP/通过浏览器直接访问。(还需要设置CentOS的防火墙不屏蔽80端口。以后再详~)

CentOS yum镜像
  设置yum的镜像,方便下载更新软件。设置的方法参照:http://centos.ustc.edu.cn/
  
  安装地方设置为HTTP,Server ctos.ustc.edu.cn, 目录 为centos/6/os/i386 或 centos/6/os/x86_64。
  安装后请按照以下步骤修改CenOS-Base.repo,以后就可以方便的用yum从本镜像站点安装、更新软件。
   CentOS6的安装方法

cd /etc/yum.repos.d
mv CentOS-Base.repoCentOS-Base.repo.save
wget http://ctos.ustc.edu.cn/CentOS-Base.repo.6
wget http://ctos.ustc.edu.cn/epel.repo.6
mv CentOS-Base.repo.6 CentOS-Base.repo
mv epel.repo.6 epel.repo
  
  提醒:装了centos的最小版本minimal之后,一开始没有安装wget了,所以就是需要配置SSH后,就能随便上传文件了。
  ~待续。
  
  转自:http://liucheng.name/1947/
页: [1]
查看完整版本: (转)配置VirtualBox+CentOS的SSH+FTP及CentOS yum镜像