1.3-虚拟机的安装到远程连接的全面指南/Virtual Machine Installation and Remote Connection Comprehensive Guide

虚拟机的安装到远程连接的全面指南 / Virtual Machine Installation and Remote Connection Comprehensive Guide

1. 虚拟机介绍 / Introduction to Virtual Machines

1.1 为什么需要虚拟机?/ Why Do We Need Virtual Machines?

在学习Linux系统时,我们需要一个可用的Linux系统环境。然而,直接将自己的电脑重装为Linux系统并不现实,因为Linux系统并不适合日常办公使用。为了在不影响日常使用的情况下学习Linux,我们需要借助虚拟机来创建一个Linux系统环境。
When learning the Linux system, we need an available Linux system environment. However, directly replacing your computer’s operating system with Linux is impractical, as Linux is not suitable for daily office work. To learn Linux without affecting your daily use, we need to use a virtual machine to create a Linux system environment.

1.2 什么是虚拟机?/ What is a Virtual Machine?

在这里插入图片描述

虚拟机 (VM) 是一种虚拟环境,通过虚拟化技术在电脑内虚拟出计算机硬件,并在这些虚拟的硬件上安装操作系统,从而得到一台虚拟的电脑。我们可以在一台物理计算机上模拟多台虚拟计算机。它运行在其主机的一个隔离分区上,拥有自己的 CPU 能力、内存、操作系统(如 Windows、Linux、macOS)和其他资源。这些虚拟计算机所拥有的功能与我们的物理计算机无异。
A virtual machine (VM) is a virtual environment that uses virtualization technology to emulate computer hardware within a computer and install an operating system on this virtual hardware, creating a virtual computer. Multiple virtual computers can be simulated on a single physical computer. It runs in an isolated partition on its host and has its own CPU capabilities, memory, operating system (such as Windows, Linux, macOS), and other resources. These virtual computers function just like physical computers.


2. 安装虚拟化软件 / Installing Virtualization Software

2.1 常见的虚拟化软件/Common Virtualization Software

名称 / Name图标/ Icon特点 / Features链接 / Link
VMware WorkStationVMware WorkStation功能强大,支持多种操作系统,适用于Windows和Linux平台。
Powerful, supports multiple operating systems, suitable for Windows and Linux platforms.
VMware WorkStation
VMware FusionVMware Fusion专为Mac用户设计,与WorkStation功能类似,提供与MacOS的良好集成。
Designed for Mac users, similar to WorkStation in functionality, offers good integration with macOS.
VMware Fusion
VirtualBoxVirtualBox开源免费,跨平台支持,具有丰富的功能和扩展性。
Open source and free, cross-platform support, rich features and extensibility.
VirtualBox
Hyper-VHyper-V集成在Windows专业版及以上版本中,适合Windows用户使用。
Integrated in Windows Pro and above versions, suitable for Windows users.
Hyper-V
Parallels DesktopParallels Desktop专为Mac用户设计,支持在Mac上无缝运行Windows应用程序,易于使用。
Designed for Mac users, supports seamless running of Windows applications on Mac, easy to use.
Parallels Desktop
KVMKVM基于Linux内核的开源虚拟化技术,适用于Linux平台,性能优越。
Open source virtualization technology based on the Linux kernel, suitable for Linux platforms, superior performance.
KVM

3. VMware WorkStation(Windows环境)/ VMware WorkStation (Windows Environment)

在这里插入图片描述

3.1 VMware Workstation介绍 / Introduction to VMware Workstation

VMware Workstation 是一款专业级的虚拟化软件,专旨在帮助用户在同一台计算机上同时运行多个操作系统。为用户提供了一个强大的平台,使得创建、配置、管理和运行虚拟机变得简单而高效。每个虚拟机都是一个完全隔离的计算环境,具备独立的操作系统和应用程序,确保虚拟机之间不会互相干扰。这种设计使得用户能够在一个物理计算机上体验不同的操作系统环境,无需额外的硬件支持。
VMware Workstation is a professional-grade virtualization software designed to help users run multiple operating systems simultaneously on a single computer. It provides a powerful platform that makes creating, configuring, managing, and running virtual machines simple and efficient. Each virtual machine is a completely isolated computing environment with its own operating system and applications, ensuring that virtual machines do not interfere with each other. This design allows users to experience different operating system environments on one physical computer without additional hardware support.

