• 狂创客圈 经典图书 : 《Netty Zookeeper Redis 高并发实战》 面试必备 + 面试必备 + 面试必备 【博客园总入口 】

  • 疯狂创客圈 经典图书 : 《SpringCloud、Nginx高并发核心编程》 大厂必备 + 大厂必备 + 大厂必备 【博客园总入口 】

  • 入大厂+涨工资必备: 高并发【 亿级流量IM实战】 实战系列 【 SpringCloud Nginx秒杀】 实战系列 【博客园总入口 】


《SpringCloud Nginx 高并发核心编程》 环境搭建 图文教程和演示视频:

组件 链接地址
【必须】 虚拟机Linux 开发环境准备
Linux openresty 安装 Linux openresty 安装
【必须】Linux Redis 安装(带视频) Linux Redis 安装(带视频)
【必须】Linux Zookeeper 安装(带视频) Linux Zookeeper 安装, 带视频
Windows Redis 安装(带视频) Windows Redis 安装(带视频)
RabbitMQ 离线安装(带视频) RabbitMQ 离线安装(带视频)
ElasticSearch 安装, 带视频 ElasticSearch 安装, 带视频
Nacos 安装(带视频) Nacos 安装(带视频)
【必须】Eureka Eureka 入门,带视频
【必须】springcloud Config 入门,带视频 springcloud Config 入门,带视频
【必须】SpringCloud 脚手架打包与启动 SpringCloud脚手架打包与启动

1 虚拟机Linux 环境准备

VMware下载和安装

绝大多数初学者使用的是 Windows,这里仅仅介绍在 Windows 下安装 VMware 和 Linux。
VMware 有两个版本,分别是 VMware Workstation Pro 和 VMware Workstation Player。

VMware Workstation Pro 下载地址:https://pan.baidu.com/s/1XXhFFh0Fx0vzvcd1A543Yg,提取码:2o19

VMware 对计算机的硬件配置要求比较高,配置低了虚拟机会很慢,甚至不能运行。理论上,配置越高越好,现在主流的计算机配置都可以达到运行 VMware 的要求。千万不要用多年珍藏的老古董来运行 VMware,我保证你将会失去耐心。

由于 VMware 的安装过程比较简单,与安装普通软件无异,因此不再过多阐述。这里假设读者已经下载并已安装好 VMware,接下来直接开始使用 VMware 安装 Linux 系统。

使用 VMware 安装 Linux 系统

启动 VMware,进入其主界面,如图 1 所示。


图 2 虚拟机设置向导界面

点击“下一步”,进入“安装操作系统”界面,若初学者已提前准备好 Linux 系统的映像文件(.iso 文件),此处可选择“安装程序光盘映像文件”,并通过“浏览”按钮找到要安装 Linux 系统的 iso 文件;否则选择“稍后安装操作系统”,如图 3 所示。

  • 32 位 CentOS 6.5 映像下载:http://archive.kernel.org/centos-vault/6.5/isos/i386/CentOS-6.5-i386-bin-DVD1.iso
  • 64 位 CentOS 6.5 映像下载:http://archive.kernel.org/centos-vault/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso

点击“下一步”,进入“选择客户机操作系统”,选择“Linux”,并在“版本”下拉列表框中选择要安装的对应的 Linux 版本,这里选择“CentOS 6”,如图 4 所示。


图 5 命名虚拟机

单击"下一步"按钮,进入"指定磁盘容量"界面。默认虚拟硬盘大小为 20GB(虚拟硬盘会以文件形式存放在虚拟机系统安装目录中)。虚拟硬盘的空间可以根据需要调整大小,但不用担心其占用的空间,因为实际占用的空间还是以安装的系统大小而非此处划分的硬盘大小为依据的。

比如你设定了硬盘容量为 20GB,但是安装 Linux 只用了 4GB,那么实际上只会在你的 Windows 分区中占用 4GB 的空间,占用空间会随着虚拟机系统使用的空间增加而增加。

此“指定磁盘容量”界面保持默认设置即可,如图 6 所示。


图 6 指定磁盘容量界面

接下来进入“已准备好创建虚拟机”界面,确认虚拟机设置,不需改动则单击"完成"按钮,开始创建虚拟机,如图 7 所示。


图 12 VMware 启动 Linux 系统

