BlackFlame33

BlackFlame33

若无力驾驭,自由便是负担。个人博客 https://blackflame33.cn/

How to install a virtual machine?

VMware Workstation Pro 15 Installing CentOS 6.9 Virtual Machine

I. Preliminary Concepts#

1. What is VMware Workstation?#

VMware Workstation is a desktop virtualization software launched by VMware, available in Windows and Linux versions. This software provides virtual machine functionality, allowing a computer to run multiple different operating systems simultaneously. In 2015, VMware Workstation released version 12, and VMware Player transitioned to a free version of VMware Workstation, renamed VMware Workstation Player, while the paid version of VMware Workstation was named VMware Workstation Pro.

2. What is CentOS?#

CentOS (Community Enterprise Operating System) is one of the Linux distributions, derived from Red Hat Enterprise Linux (RHEL) and compiled from source code released under open source regulations. Because it originates from the same source code, some servers that require high stability use CentOS instead of the commercial version of Red Hat Enterprise Linux. The difference between the two is that CentOS does not include closed-source software. The main modifications to the upstream code are to remove trademarks that cannot be freely used. In 2014, CentOS announced a partnership with Red Hat, but CentOS would continue to operate under a new committee and would not be influenced by RHEL.

Both CentOS and RHEL can use Fedora EPEL to supplement software.

3. What is a Virtual Machine?#

A virtual machine (VM) is a special software in the architecture of computer science that creates an environment between the computer platform and the end user, allowing the end user to operate other software based on the environment created by the virtual machine software. A virtual machine is a simulator of a computer system that simulates a complete hardware system function, running in a completely isolated environment, and can provide the functionality of a physical computer.

II. Preparation#

1. VMware Workstation Pro#

Click on the official website to log in and download, available in Chinese.

image

Then double-click to install, just like any other software, which will not be elaborated here.

Ps: In the spirit of good software usage, cracking is not encouraged; those who are capable should support the original version. If needed, please search online for "serial number key."

2. WinSCP#

WinSCP is an open-source SFTP client that runs on Windows systems, released under GPL. In addition to SFTP, WinSCP also supports SSH and SCP.

WinSCP was developed and maintained by Prague University of Economics starting in April 2000, based on PuTTY's implementation of SSH, supporting SSH-1 and SSH-2. WinSCP also supports the SCP (secure copy) communication protocol and has FTP file transfer functionality, which is more secure than FTP. Users can download it from SourceForge.

In simple terms, WinSCP allows for easy file transfer between the physical machine and the virtual machine.

Click on the official website download link to download, available in Chinese.

image

Then double-click to install, just like any other software, which will not be elaborated here.

Ps: Donating a certain amount can enable automatic updates and other additional features, but they are not very useful; the free version can achieve most functions.

3. Xshell#

Xshell is a powerful secure terminal emulation software that supports SSH1, SSH2, and the TELNET protocol for Microsoft Windows platforms. Xshell helps users enjoy their work in complex network environments through secure connections to remote hosts over the internet, along with its innovative design and features.

Xshell can be used to access servers under different systems in the Windows interface, thus achieving remote control of terminals effectively. In addition, it has a rich selection of appearance color schemes and styles.

In simple terms, Xshell can remotely control the Linux terminal of the virtual machine. Combined with the above software, we can minimize the virtual machine after it starts, saving system resources.

Click on the official website to fill in the information to download, available in Chinese.

image

Ps: The official offers free licenses for home or school use; click here to fill in the information to download.

image

4. CentOS Image File#

The official website provides a list of mirror sites, where you can find domestic mirror sites and download the required ISO image files.

image

III. Installing the Virtual Machine#

1. Virtual Machine Configuration#

After completing the preliminary preparations, we can officially start installing the virtual machine.

First, double-click to open VMware, select Create a New Virtual Machine in the Home tab, then select Custom ---> Hardware Compatibility select Workstation 15.x, then click Next ---> Install the Operating System Later ---> Select Linux for the guest operating system, and choose CentOS 6 64-bit (varies by person) then click Next ---> The virtual machine name and location can be customized, which has little impact. Then click Next ---> Processor configuration, virtual machine memory, and network type vary by person; it is best to check the official help documentation for understanding, select, and click Next.