3.2 VMware Workstation 的功能 / Features of VMware Workstation

  • 多操作系统支持:支持 Windows、Linux、BSD、Solaris 等多种操作系统。
  • Multi-OS Support: Supports various operating systems including Windows, Linux, BSD, and Solaris.
  • 高性能:通过硬件加速技术(如 Intel VT-x 和 AMD-V),提供接近原生硬件的性能。
  • High Performance: Provides near-native hardware performance through hardware acceleration technologies such as Intel VT-x and AMD-V.
  • 快照和回滚:用户可以创建虚拟机的快照,在需要时快速回滚到之前的状态。
  • Snapshots and Rollbacks: Users can create snapshots of virtual machines and quickly roll back to previous states when needed.
  • 克隆虚拟机:支持创建虚拟机的完整克隆和链接克隆,提高管理效率。
  • Clone Virtual Machines: Supports full clone and linked clone of virtual machines, improving management efficiency.
  • 网络虚拟化:支持创建虚拟网络,模拟复杂的网络拓扑结构。
  • Network Virtualization: Supports creating virtual networks to simulate complex network topologies.
  • 共享虚拟机:支持将虚拟机共享给其他用户,实现团队协作。
  • Shared Virtual Machines: Allows virtual machines to be shared with other users for team collaboration.
  • 跨平台兼容:与 VMware vSphere、vCloud Air 等 VMware 生态系统无缝集成。
  • Cross-Platform Compatibility: Seamlessly integrates with VMware vSphere, vCloud Air, and other VMware ecosystems.

3.3 VMware Workstation 的应用场景 / Use Cases of VMware Workstation

  • 开发和测试:开发人员可以在不同的操作系统上测试软件,确保兼容性和稳定性。
  • Development and Testing: Developers can test software on different operating systems to ensure compatibility and stability.
  • 培训和教育:教育机构可以使用虚拟机进行教学,学生可以在虚拟环境中进行实验。
  • Training and Education: Educational institutions can use virtual machines for teaching, and students can perform experiments in a virtual environment.
  • 演示和展示:销售人员和讲师可以使用虚拟机进行产品演示,展示软件功能。
  • Demos and Presentations: Sales personnel and instructors can use virtual machines to demonstrate products and showcase software features.
  • 服务器管理:系统管理员可以在本地测试服务器配置和应用程序部署。
  • Server Management: System administrators can test server configurations and application deployments locally.

3.4 下载安装步骤 / Installation Steps

3.4.1 下载 VMware Workstation / Download VMware Workstation
  • VMware Workstation Pro: 适用于需要高级功能和企业级支持的用户。/Suitable for users who need advanced features and enterprise-level support.

  • 下载网址/Download link:VMware Workstation Pro

  • VMware Workstation Player: 面向个人用户,适合基础虚拟化需求。/Designed for individual users, suitable for basic virtualization needs.

  • 下载网址/Download link:VMware Workstation Player

3.4.2 运行安装 VMware Workstation / Run and Install VMware Workstation

示范安装视频/Installation Demo Video:VMware Workstation 16

VMware Workstation 16安装教程

⚠️ 提示:安装完成为确保虚拟机正常运行,需要检测VMware虚拟网卡是否安装成功。
⚠️ Note: After installation, to ensure the virtual machine runs properly, you need to check if the VMware virtual network adapter is successfully installed.

示范:Windows11家庭中文版22H2版本
Demo: Windows 11 Home Chinese Edition 22H2
在这里插入图片描述

  • a. 设置 -> 网络和Internet -> 高级网络设置 -> 网络适配器
  • a. Settings -> Network & Internet -> Advanced Network Settings -> Network Adapters
  • b. 按下Win+R键,输入 ncpa.cpl,按Enter键
  • b. Press Win+R keys, type ncpa.cpl, and press Enter

4. VMware WorkStation安装CentOS 7 / Install CentOS 7 on VMware WorkStation

4.1 CentOS 7介绍 / Introduction to CentOS 7

在这里插入图片描述
CentOS 7 是一款基于 Red Hat Enterprise Linux (RHEL) 的开源操作系统,提供企业级的稳定性和安全性。它广泛用于服务器环境和数据中心,是Linux用户的热门选择。CentOS 7 引入了许多新特性,如 systemd 初始化系统和改进的网络管理功能,提供更好的性能和兼容性。

