【VMware安装及虚拟机配置】
1. 下载VMware
进入 VMware Workstation 17 Pro下载链接
下拉到如下位置,点击DOWNLOAD
2. 安装VMware
参考:虚拟机VMware下载与安装教程
只参考第二部分即可。
3. 激活VMware
密钥
17:JU090-6039P-08409-8J0QH-2YR7F
22H2:ZA5RU-6FYD5-48EPY-3XXEE-PAUGD
密钥:
ZF3R0-FHED2-M80TY-8QYGC-NPKYF
YF390-0HF8P-M81RQ-2DXQE-M2UT6
ZF71R-DMX85-08DQY-8YMNC-PPHV8
4. 下载ubuntu镜像
下载地址
点击红圈文件下载
5. 安装ubuntu
打开VMware,文件–> 新建虚拟机–>自定义
点击浏览,选择刚刚下载的文件
密码:1qaz
虚拟机名称随便填,不要有中文即可
磁盘不要太小,否则后期再扩容会有点麻烦,40GB应该暂时够用
默认值
点击完成,等待系统安装
安装完成
6. 系统配置
6.1 设置root账户
进入虚拟机ubuntu1804-001
按 快捷键 ctrl + alt + t 进入terminal
输入如下命令,回车(以后默认输入命令后回车执行命令)
sudo passwd root
安装提示输入5中的用户名,同时填写root用户密码,我这里设置的是1234
输入命令 su
,回车(表示进入root用户),输入密码,此处为1234,$符号为变为#号,表示前面设置root账户密码成功。
输入命令 exit
,回车,退出root用户
输入命令poweroff
关闭虚拟机
6.2 安装vmware-tools
安装后虚拟机和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,即可粘贴外部字符到虚拟机。
7.虚拟机网络配置
目的:使得虚拟机能访问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
虚拟机内部点击1图标,进入Wired Settings选项
点击设置按钮
选择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
8 设置软件源
不设置软件源,无法通过命令执行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更换软件源
9 GUN工具安装
gcc安装
进入terminal 输入命令 sudo apt-get install gcc
, 依据提示选择 y
g++ 安装
进入terminal 输入命令 sudo apt-get install g++
, 依据提示选择 y
安装成功
输入gcc -v
,输出如下表示安装成功
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!