image

image

image

The I/O controller type is recommended to be LSI Logic, click Next ---> Disk type is recommended to be SCSI, click Next ---> Disk selection varies by person; select after understanding, click Next ---> Disk capacity varies by person; it is recommended to allocate at least 6G of space, do not check Allocate all disk space now, select Store virtual disk as a single file, click Next ---> Specify the disk file name location, click Next ---> Display the summary, you can check again or customize hardware, click Finish to complete the virtual machine configuration.

In the new virtual machine tab, click Edit Virtual Machine Settings ---> Select CD/DVD ---> In the connection, select Use ISO image file, and choose the previously downloaded ISO image file.

image

2. Install the System#

After the configuration is done, we can start the virtual machine to install the system. In the virtual machine tab, click Power On This Virtual Machine.

At this point, the virtual machine will automatically read the ISO image file and prepare the installation process.

If you are unsure about the downloaded ISO image file, you can choose OK to check; otherwise, you can choose Skip to skip.

In the new interface, select Next ---> The language selection varies by person; after selecting, click Next ---> The keyboard is recommended to be American English, click Next ---> Device usage varies by person; if unsure, select Basic Storage Device, click Next ---> Check Apply my selection to all devices with undetected partitions or file systems, click Yes, ignore all data.

image

Setting the hostname varies by person; network configuration varies by person; if a static IP is required, it can be set here, click Next ---> Time zone settings vary by person, click Next ---> Setting the root account password varies by person, click Next ---> In the installation type, select Create Custom Layout, click Next.

Choosing a custom layout is to meet our personalized needs. My plan is to mount point /boot 1G, file system swap 3G, mount point / remaining available space. After setting, click Next.

image

Ps: What are mount points and file systems?

A mount point is essentially the entry directory of the disk file system in Linux, similar to the drive letters C:, D:, E:, etc., used to access different partitions in Windows. In fact, Windows XP also supports mounting a disk partition under a folder; it’s just that we are used to operating with drive letters like C: and D:, and generally do not mount partitions to folders.

The file system of a computer is a method for storing and organizing computer data, making access and retrieval easier. The file system uses the abstract logical concepts of files and tree directories instead of the physical device concept of data blocks used by hard drives and optical disks. Users use the file system to save data without worrying about the actual addresses of the data blocks on the hard drive (or optical disk); they only need to remember the directory and filename of the file. Before writing new data, users do not need to care about which block address on the hard drive has not been used; the storage space management (allocation and release) on the hard drive is automatically handled by the file system, and users only need to remember which file the data was written to.

File systems typically use hard drives and optical disks as storage devices and maintain the physical location of files on the device. However, in reality, a file system may simply be an interface for accessing data, with the actual data provided through network protocols (such as NFS, SMB, 9P, etc.) or in memory, and there may not even be corresponding files (like the proc file system).

Strictly speaking, a file system is a set of abstract data types that implement operations such as storing, hierarchically organizing, accessing, and retrieving data.

Click Format ---> Click Write changes to disk ---> Click Next ----- Software installation varies by person; select and click Next. You can check Customize now to personalize your installation, click Next and the system will start installing software and the system.

image

Wait patiently for the installation to complete.

After installation, restart according to the system prompts, and log in with the account and password. Thus, the virtual machine installation is complete!

IV. After Installation#

At this point, we have a newly created virtual machine. Now let's go over some configuration and upgrade tips.

1. Naming Personal Folders#

Anyone who has learned Linux knows that generally, each account has its corresponding user home directory, which contains folders like Documents, Downloads, etc., specific to the current user. These folders will change with the current language change, leading to the following usage scenario:

Using a Simplified Chinese system, but still finding English easier to use when entering paths in the terminal.

This can be easily adjusted; my current method is to enter the system in both Chinese and English languages, and the system will prompt you whether to change folder names due to the language change.

image

image

image

2. Setting a Static IP#