而在图 3 中选择“稍后安装操作系统”的读者,此时必须先下载某个 Linux 映像文件,并通过“编辑虚拟机设置->CD/DVD(IDE)”中,选择“使用ISO映像文件”,手动添加 iso 文件,然后点击“确定”即可手动开启 Linux 系统。如图 13 所示。

经过以上几步,我们就成功地用 VMware 虚拟机安装好了 Linux 系统。

2、挂载扩展硬盘

1 前言

本机vmware会老提示nospace空间不足,一般都需要挂载扩展硬盘

2.添加新硬盘

依次点击"虚拟机"->“设置”

3.查看磁盘信息

[root@localhost ~]# fdisk -lDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x364f5e2eDevice Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    41943039    20970496   83  LinuxDisk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000cbf1eDevice Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      616447      307200   83  Linux
/dev/sda2          616448     4810751     2097152   82  Linux swap / Solaris
/dev/sda3         4810752    41943039    18566144   83  Linux

可以看到有2个磁盘,/dev/sda磁盘有3个分区,/dev/sdb磁盘为我这次新增的,1分区

4.磁盘分区

fdisk /dev/sdb

分区后可以通过fdisk -l查看/dev/sdb磁盘下有一个sdb1分区

5.格式化分区

# 格式化分区
mkfs.ext4 /dev/sdb1
# 将分区挂载到根目录
mount -t ext4 /dev/sdb1 /work

挂载后

[root@localhost ~]# df -ll
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda3       18555904  7347232  11208672  40% /
devtmpfs         1925244        0   1925244   0% /dev
tmpfs            1934520        0   1934520   0% /dev/shm
tmpfs            1934520    58484   1876036   4% /run
tmpfs            1934520        0   1934520   0% /sys/fs/cgroup
/dev/sda1         303788   109596    194192  37% /boot
/dev/sdb1       20510288 11187164   8258216  58% /work
tmpfs             386908        0    386908   0% /run/user/0

6.设置开机自动挂载

vi /etc/rc.d/rc.local
#mount  disk 2  挂载第二块硬盘
/bin/mount /dev/sdb1 /work

3 CentOS7 安装VMware Tools

VMware 强烈建议你在每一台虚拟机中完成操作系统安装之后立即安装 VMware Tools 套件。在客户操作系统中安装 VMware Tools 非常重要。

VMware Tools是VMware虚拟机中自带的一种增强工具,相当于VirtualBox中的增强功能(Sun VirtualBox Guest Additions),是VMware提供的增强虚拟显卡和硬盘性能、以及同步虚拟机与主机时钟的驱动程序。

只有在VMware虚拟机中安装好了VMware Tools,才能实现主机与虚拟机之间的文件共享,同时可支持自由拖拽的功能,鼠标也可在虚拟机与主机之前自由移动(不用再按ctrl+alt),且虚拟机屏幕也可实现全屏化。

1 安装依赖包

[root@localhost ~]# yum -y install perl gcc gcc-c++ make cmake kernel kernel-headers kernel-devel net-tools

2 加载 vmware tools 到CentOS7光驱CD-ROM

点击菜单 `虚拟机` ——> `安装VMware Tools(T)...`

点击加载 vmware tools 到CentOS7光驱CD-ROM

3 将CD-ROM挂载到指定目录

通常情况下都是将设备目录 /dev/crrom 挂载到 /mnt/cdrom 目录,
  • 如果 /mnt 目录下不存在 cdrom 目录则创建

    /mnt/cdrom
    

    则创建

    [root@localhost ~]# mkdir -p /mnt/cdrom
    
  • 挂载目录

    [root@localhost ~]# mount -t auto /dev/cdrom /mnt/cdrom
    mount: /dev/sr0 is write-protected, mounting read-only
    

    如果挂载目录错了,可以输入umout /dev/cdrom进行卸载挂载。

ps:mount命令介绍

命令格式:mount [-t vfstype] [-o options] device dir
1.-t vfstype 指定文件系统的类型,通常不必指定。mount 会自动选择正确的类型。常用类型有:
  光盘或光盘镜像:iso9660
  DOS fat16文件系统:msdos
  Windows 9x fat32文件系统:vfat
  Windows NT ntfs文件系统:ntfs
  Mount Windows文件网络共享:smbfs
  UNIX(LINUX) 文件网络共享:nfs
