一、系统与软件

WIN7 64bit、VirtualBox 5.0.14、CentOS 6.5、SecureCRT 7.2.3

二、使用文件夹共享需要安装增强功能,但是安装时无法读取光盘iso文件

三、为了方便操作,配置静态IP,并使用CRT连接上去(参考http://my.oschina.net/allman90/blog/294847?fromerr=CotpElUe

[root@pc ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 //指出设备名称
HWADDR=:::::4A //硬件Mac地址
TYPE=Ethernet //网络类型
UUID=c1d0e14c-cd39--af44-37daca90c1f9 //设备UUID编号
ONBOOT=yes //是否启动应用
NM_CONTROLLED=yes //设备是否被NetworkManager管理
BOOTPROT=static //启动类型 dhcp|static
BROADCAST=192.168.88.203 //广播地址
IPADDR=192.168.88.111 //IP地址
NETMASK=255.255.255.0 //子网掩码
NETWORK=192.168.88.0 //网络地址
GATEWAY=192.168.88.254 //网关地址
DNS1=8.8.8.8 //DNS
[root@pc ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@pc ~]# ifconfig
eth0 Link encap:Ethernet HWaddr :::::2C
inet addr:192.168.88.111 Bcast:192.168.88.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe57:732c/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (11.9 MiB) TX bytes: (341.4 KiB) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::/ Scope:Host
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 b) TX bytes: (0.0 b)
[root@pc ~]# ping www.baidu.com
PING www.baidu.com (111.13.100.92) () bytes of data.
bytes from 111.13.100.92: icmp_seq= ttl= time=59.1 ms
bytes from 111.13.100.92: icmp_seq= ttl= time=65.4 ms

四、既然无法读取光盘,便采用FTP上传,配置FTP(参考http://os.51cto.com/art/201408/448630.htm

[root@pc ~]# yum -y install vsftpd                                        // 安装FTP
...
Complete!
[root@pc ~]# service vsftpd start // 启动FTP
Starting vsftpd for vsftpd: [ OK ]
[root@pc ~]# vi /etc/sysconfig/iptables // 防火墙开启21端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
[root@pc ~]# service iptables restart // 重启防火墙
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@pc ~]# cat /etc/passwd | grep ftp // 新增一个账户ftpuser,并设置密码
ftp:x:::FTP User:/var/ftp:/sbin/nologin
[root@pc ftp]# useradd -g ftp ftpuser
[root@pc ftp]# passwd ftpuser
Changing password for user ftpuser.

无法读取目录     

[root@pc ~]# getsebool -a | grep ftp                        // 开启外网访问
allow_ftpd_full_access --> off
ftp_home_dir --> off
[root@pc ~]# setsebool -P allow_ftpd_full_access
[root@pc ~]# setsebool -P ftp_home_dir
[root@pc ~]# vi /etc/vsftpd/vsftpd.conf // 设定passive模式端口范围
pasv_min_port=
pasv_max_port=
[root@pc ~]# service vsftpd restart // 重启FTP
[root@pc ~]# vi /etc/sysconfig/iptables // 开启防火墙对应范围端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport : -j ACCEPT
[root@pc ~]# service iptables restart // 重启防火墙

正常连接上虚拟机       

把VirtualBox安装目录下的 VBoxGuestAdditions.iso 解压,并通过FTP客户端filezilla上传到虚拟机

[root@pc ~]# cd /home/ftpuser/
[root@pc ftpuser]# ll
total
drwxr-xr-x. ftpuser ftp Apr : VBoxGuestAdditions

五、开始安装增强功能

[root@pc ~]# cd /home/ftpuser/VBoxGuestAdditions/
[root@pc VBoxGuestAdditions]# ll
total
drwxr-xr-x. ftpuser ftp Apr : 32Bit
drwxr-xr-x. ftpuser ftp Apr : 64Bit
-rw-r--r--. ftpuser ftp Apr : AUTORUN.INF
-rw-r--r--. ftpuser ftp Apr : autorun.sh
drwxr-xr-x. ftpuser ftp Apr : cert
drwxr-xr-x. ftpuser ftp Apr : OS2
-rw-r--r--. ftpuser ftp Apr : runasroot.sh
-rw-r--r--. ftpuser ftp Apr : VBoxLinuxAdditions.run
-rw-r--r--. ftpuser ftp Apr : VBoxSolarisAdditions.pkg
-rw-r--r--. ftpuser ftp Apr : VBoxWindowsAdditions-amd64.exe
-rw-r--r--. ftpuser ftp Apr : VBoxWindowsAdditions.exe
-rw-r--r--. ftpuser ftp Apr : VBoxWindowsAdditions-x86.exe
[root@pc VBoxGuestAdditions]# chmod +x runasroot.sh
[root@pc VBoxGuestAdditions]# ./runasroot.sh
Usage: runasroot.sh DESCRIPTION COMMAND [ADVICE] Attempt to execute COMMAND with root privileges, displaying DESCRIPTION if
possible and displaying ADVICE if possible if no su()-like tool is available.
[root@pc VBoxGuestAdditions]# chmod +x VBoxLinuxAdditions.run
[root@pc VBoxGuestAdditions]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0. Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
Building the VirtualBox Guest Additions kernel modules
The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it. The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.-.el6.x86_64 Building the main Guest Additions module [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions [ OK ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
[root@pc VBoxGuestAdditions]# cat /var/log/vboxadd-install.log
/tmp/vbox./Makefile.include.header:: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.

查找报错 Building the main Guest Additions module [FAILED](参考    http://www.xuebuyuan.com/2039380.html

[root@pc VBoxGuestAdditions]# yum -y install gcc make gcc-c++
[root@pc VBoxGuestAdditions]# yum -y install kernel
[root@pc VBoxGuestAdditions]# yum -y install kernel-devel
[root@pc VBoxGuestAdditions]# yum -y install kernel-headers

重启CentOS并再次执行VBoxLinuxAdditions.run,依旧报错(参考 http://askubuntu.com/questions/22743/how-do-i-install-guest-additions-in-a-virtualbox-vm

[root@pc VBoxGuestAdditions]# yum update
[root@pc ~]# /opt/VBoxGuestAdditions-5.0./uninstall.sh
[root@pc ~]# /home/ftpuser/VBoxGuestAdditions/VBoxLinuxAdditions.run
[root@pc ~]# cat /var/log/vboxadd-install.log
/bin/sh: perl: command not found

这次变成报没有 perl,于是  yum -y install perl  补齐

再次进行安装

[root@pc ~]# /opt/VBoxGuestAdditions-5.0./uninstall.sh
[root@pc ~]# /home/ftpuser/VBoxGuestAdditions/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0. Guest Additions for Linux............
VirtualBox Guest Additions installer
You appear to have a version of the VBoxGuestAdditions software
on your system which was installed from a different source or using a
different type of installer. If you installed it from a package from your
Linux distribution or if it is a default part of the system then we strongly
recommend that you cancel this installation and remove it properly before
installing this version. If this is simply an older or a damaged
installation you may safely proceed. Do you wish to continue anyway? [yes or no]
yes
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
grep: /opt/VBoxGuestAdditions-*/init/*: No such file or directory
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module [ OK ]
Building the shared folder support module [ OK ]
Building the OpenGL support module [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong. The module is not built but the others are.)
Doing non-kernel setup of the Guest Additions [ OK ]
Starting the VirtualBox Guest Additions [ OK ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.

终于成功了,其中 OpenGL 失败是因为我的CentOS是精简版没有界面的!

六、设置共享

[root@pc ~]# ll /media/
total
drwxrwx---. root vboxsf Mar : sf_win_www

----------------------------------2019-01-10----------------------------------

 [root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
% /
tmpfs % /dev/shm
/dev/sda1 % /boot
.host://www 165686344 81123004 84563340 49% /datas/htdocs
.host://log 165686344 81123004 84563340 49% /datas/log
.host://vmware 157300384 89902340 67398044 58% /datas/vmware
[root@localhost ~]# vmware-hgfsclient #查看共享目录
www
vmware
log
python
[root@localhost ~]# mount -t vmhgfs .host:/python /datas/python #挂载
Error: cannot canonicalize mount point: No such file or directory
[root@localhost ~]# mkdir /datas/python
[root@localhost ~]# mount -t vmhgfs .host:/python /datas/python
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
% /
tmpfs % /dev/shm
/dev/sda1 % /boot
.host:/www 165686344 81123004 84563340 49% /datas/htdocs
.host:/log 165686344 81123004 84563340 49% /datas/log
.host:/vmware 157300384 89902340 67398044 58% /datas/vmware
.host:/python 165686344 81123004 84563340 49% /datas/python
[root@localhost ~]# ll /datas/python/
total
-rwxrwxrwx root root May .log
[root@localhost ~]# vim /etc/fstab #自动挂载
.host:/python /datas/python vmhgfs iocharset=utf8,rw,uid=www,gid=www 0 1
[root@localhost ~]# init
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
% /
tmpfs % /dev/shm
/dev/sda1 % /boot
.host:/www 165686344 81123004 84563340 49% /datas/htdocs
.host:/log 165686344 81123004 84563340 49% /datas/log
.host:/vmware 157300384 89902340 67398044 58% /datas/vmware
.host:/python 165686344 81123004 84563340 49% /datas/python

https://blog.csdn.net/qq_30309813/article/details/79830356
https://www.cnblogs.com/qiyebao/p/4484047.html

解决WIN7与虚拟机CentOS的文件夹共享问题的更多相关文章

  1. centos 下文件夹共享

    [root@localhost share]# yum install samba -y[root@localhost share]# cp /etc/samba/smb.conf /etc/samb ...

  2. 解决win7无法打开chm格式文件的问题

    解决win7无法打开chm格式文件的问题. (一).简单方法(本人用的这个) 1.打开chm2.win7提示安全问题3.chm无法显示内容4.关闭chm5.右键点击chm,点击“解除锁定”,ok  没 ...

  3. [转]Virtualbox主机和虚拟机之间文件夹共享及双向拷贝(Windows<->Windows, Windows<->Linux)

    本文转自:https://www.jb51.net/article/97271.htm 最近学习Virtualbox的一些知识,记录下,Virtualbox下如何实现主机和虚拟机之间文件夹共享及双向拷 ...

  4. VMWare12虚拟机实现主客机间的文件拖拽(复制粘贴)和文件夹共享

    版本: 主机:Windows 7 64位旗舰版 虚拟机: VMWare 12 + Windows 7 64位旗舰版 VMWare pro 12 + Ubuntu16.04LTS 64位 注:由于VMW ...

  5. 2017-7-19-每日博客-关于Linux下的CentOS中文件夹基本操作命令.doc

    CentOS中文件夹基本操作命令 文件(夹)查看类命令 ls--显示指定目录下内容 说明:ls 显示结果以不同的颜色来区分文件类别.蓝色代表目录,灰色代表普通文件,绿色代表可执行文件,红色代表压缩文件 ...

  6. win7文件夹共享(不新建账户、不带密码直接访问)

    1.右键需要共享的文件夹>共享>特定用户>选择Everyone>“添加”>“共享” 2.打开控制面板>按类别的查看方式>网络和Internet下的选择家庭组和 ...

  7. 负载均衡下的资源文件配置/多站点下的资源文件夹共享(Windows IIS)

    前言: 负载均衡用的是NLB,微软的方案不太靠谱,举个例子吧,AB两台服务器负载出C,如果用户访问访问C之后分配的是A,那么如果A挂了,是不会自动切换到B的.据说后来还有一种NLB的方案可以实现,也不 ...

  8. 工程师技术(四):配置SMB文件夹共享、多用户Samba挂载、普通NFS共享的实现、安全NFS共享的实现

    一.配置SMB文件夹共享 目标: 本例要求在虚拟机 server0 上发布两个共享文件夹,具体要求如下: 1> 此服务器必须是 STAFF 工作组的一个成员   2> 发布目录 /comm ...

  9. Powershell学习之道-文件夹共享及磁盘映射

    导读 在Linux环境下,我们很轻易就能得心应手地通过命令操作一切事物,在Windows下,Powershell也算是后起之秀,提供大量的cmdlet以及c#的横向拓展.下面将由小编带领大家通过Pow ...

随机推荐

  1. SQL Azure (18) 使用External Table实现垮库查询

    <Windows Azure Platform 系列文章目录> 问题 1.我们在进行SQL Server开发的时候,经常会使用垮库查询.但是在默认情况下,使用Azure SQL Datab ...

  2. 允许Sublime编辑器在Ubuntu上输入中文

    Sublime Text是一款功能非常强大的轻量级代码编辑器,有关功能介绍和使用可以看我另一篇文章的描述http://www.cnblogs.com/jaxu/p/5037547.html 不过,在U ...

  3. How To Install Proxmox Nested on VMware ESXi (Full Support OpenVZ & KVM)

    https://imanudin.net/2015/03/04/how-to-install-proxmox-nested-on-vmware-esxi-full-support-openvz-kvm ...

  4. 构建基于Chromium的应用程序

    chromium是google chrome浏览器所采用的内核,最开始由苹果的webkit发展而出,由于webkit在发展上存在分歧,而google希望在开发上有更大的自由度,2013年google决 ...

  5. Atitit sql计划任务与查询优化器--统计信息模块

    Atitit sql计划任务与查询优化器--统计信息模块 每一个统计信息的内容都包含以上三部分的内容. 我们依次来分析下,通过这三部分内容SQL Server如何了解该列数据的内容分布的. a.统计信 ...

  6. CPU占用率呈正弦实现,及实时输出进程和线程的CPU占用率

    CPU占用率呈正弦实现,及实时输出进程和线程的CPU占用率 #include "stdafx.h" #include <windows.h> #include < ...

  7. python网络编程——IO多路复用之epoll

    1.内核EPOLL模型讲解     此部分参考http://blog.csdn.net/mango_song/article/details/42643971博文并整理 首先我们来定义流的概念,一个流 ...

  8. C#实现哥德巴赫猜想

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Goet ...

  9. android的logcat详细用法

    Android日志系统提供了记录和查看系统调试信息的功能.日志都是从各种软件和一些系统的缓冲区中记录下来的,缓冲区可以通过 logcat 命 令来查看和使用. 使用logcat命令 你可以用 logc ...

  10. AngularJS之中级Route【二】(七)

    前言 上一篇我们介绍了AngularJS内置的路由ngRoute,我们知道AngularJS被广泛应用于单页应用SPA(Single Page Application)中,此时路由对于我们来讲非常重要 ...