进入 VMware Workstation 17 Pro下载链接
下拉到如下位置,点击DOWNLOAD
参考:虚拟机VMware下载与安装教程
本次安装是vmware 17,安装步骤差不多,只参考第二部分即可。
密钥(我试过,这个可以):JU090-6039P-08409-8J0QH-2YR7F
密钥:
ZA5RU-6FYD5-48EPY-3XXEE-PAUGD
ZF3R0-FHED2-M80TY-8QYGC-NPKYF
YF390-0HF8P-M81RQ-2DXQE-M2UT6
ZF71R-DMX85-08DQY-8YMNC-PPHV8
磁盘不要太小,否则后期再扩容会有点麻烦,40GB应该暂时够用
点击完成,等待系统安装
安装完成
按 快捷键 ctrl + alt + t 进入terminal
sudo passwd root
安装提示输入5中的用户名,同时填写root用户密码,我这里设置的是1234
输入命令 su
,回车(表示进入root用户),输入密码,此处为1234,$符号为变为#号,表示前面设置root账户密码成功。
输入命令 exit
,回车,退出root用户
输入命令poweroff
关闭虚拟机
安装后虚拟机和windows主机将共享剪切板,利于后面设置
点击虚拟机,选择设置,进入2虚拟机设置界面
分别单击CD/DVD(SATA)和软盘,设置为自动检测,点击确定
重新开启虚拟机,两个弹出框都选择“是”
选择虚拟机,点击安装VMware Tools
进入虚拟机后,双击桌面上的光盘标识
进入
在右侧空白处点击鼠标右键,选择“open in terminal”
执行mkdir ~/Desktop/tools
命令,在桌面新建tools文件夹,并使用cp
命令将xxxxx.gz文件复制到tools目录(按Tab键可自动补全文件名或命令)
使用cd命令进入tools目录,使用tar命令解压xxx.gz 当前目录(tools)
cd ~/Desktop/tools
tar -zxvf VMxxxxxxxxxxxxxxxxxxxxxxx.gz -C ./
输入划线命令,根据提示输入密码,此处为1qaz,第一项输入y,其他直接按回车即可
出现如下消息表示安装成功
命令行输入reboot,重启虚拟机,再次进入虚拟机时,虚拟机和windows主机将共享剪切板,可从外部拷贝字符到 terminal , 如我从外部拷贝一段字符xxxxx,
进入terminal后,单击右键,选择paste,即可粘贴外部字符到虚拟机。
目的:使得虚拟机能访问windows主机的网络,进而更新软件。
选择虚拟机—> 设置
选择网络适配器,选中NAT模式,点击底部确定
在windwos系统下,按快捷键 win + R,在窗口中输入cmd
进入windows命令行
输入命令 ipconfig
,可查看VMnet8的网络配置信息,重点关注ipv4地址,子网掩码和默认网关,稍后在虚拟机中需要配置。
我这里是
以太网适配器 VMware Network Adapter VMnet8:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::eda4:897e:97f4:b497%6
IPv4 地址 . . . . . . . . . . . . : 192.168.139.2
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . : 192.168.139.1
点击设置按钮
选择IPv4
选择Manual ,具体配置如下,其中2 Address设置为windows主机ipv4网络地址+7(可随意加几,末位不超过255即可),我这里设置的是192.168.139.2 + 7,即192.168.139.9;Netmask 255.255.255.0;Gate way把Address的末位变为1即可,即192.168.139.1;DNS同Gateway,192.168.139.1;最后右上角点击Apply按钮。
重新开关Wired按钮
再点击设置图标按钮,即可看到配置已生效
快捷键 ctrl + alt + t,进入terminal,输入命令ping www.baidu.com
,显示ping包时间即联网成功,可尝试打开火狐浏览器访问baidu
不设置软件源,无法通过命令执行apt install xxxx命令安装软件。
输入命令
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bcakup
并使用gedit打开/etc/apt/sources.list
进入gedit编辑器,ctrl + a , delete 清空sources.list,并将如下代码粘贴到sources.list
# deb cdrom:[Ubuntu 18.04.6 LTS _Bionic Beaver_ - Release amd64 (20210915)]/ bionic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb https://mirrors.cloud.tencent.com/ubuntu/ bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
删除末尾多余的标黄部分(csdn自动添加的)
terminal 中输入 sudo apt-get update
更新,有大小输出即正确(需要联网)
terminal 中输入 sudo apt-get upgrade
更新,有大小输出即正确(需要联网),碰到选项输入y即可
参考博客Ubuntu更换软件源
进入terminal 输入命令 sudo apt-get install gcc
, 依据提示选择 y
进入terminal 输入命令 sudo apt-get install g++
, 依据提示选择 y