CentOS 7 is an open-source operating system based on Red Hat Enterprise Linux (RHEL), offering enterprise-grade stability and security. Widely used in server environments and data centers, CentOS 7 introduces many new features, such as the systemd initialization system and improved network management, providing better performance and compatibility.

⚠️:CentOS 7 在 2024 年 6 月 30 日后停止维护,CentOS Stream 作为新的方向,提供了一个滚动发布的预览平台。对于需要稳定、长期支持的用户,可以考虑迁移到 AlmaLinuxRocky LinuxOracle Linux 等替代发行版。

⚠️:CentOS 7 will stop receiving maintenance after June 30, 2024. CentOS Stream, as the new direction, offers a rolling-release preview platform. For users requiring stable, long-term support, alternatives such as AlmaLinux, Rocky Linux, or Oracle Linux can be considered.


4.2 CentOS 7系统镜像下载 / Download CentOS 7 ISO Image

CentOS 7的ISO镜像下载链接/Download link for CentOS 7 ISO image:

在这里插入图片描述

⚠️ 提示:CentOS 7 在 2024 年 6 月 30 日后停止维护,CentOS Stream 作为新的方向,提供了一个滚动发布的预览平台。对于需要稳定、长期支持的用户,可以考虑迁移到 AlmaLinuxRocky LinuxOracle Linux 等替代发行版。

⚠️ Note:CentOS 7 will stop receiving maintenance after June 30, 2024. CentOS Stream, as the new direction, offers a rolling-release preview platform. For users requiring stable, long-term support, alternatives such as AlmaLinux, Rocky Linux, or Oracle Linux can be considered.


4.3 安装步骤 / Installation Steps

  1. 创建新的虚拟机

    • 在VMware WorkStation或Fusion中,选择“创建新的虚拟机”选项。
    • Choose “Create a New Virtual Machine” in VMware WorkStation or Fusion.
  2. 选择典型安装

    • 选择“典型安装”选项,并点击“下一步”。
    • Select the “Typical Installation” option and click “Next”.
  3. 加载CentOS 7 ISO文件

    • 在安装过程中,选择“使用ISO镜像文件”并加载下载的CentOS 7 ISO文件。
    • During the installation process, select “Use ISO Image File” and load the downloaded CentOS 7 ISO file.
  4. 分配虚拟机资源

    • 配置虚拟机的内存和硬盘大小,建议至少分配2GB内存和20GB硬盘空间。
    • Configure the virtual machine’s memory and disk size, recommending at least 2GB of memory and 20GB of disk space.
  5. 启动虚拟机

    • 启动虚拟机,系统将从ISO文件中启动CentOS 7安装程序。
    • Start the virtual machine, and the system will boot from the ISO file to start the CentOS 7 installation.
  6. 选择安装语言

    • 在CentOS 7安装程序中,选择您所需的语言并点击“继续”。
    • In the CentOS 7 installation program, select your preferred language and click “Continue”.
  7. 配置安装目的地

    • 选择“安装目的地”,选择虚拟磁盘作为安装目标,并设置分区方案(如自动分区)。
    • Select “Installation Destination,” choose the virtual disk as the installation target, and configure the partitioning scheme (e.g., automatic partitioning).
  8. 设置网络和主机名

    • 进入“网络和主机名”设置,确保网络连接正常,并配置主机名。
    • Go to “Network & Host Name” settings, ensure network connectivity, and configure the hostname.
  9. 设置ROOT密码和创建用户

    • 在“安全策略”下,设置ROOT密码并创建一个普通用户账户。
    • Under “Security Policy,” set the ROOT password and create a regular user account.
  10. 开始安装

    • 点击“开始安装”按钮,系统将开始安装CentOS 7。
    • Click the “Begin Installation” button, and the system will start installing CentOS 7.
  11. 完成安装

    • 安装完成后,系统将提示重启虚拟机。重启后,登录CentOS 7系统进行配置。
    • After installation is complete, the system will prompt you to restart the virtual machine. Upon reboot, log in to the CentOS 7 system for further configuration.
安装步骤:

示范安装视频/Installation Demo Video:VMware Workstation安装CentOS 7