2.-o options 主要用来描述设备或档案的挂接方式。常用的参数有:
  loop:用来把一个文件当成硬盘分区挂接上系统
  ro:采用只读方式挂接设备
  rw:采用读写方式挂接设备
  iocharset:指定访问文件系统所用字符集
3.device 要挂接(mount)的设备。
4.dir设备在系统上的挂接点(mount point)。

完整的挂载命令为

mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom  

4 拷贝安装包到用户家目录

[root@localhost ~]# cp /mnt/cdrom/VMwareTools-10.0.5-3228253.tar.gz ~

5 解除挂载

[root@localhost ~]# umount /dev/cdrom

6 解压VMwareTools安装包

[root@localhost ~]# tar -zxvf VMwareTools-10.0.5-3228253.tar.gz

输入命令tar -zxf VMwareTools-10.0.5-3228253.tar.gz 将刚刚复制的VMwareTools-10.0.5-3228253.tar.gz解压,默认解压到当前目录下,此时就会多出一个命名为类似于“vmware-tools-distrib”的文件夹,这里和windows 里面的解压结果一样。

7 安装VMware Tools

输入命令 cdvmware-linux-tools 进入解压后的目录


[root@localhost ~]# cd vmware-tools-distrib/

运行 vmware-install.pl 文件

[root@localhost vmware-tools-distrib]# ./vmware-install.pl 

在运行安装过程中,它会一步一步的有问题提出要你回应,此过程中,你只要见到问题后面显示[yes]、[no]、[yes/no]的都输入yes,然后回车, 如果是其他的问题,不管[ ]里面是什么直接回车就好

一路Enter即可

[root@XD-ORACLE vmware-tools-distribu]# cd vmware-tools-distrib/
[root@XD-ORACLE vmware-tools-distrib]# ls
bin  doc  etc  FILES  INSTALL  installer  lib  vmware-install.pl
[root@XD-ORACLE vmware-tools-distrib]# ./vmware-install.pl
A previous installation of VMware Tools has been detected.The previous installation was made by the tar installer (version 4).Keeping the tar4 installer database format.You have a version of VMware Tools installed.  Continuing this install will
first uninstall the currently installed version.  Do you wish to continue?
(yes/no) [yes] yesUninstalling the tar installation of VMware Tools.Stopping services for VMware ToolsStopping VMware Tools services in the virtual machine:Guest operating system daemon:                          [  OK  ]VMware User Agent (vmware-user):                        [  OK  ]Blocking file system:                                   [  OK  ]Unmounting HGFS shares:                                 [  OK  ]Guest filesystem driver:                                [  OK  ]VM communication interface socket family:               [  OK  ]VM communication interface:                             [  OK  ]Stopping Thinprint services in the virtual machine:Stopping Virtual Printing daemon:                                   done/sbin/restorecon:  Warning no default label for /tmp/vmware-block-restore0/tmp_file
File /etc/pulse/default.pa is backed up to /etc/pulse/default.pa.old.0.The removal of VMware Tools 9.6.1 build-1378637 for Linux completed
successfully.Installing VMware Tools.In which directory do you want to install the binary files?
[/usr/bin]What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]What is the directory that contains the init scripts?
[/etc/rc.d/init.d]In which directory do you want to install the daemon files?
[/usr/sbin]In which directory do you want to install the library files?
[/usr/lib/vmware-tools]The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]yes
In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]
The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]
The installation of VMware Tools 9.6.1 build-1378637 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes] yesInitializing.../usr/bin/xrandr: Failed to get size of gamma for output defaultMaking sure services for VMware Tools are stopped.Stopping Thinprint services in the virtual machine:Stopping Virtual Printing daemon:                                   done
Stopping VMware Tools services in the virtual machine:Guest operating system daemon:                          [  OK  ]VMware User Agent (vmware-user):                        [  OK  ]Blocking file system:                                   [  OK  ]Unmounting HGFS shares:                                 [  OK  ]Guest filesystem driver:                                [  OK  ]VM communication interface socket family:               [  OK  ]VM communication interface:                             [  OK  ]Found a compatible pre-built module for vmci.  Installing it...Found a compatible pre-built module for vsock.  Installing it...The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.Use the flag --clobber-kernel-modules=vmxnet3 to override.The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.Use the flag --clobber-kernel-modules=pvscsi to override.The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.Use the flag --clobber-kernel-modules=vmmemctl to override.The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish
to enable this feature? [yes] yesFound a compatible pre-built module for vmhgfs.  Installing it...Found a compatible pre-built module for vmxnet.  Installing it...The vmblock enables dragging or copying files between host and guest in a
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[yes] yesVMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can beenabled/disabled by re-running vmware-config-tools.pl.Would you like to enable VMware automatic kernel modules?
[no] noThinprint provides driver-free printing. Do you wish to enable this feature?
[yes] yesDisabling timer-based audio scheduling in pulseaudio.Detected X server version 1.13.0Distribution provided drivers for Xorg X server are used.Skipping X configuration because X drivers are not included.Creating a new initrd boot image for the kernel.Starting Virtual Printing daemon:                                   doneChecking acpi hot plug                                  [  OK  ]
Starting VMware Tools services in the virtual machine:Switching to guest configuration:                       [  OK  ]VM communication interface:                             [  OK  ]VM communication interface socket family:               [  OK  ]Guest filesystem driver:                                [  OK  ]Mounting HGFS shares:                                   [  OK  ]Blocking file system:                                   [  OK  ]VMware User Agent:                                      [  OK  ]Guest operating system daemon:                          [  OK  ]
The configuration of VMware Tools 9.6.1 build-1378637 for Linux for this
running kernel completed successfully.You must restart your X session before any mouse or graphics changes take
effect.You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.Enjoy,--the VMware teamFound VMware Tools CDROM mounted at /media/VMware Tools. Ejecting device
/dev/sr0 ...
/sbin/restorecon:  Warning no default label for /tmp/vmware-block-restore0/tmp_file
[root@XD-ORACLE vmware-tools-distrib]#

