【Ubuntu】Win11 VmWare虚拟机安装Ubuntu 22.04.1-server

简介: 【Ubuntu】Win11 VmWare虚拟机安装Ubuntu 22.04.1-server

引言

如标题所说,属于个人虚拟机安装Ubuntu的笔记记录。

VM安装

网上有很多免费使用的手段,这里就不过多介绍了。

下载Ubuntu 22.04.1-server

进入Ubuntu的中文网站:Ubuntu系统下载 | Ubuntu

image.png

根据最新的版本下载即可。本次使用使用USB或者DVD的物理镜像安装。

image.png

VM安装Ubuntu

Vm安装完成之后,我们直接去官方网站下载Ubuntu 22.04.1 的Sever版本,在VM当中我们选择直接创建的新的镜像。

image.png

在磁盘中选择下载下来的ISO镜像文件。

image.png

选择直接下一步

image.png

选择磁盘大小,这里个人磁盘空间比较充足,选择了30GB。

image.png

选择语言

这里建议使用英文语言:

image.png

选择键盘

下面是选择键盘的方式,默认下一步即可:

image.png

配置网络

注意:如果这里配置网络一会安装系统速度可能会较慢,因为ubuntu会从网络上下载更新。

image.png

可以选择DHCP获取 IP,有利于新手快速学习,如果读者有IP知识也可以按tab键配置IP相关 地址,如上图中标记。

image.png

比如可以参考下面的方式配置网络IP

image.png

配置的固定IP地址如上图所示,地址段根据vm默认即可,DNS为公共可用DNS。

选择代理

选择代理,这里直接使用默认的设置即可。

image.png

选择软件源

如果开启联网,ubuntu 默认会选择根据软件源进行下载。如果需要联网更新这里可以配置清华源的地址:

mirrors.tuna.tsinghua.edu.cn/ubuntu

注意:可以选择VM外的粘贴功能粘贴进去,清华源有ubuntu20,有的源没有,此处也可安装完毕配置。

image.png

磁盘分区

新手建议直接使用官方给的默认分区配置。这里就选择默认的使用整块磁盘自动分区。

image.png

磁盘分区信息预览

最后是分区的信息预览,这里直接Done即可。

image.png

提示:确认是否继续,继续后会对磁盘进行格式化会破坏磁盘数据,如果是宿主机系统重装建议提前备份。

配置系统信息

配置系统主机名、登录用户和密码。

image.png

OpenSSL安装

这里需要手动勾选一下,按空格键勾选图中的小方框内为小叉子,然后按tab键选择Done继续。

image.png

可选安装

Ubuntu提供一些流行的常见运维工具提供默认安装,比如云服务器的构建,K8S,Docker的软件。

这里个人勾选了docker和powershell。

image.png

最后等待安装即可。

image.png

注意安装过程中可能出现报错,此处为卸载光驱失败了,因为是虚拟机安装,可不用理会,按回车重启即可。

image.png

当安装完成之后,最下方的界面会提示重启或者查看全部日志。我们选择重启然后等待Ubuntu做最后的初始化操作即可。

重启完成之后使用上面系统信息配置的用户登陆即可。注意这个用户不是ROOT,但是具备和ROOT相同的权限。

image.png

Root用户配置

Ubuntu 在第一次登陆之后需要设置ROOT用户的密码,切换Root和重新设置密码的命令如下:

修改root密码


sudo passwd root

切换root账户


sudo su

注意默认情况下无法用Root远程登陆。

Root 远程登陆

默认Ubuntu不允许root远程登录,后期如果想通过root登陆系统则必须修改SSH配置文件中的相关参数 才行。


sudo vim /etc/ssh/sshd_config PermitRootLogin yes

修改之后需要重启SSHD后台进程:


sudo systemctl restart sshd

Xshell 远程连接

检查设置

如果在之前的安装步骤中没有安装OpenSSL,可以使用下面的命令安装:


sudo apt-get install openssh-server

在连接之前,需要保证 xshell 所在主机 和 ubuntu( 虚拟机 ) 相互能平通,因为ssh远程连接是通过网络连接的,如果网络不通,就无法连接。

Ubuntu 系统使用ip addr命令查看网络IP,Windows主机使用ipconfig查看网络IP:


ip addr

image.png

Window主机地址如下:

image.png

双方向主机Ping一下,如果都能联通,可以进行下一步,否则需要检查网卡配置是否正确。

Xshell连接配置

个人使用的版本为Xshell7教育版,在下面的界面中新建一个SSH远程连接,配置如下:

image.png

第一次连接Xshell会警告安全性,直接同意即可,接着是提示输入用户名和密码。注意在默认情况下Ubuntu是不能用Root登陆的。


Connecting to 192.168.110.128:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-57-generic x86_64)
 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
  System information as of Sun Jan  8 06:45:58 AM UTC 2023
  System load:  0.0078125          Processes:                226
  Usage of /:   41.8% of 13.67GB   Users logged in:          1
  Memory usage: 12%                IPv4 address for docker0: 172.17.0.1
  Swap usage:   0%                 IPv4 address for ens33:   192.168.110.128
60 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Last login: Sun Jan  8 03:46:40 2023 from 192.168.110.1
xander@xander:~$

配置apt源