VMware Workstation安装CentOS 7

5. 扩展:虚拟机快照 / Extension: Virtual Machine Snapshots

5.1 为什么需要使用虚拟机快照? / Why Use Virtual Machine Snapshots?

在学习阶段我们无法避免可能会损坏 Linux 操作系统。如果系统损坏,重新安装一个 Linux 操作系统会非常麻烦。通过拍摄虚拟机快照,可以在系统损坏时快速恢复到正常状态。
During the learning phase, we may inevitably damage the Linux operating system. If the system is damaged, reinstalling a Linux operating system can be very troublesome. By taking virtual machine snapshots, we can quickly restore to a normal state when the system is damaged.

5.2 拍摄快照 / Taking Snapshots

步骤 / Steps
  1. 打开 VMware WorkStation 或 Fusion。
    Open VMware WorkStation or Fusion.
  2. 选择需要拍摄快照的虚拟机。
    Select the virtual machine for which you want to take a snapshot.
  3. 点击虚拟机菜单中的“快照”选项,选择“拍摄快照”。
    Click the “Snapshots” option in the virtual machine menu and select “Take Snapshot”.
  4. 输入快照名称和描述,点击“确定”。
    Enter a snapshot name and description, and click “OK”.
  5. 快照拍摄完成后,可以在需要时通过“快照管理器”恢复到之前的快照状态。
    After the snapshot is taken, you can restore to the previous snapshot state through the “Snapshot Manager” when needed.

5.3 恢复快照 / Restoring Snapshots

  1. 在 VMware WorkStation 或 Fusion 中,选择需要恢复的虚拟机。
    In VMware WorkStation or Fusion, select the virtual machine you want to restore.
  2. 点击虚拟机菜单中的“快照”选项,选择“快照管理器”。
    Click the “Snapshots” option in the virtual machine menu and select “Snapshot Manager”.
  3. 在快照管理器中,选择要恢复的快照。
    In the Snapshot Manager, select the snapshot you want to restore.
  4. 点击“恢复”按钮,确认恢复操作。
    Click the “Restore” button and confirm the restore operation.

5.4 删除快照 / Deleting Snapshots

  1. 在 VMware WorkStation 或 Fusion 中,选择需要删除快照的虚拟机。
    In VMware WorkStation or Fusion, select the virtual machine whose snapshot you want to delete.
  2. 点击虚拟机菜单中的“快照”选项,选择“快照管理器”。
    Click the “Snapshots” option in the virtual machine menu and select “Snapshot Manager”.
  3. 在快照管理器中,选择要删除的快照。
    In the Snapshot Manager, select the snapshot you want to delete.
  4. 点击“删除”按钮,确认删除操作。
    Click the “Delete” button and confirm the delete operation.

6. 扩展:Windows 11配置WSL(Ubuntu)环境 / Extension: Setting Up WSL (Ubuntu) on Windows 11

6.1 为什么使用WSL? / Why Use WSL?

WSL(Windows Subsystem for Linux)允许在 Windows 上运行 Linux 环境,不需要虚拟机,从而减少系统资源的占用。
WSL (Windows Subsystem for Linux) allows you to run a Linux environment on Windows without the need for a virtual machine, thereby reducing system resource usage.

6.2 什么是WSL? / What is WSL?

WSL 是 Windows 子系统,可以运行 Linux 二进制可执行文件(ELF 格式)。
WSL is a Windows subsystem that can run Linux binary executables (ELF format).

6.3 WSL 部署 / Deploying WSL

安装步骤 / Installation Steps
  1. WIN11 系统桌面右击 Windows 图标,进入 “设置” -> “应用” -> “可选功能”,点击 “查看功能”,勾选 “适用于Linux的Windows子系统”,确认后进行搜索相关硬件并应用相关更改,然后重新启动。

    • Right-click the Windows icon on the WIN11 desktop, go to “Settings” -> “Apps” -> “Optional features”, click “View features”, check “Windows Subsystem for Linux”, confirm, search for related hardware, apply the changes, and then restart.
      在这里插入图片描述
  2. 重启后,进入 Microsoft Store 搜索 Ubuntu 系统进行下载安装。安装完成后,打开 Ubuntu 系统,按照提示完成用户名和用户密码配置创建。

    • After restarting, go to Microsoft Store, search for the Ubuntu system, and download and install it. Once installed, open Ubuntu and follow the prompts to complete the creation of a username and password.
  3. 使用 Windows Terminal 进入到 Ubuntu 系统界面,也可以设置成软件打开自启动 Ubuntu 系统。

    • Use Windows Terminal to access the Ubuntu system interface. You can also set it to automatically start Ubuntu when you open the software.