安装完成后,选择虚拟机上方的:虚拟机-设置-选项-客户机隔离,勾选“启用复制粘贴”,然后重启centos系统,就可以实现在虚拟机系统与主机系统之间复制,粘贴文字,以及文件可以直接在两系统间拖动了。

8 启用共享文件夹

在命令窗口输入如下命令(ls /mnt/hgfs/)之后,会看到自己刚刚设置的共享文件夹

[root@localhost ~]# ls /mnt/hgfs/
develop
[root@localhost ~]#

完整的自定义开机程序 /etc/rc.d/rc.local

[root@localhost ~]# cat /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.#start redis
/usr/local/redis/bin/redis-server  /usr/local/redis/redis.conf#mount  disk 2  挂载第二块硬盘
/bin/mount /dev/sdb1 /work#start nginx  以root账号 启动 nginx/usr/bin/su  - root  -c   "/usr/local/openresty/nginx/sbin/nginx  -c /usr/local/openresty/nginx/conf/nginx.conf"# 启动 zookeeper
/usr/bin/su  - root  -c   "/work/zookeeper/zookeeper-1/bin/zkServer.sh start"
/usr/bin/su  - root  -c   "/work/zookeeper/zookeeper-2/bin/zkServer.sh start"
sleep 10s#start springcloud 注册中心  eureka
/usr/bin/su  - root  -c   "/work/cloud-eureka-1.0-SNAPSHOT/bin/start.sh start"
sleep 20s #start springcloud 配置中心  config
/usr/bin/su  - root  -c   "/work/cloud-config-1.0-SNAPSHOT/bin/start.sh start"# 启动 Nacos  ,如果要使用的话
/usr/bin/su  - root  -c   "/work/nacos/bin/startup.sh -m standalone"

以上用到的 su命令,说明如下:

su - root -c command :

切换到root并获得root的环境变量及执行权限并执行命令,-c是command的缩写

回到◀疯狂创客圈▶

疯狂创客圈 - Java高并发研习社群,为大家开启大厂之门