When using a virtual machine, we generally minimize it to save system resources and use third-party software to connect to the virtual machine for work. However, if a static IP is not specified, the virtual machine's IP will change every time it starts, making it difficult to connect. Therefore, we need to fix the virtual machine's IP.

  • Graphical Interface

    Right-click the network status icon, click Edit Connections...

    image

    Select the network you are using, click Edit -----> In IPv4 Settings, set Method to Manual and set the address, subnet mask, gateway, and DNS server below. For relevant knowledge analysis, please refer to the article “Introduction to Internet Protocol” by teacher Ruanyifeng, which is quite detailed and will not be elaborated here.

    After setting, disconnect and reconnect the network, use the ifconfig command to check if the IP address has changed; use the ping command to see if you can ping other computers; check if the physical machine can ping the virtual machine. If all can be confirmed, the static IP setting is successful!

  • Command Line Interface

    If the graphical interface was not installed during installation, we need to manually enter the system's network card configuration file for modification.

     vi /etc/sysconfig/network-scripts/your_network_card_name
    

    Modify your IP address in IPADDR=, then enter reboot to restart. At this point, your IP address will have changed. After that, check connectivity as in the graphical interface.

3. Synchronizing Time#

After installation, there may be a situation where the virtual machine and the physical machine, i.e., the real time, are inconsistent. However, this is not a problem; we can synchronize the time using ntpdate.

ntpdate cn.pool.ntp.org

Of course, if there is no response, it indicates that your virtual machine has not installed the ntp service; install it first using yum install ntp and then use it.

4. Setting Up Yum Repository#

Yum (Yellow dog Updater, Modified) is a package manager developed by the Duke University team, modified from the Yellow Dog Linux Yellow Dog Updater. It is a character front-end package manager based on RPM package management. It can automatically download RPM packages from specified servers and install them, handle dependency relationships, and install all dependent software packages at once without the hassle of downloading and installing them one by one. It is used by Yellow Dog Linux itself, as well as Fedora and Red Hat Enterprise Linux.

In simple terms, yum is like NPM in Node.js or homebrew in macOS. However, due to various reasons, accessing the official yum repository in China is very slow, so we need to manually change the yum repository to a domestic one, which will significantly increase access speed.

This time, we will take changing to the “Tsinghua University Open Source Software Mirror Site” as an example.

First, back up CentOS-Base.repo

sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

Next, create the file CentOS-Base.repo and write the following content:

sudo vi  /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Then run sudo yum makecache to update the cache. It is worth noting that the content of the above file is for CentOS 6; different versions should have different file contents, so please verify.

After that, we can enjoy high-speed downloads from domestic sources; quickly use yum update to experience it!

5. Upgrading the Kernel#

The kernel (English: Kernel, also known as core) in computer science is a computer program that manages the software's data I/O (input and output) requests, translating these requests into instructions for data processing and handing them over to the central processing unit (CPU) and other electronic components in the computer for processing. It is the most fundamental part of modern operating systems. It provides a secure way for numerous applications to access computer hardware, and this access is limited and determined by the kernel regarding how long a program can operate on a certain part of the hardware. Directly operating on hardware is very complex. Therefore, the kernel usually provides a method of hardware abstraction to complete these operations. With this, through inter-process communication mechanisms and system calls, application processes can indirectly control the required hardware resources (especially processors and I/O devices).

Strictly speaking, the kernel is not a necessary component of a computer system. Some programs can be directly loaded into the computer for execution; such designs indicate that the designer does not want to provide any hardware abstraction and operating system support; this is common in the design of early computer systems. However, as computer technology has developed, eventually, some auxiliary programs, such as program loaders and debuggers, were designed into the machine kernel or written into read-only memory. As these changes occurred, the concept of the operating system kernel gradually became clearer!

In simple terms, the kernel can determine which software can operate on hardware, in what way, and for how long. Accordingly, the more advanced the kernel, the better the system optimization. Conversely, the more advanced the kernel, the larger and bulkier it becomes, so please match and verify the kernel according to your system.

Generally speaking, running yum update will automatically install the latest kernel from the yum repository, but we can also enable the ELRepo repository to download.

Import the public key:

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

To install ELRepo for Red Hat-based systems:

yum install https://www.elrepo.org/elrepo-release-6-9.el6.elrepo.noarch.rpm

Then use yum update to install (if there are updates).

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.