7. 远程连接Linux系统 / Remote Connection to Linux Systems

7.1 图形化与命令行操作模式 / Graphical and Command-Line Operation Modes

操作系统的使用有两种模式:图形化页面和命令行操作模式。无论是Windows、Linux还是MacOS系统,都支持这两种使用形式。

Operating systems have two modes of use: graphical interface and command-line interface. Both Windows, Linux, and MacOS support these modes.

  • 图形化: 使用操作系统提供的图形化页面,以获得图形化反馈的形式使用操作系统。

  • Graphical: Using the graphical interface provided by the operating system to interact with it through visual feedback.

  • 命令行: 使用操作系统提供的各类命令,以字符反馈的形式使用操作系统。

  • Command-Line: Using various commands provided by the operating system to interact with it through text feedback.

7.2 为什么Linux要使用命令行操作模式?/ Why Use Command-Line Interface in Linux?

尽管图形化是大多数人使用计算机的第一选择,但在Linux操作系统上,这个选择被反转了。这是因为:

Although graphical interfaces are the first choice for most users, this choice is reversed in Linux systems due to:

  1. Linux在图形化页面的优化上并未重点发力,导致其图形化页面不好用且不稳定。
  • Linux has not focused much on optimizing graphical interfaces, making them less usable and less stable.
  1. 在开发中,使用命令行形式效率更高,更加直观,并且资源占用低,程序运行更稳定。
  • In development, command-line interfaces are more efficient, more intuitive, use fewer resources, and result in more stable program execution.

7.3 为什么使用Finalshell远程连接第三方软件? / Why Use Finalshell for Remote Connections?

通过VMware可以得到Linux虚拟机,但在VMware中操作Linux的命令行页面不太方便,主要原因包括:

VMware can provide a Linux virtual machine, but using the command-line interface in VMware can be inconvenient due to:

  • 内容的复制、粘贴跨越VMware不方便

  • Copying and pasting content across VMware is inconvenient.

  • 文件的上传、下载跨越VMware不方便

  • Uploading and downloading files across VMware is inconvenient.

  • 和Linux系统的各类交互跨越VMware不方便

  • Interacting with the Linux system across VMware is inconvenient.

可以使用Finalshell来解决这些问题。以下是Finalshell的下载地址:
You can use Finalshell to resolve these issues. Here are the download links for Finalshell:

7.4 Finalshell连接虚拟机 / Connecting to the Virtual Machine with Finalshell

连接步骤:
  1. 登录进入CentOS 7系统。

    • Log in to the CentOS 7 system.
  2. 在CentOS 7界面空白处右击,点击 Open Terminal 进行命令行操作。

    • Right-click on the CentOS 7 screen, and select Open Terminal for command-line operations.
  3. 在终端输入 ifconfig 命令,获取 ens33 中显示的IP地址。

    • In the terminal, type ifconfig to get the IP address shown in ens33.
    ifconfig
    
  4. 进入Finalshell软件,点击文件夹+位置图标,选择 SSH连接(Linux)

    • Open Finalshell, click the folder + location icon, and select SSH Connection (Linux).
  5. 按照设置填写配置,然后确认。

    • Fill in the configuration according to the settings, then confirm.
  6. 进入连接,点击 接受并保存

    • Enter the connection, click Accept and Save.
  7. 接入连接界面,使用Linux命令检查是否同步,例如 ls 命令。

    ls
    
    • In the connection interface, use Linux commands to check synchronization, such as the ls command.

⚠️ 提示:如果无法获取到 ens33 IP地址,可以按下 Win+R 键,输入 services.msc 命令,查看并打开 VMware DHCP servicesVMware NAT services

  • ⚠️ Note: If you cannot get the IP address for ens33, press Win+R, type services.msc, and check and open VMware DHCP services and VMware NAT services.
    在这里插入图片描述
  • 12
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

无线网络优化

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值