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


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

Host机的IP

Host机的IP:192.168.56.1

虚拟机的IP

在CentOS查看虚拟机的IP:

ifconfig -a #查看IP
eth0      Link encap:Ethernet  HWaddr 08:00:27:BE:80:A6
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:febe:80a6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric: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.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric: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

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.repo  CentOS-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后,就能随便上传文件了。

~待续。


14条回应:“配置VirtualBox+CentOS的SSH+FTP及CentOS yum镜像”

  1. 今天网页打开慢啊?

    问个事啊 ,怎么我的站www.xxx.com/1952.html 这样的形式文章打不开,只有www.xxx.com/xxx.1952.html能打开。还非要加个字母?