Ubuntu 使用的是apt命令进行安装的,如果之前未进行软件源,会使用Ubuntu的官网镜像默认的地址,基本等于说是在国外,如果要替换,可以使用下面的方案。

清华大学的镜像站的配置网站如下:

ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

清华大学开源软件源配置方式

下面直接拷贝网站的内容。

本镜像仅包含 32/64 位 x86 架构处理器的软件包,在 ARM(arm64, armhf)、PowerPC(ppc64el)、RISC-V(riscv64) 和 S390x 等架构的设备上(对应官方源为ports.ubuntu.com)请使用 ubuntu-ports 镜像

手动替换

Ubuntu 的软件源配置文件是 /etc/apt/sources.list


xander@xander:~$ sudo vim /etc/apt/sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy main restricted
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates main restricted
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-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.tuna.tsinghua.edu.cn/ubuntu jammy universe
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates universe
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-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.tuna.tsinghua.edu.cn/ubuntu jammy multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-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.tuna.tsinghua.edu.cn/ubuntu jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security main restricted
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security main restricted
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security universe
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security multiverse

手动替换的方式可以参考网站,因为不同的版本替换方式不太一样,这里为22.04LTS的版本。


# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

命令替换

命令替换的方式使用下面的命令即可。


sudo sed -i "s@http://.*archive.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
sudo sed -i "s@http://.*security.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list

apt简介

  • apt等同于Centos7的yum命令
  • apt-get是第一代的包管理工具,最稳定
  • apt是改进的包管理工具,比apt-get要先进,官方推荐使用apt来管理软件

apt和CenterOs系统的区别如下:

操作内容 Centos6/7 Debian/Ubuntu
1.软件包后缀 *.rpm *.deb
2.软件源配置文件 /etc/yum.conf /etc/apt/sources.list
3.更新软件包列表 yum makecache fast apt update
4.从软件仓库安装软件 yum install package apt install package
5.安装本地软件包 rpm -i pkg.rpm dpkg -i pkg.deb
6.删除软件包 yum remove package apt remove package
7.获取某软件包的信息 yum search package apt search package

参考资料

Ubuntu 20.04 live server版安装(详细版) | 运维密码 (mefj.com.cn)


相关文章
|
8天前
|
存储 分布式计算 Linux
安装篇--CentOS 7 虚拟机安装
VMware 装 CentOS 7 不知道从哪下手?这篇超详细图文教程手把手教你在 VMware Workstation 中完成 CentOS 7 桌面系统的完整安装流程。从 ISO 镜像下载、虚拟机配置,到安装图形界面、设置用户密码,每一步都有截图讲解,适合零基础新手快速上手。装好之后无论你是要搭 Hadoop 集群,还是练 Linux ,这个环境都够你折腾一整天!
272 3
|
10天前
|
Ubuntu 安全 关系型数据库
安装MariaDB服务器流程介绍在Ubuntu 22.04系统上
至此, 您已经在 Ubuntu 22.04 系统上成功地完成了 MariadB 的标准部署流程,并且对其进行基础但重要地初步配置加固工作。通过以上简洁明快且实用性强大地操作流程, 您现在拥有一个待定制与使用地强大 SQL 数据库管理系统。
116 18
|
12天前
|
Ubuntu 安全 关系型数据库
安装MariaDB服务器流程介绍在Ubuntu 22.04系统上
至此, 您已经在 Ubuntu 22.04 系统上成功地完成了 MariadB 的标准部署流程,并且对其进行基础但重要地初步配置加固工作。通过以上简洁明快且实用性强大地操作流程, 您现在拥有一个待定制与使用地强大 SQL 数据库管理系统。
75 15
|
12天前
|
存储 Ubuntu iOS开发
在Ubuntu 22.04系统上安装libimobiledevice的步骤
为了获取更多功能或者解决可能出现问题,请参考官方文档或者社区提供支持。
54 14
|
14天前
|
Ubuntu 安全 关系型数据库
安装与配置MySQL 8 on Ubuntu,包括权限授予、数据库备份及远程连接指南
以上步骤提供了在Ubuntu上从头开始设置、配置、授权、备份及恢复一个基础但完整的MySQL环境所需知识点。
188 7
|
27天前
|
消息中间件 人工智能 运维
Ubuntu环境下的 RabbitMQ 安装与配置详细教程
本文聚焦在Ubuntu下RabbitMQ安装与配置教程,旨在帮助读者快速构建稳定可用的消息队列服务。
|
2月前
|
XML Ubuntu Java
|
2月前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 22.04.1上安装MySQL 8.0及设置root密码的注意事项
这些是在Ubuntu 22.04.1 系统上安装MySQL 8.0 及设置root密码过程中必须考虑的关键点。正确的遵循这些步骤可确保MySQL的安装过程既顺利又安全。
496 20
|
2月前
|
Ubuntu Linux
如何在 Ubuntu 服务器上安装桌面环境(GUI)
如果你有任何问题,请在评论区留言。你会在服务器上使用 GUI 吗?参照本文后你遇到了什么问题吗?
208 0
|
2月前
|
Web App开发 Ubuntu Oracle
Ubuntu安装与使用详解:掌握开源操作系统的钥匙
遵循这些步骤和指南,你将能够顺利地开始使用Ubuntu,并充分利用其强大的功能和友好的界面。