vmware windows 挂载扩展硬盘 + 共享文件夹相关推荐

  1. Windows挂载Linux网络共享文件夹

    Windows挂载Linux网络共享文件夹 创建Linux网络共享文件夹 用共享工具samba. Ubuntu安装samba: sudo apt install samba 配置Windows访问共享 ...

  2. 03_建立 Windows 和虚拟机 Ubuntu 共享文件夹

    --本文援引自朱有鹏老师的<嵌入式开发环境搭建 > 在 Windows 和虚拟机 Ubuntu 之间共享文件有好几种方法,包括 tftp,samba,VMWareTools 等.每种方法在 ...

  3. vmware中的linux使用共享文件夹

    vmware中的linux使用共享文件夹 1.在vmware中设置共享文件夹 需要在linux系统中访问window目录下的文件,于是按照教程设置了共享文件夹.即在VMware workstation ...

  4. Linux:VMware Tools安装方法及共享文件夹设置方法

    VMware Tools安装方法及共享文件夹设置方法 重要参考官网: https://docs.vmware.com/cn/VMware-Workstation-Pro/15.0/com.vmware ...

  5. windows系统之间SMB共享文件夹的访问和操作

    windows系统之间SMB共享文件夹的访问和操作 JCIFS使用 示例 前提背景:A系统与B系统的集成,A提交相关数据到B系统,数据格式为XML,XML标签中放着物理文件的访问路径,因A系统不能对外 ...

  6. Linux主机与Windows虚拟机之间创建共享文件夹

    Linux主机与Windows虚拟机之间创建共享文件夹 概述 该篇博客是在Linux samba配置的基础上,进行Linux主机与Windows虚拟机之间配置共享文件夹的教程.该博客是在一次实际成功的 ...

  7. linux网络共享文件夹,[Linux] - Windows与Linux网络共享文件夹挂载方法

    Windows与Linux网络SMB方式文件夹共享挂载 本示例系统: Windows 2003+ Linux-Centos/Ubuntu 本示例全为命令行操作,如何使用Windows.Linux命令行 ...

  8. VMware虚拟机和宿主机共享文件夹(windows,linux)

    在windows XP系统下与vmware虚拟机Linux文件共享 方法 使用共享文件夹     通过共享文件夹,你可以方便的在虚拟机和宿主机之间共享文件.如果你想用共享文件夹,你必须在客户机中安装与 ...

  9. windows:将网络共享文件夹映射为网络硬盘

    实现效果: 同一局域网内,不同电脑之间可共享文件. 示例: 计划将A电脑 的文件夹C:\data,共享给局域网电脑 B. 一.局域网所有电脑都可访问: 1. 在A电脑中 共享文件夹----选择'启用网 ...

最新文章

  1. python 字符编码问题
  2. 请你要幸福 这是 你唯一能为我做到的
  3. 官方 React 快速上手脚手架 create-react-app
  4. pyhon滤镜详细教程
  5. [转]DML DDL DCL 语言的区别
  6. ABAP销售合同删除Bapi
  7. qa session of management of technology
  8. 基于matlab的图解粒度参数计算,基于MATLAB的图解粒度参数计算-热带地理.PDF
  9. EJB3与Spring的集成
  10. 基础之实战猜年龄游戏
  11. bee 字符串转int_Beego在views中格式化显示时间(int64转string)
  12. @你最强资源包来了 MobTech 联合 LiveVideoStack 发起劳动光荣榜
  13. 剧透人生!你什么时候结婚换工作甚至狗带,Facebook都知道
  14. 如何 Scale Up/Down 应用?- 每天5分钟玩转 Docker 容器技术(126)
  15. 从零基础转行到前端大牛,需要经过哪几个阶段?
  16. 第八章:文本处理工具
  17. Redis简介、安装、配置、启用学习笔记
  18. 几款ReactJS最优秀的UI框架
  19. windows server上通过关闭端口有效防治勒索病毒
  20. mysql数据库可以放pdb文件吗_pdb数据库文件的搜索结果-阿里云开发者社区

热门文章

  1. Android--Binder机制
  2. android 图片显示崩溃
  3. 智能化养猪场需要哪些设备?
  4. quartz定时任务调度 自定义表单 java图片爬虫
  5. 莆田华侨职业学校有没有计算机,莆田华侨职业中专学校招生专业|莆田华侨职业中专学校有哪些专业...
  6. 浅谈元宇宙的三种发展路径,它是人类文明的必然选择吗?
  7. 国内这么多“ChatGPT”是真是假
  8. 流计算与批量计算的对比
  9. Kitchen Plates (拓扑排序)
  10. jsp21125农贸市场食品检测业务系统