关于ubuntu:UbuntuWin11-VmWare虚拟机安装Ubuntu-22041server

0次阅读

共计 6740 个字符,预计需要花费 17 分钟才能阅读完成。

引言

如题目所说,属于集体虚拟机装置 Ubuntu 的笔记记录。

VM 装置

网络上有很多教程,这里就间接省略了。

下载 Ubuntu 22.04.1-server

进入 Ubuntu 的中文网站:Ubuntu 零碎下载 | Ubuntu

依据最新的版本下载即可。本次应用应用 USB 或者 DVD 的物理镜像装置。

VM 装置 Ubuntu

Vm 装置实现之后,咱们间接去官方网站下载 Ubuntu 22.04.1 的 Sever 版本,在 VM 当中咱们抉择间接创立的新的镜像。

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

抉择间接下一步

抉择磁盘大小,这里集体磁盘空间比拟短缺,抉择了 30GB。

抉择语言

这里倡议应用英文语言:

抉择键盘

上面是抉择键盘的形式,默认下一步即可:

配置网络

留神:如果这里配置网络一会装置零碎速度可能会较慢,因为 ubuntu 会从网络上下载更新。

能够抉择 DHCP 获取 IP,有利于老手疾速学习,如果读者有 IP 常识也能够按 tab 键配置 IP 相干 地址,如上图中标记。

比方能够参考上面的形式配置网络 IP

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

抉择代理

抉择代理,这里间接应用默认的设置即可。

抉择软件源

如果开启联网,ubuntu 默认会抉择依据软件源进行下载。如果须要联网更新这里能够配置清华源的地址:

https://mirrors.tuna.tsinghua.edu.cn/ubuntu

留神:能够抉择 VM 外的粘贴性能粘贴进去,清华源有 ubuntu20, 有的源没有,此处也可装置结束配置。

磁盘分区

老手倡议间接应用官网给的默认分区配置。这里就抉择默认的应用整块磁盘主动分区。

磁盘分区信息预览

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

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

配置零碎信息

配置零碎主机名、登录用户和明码。

OpenSSL 装置

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

可选装置

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

这里集体勾选了 docker 和 powershell。

最初期待装置即可。

留神装置过程中可能呈现报错,此处为卸载光驱失败了,因为是虚拟机装置,可不必理睬,按回车重启即可。

当装置实现之后,最下方的界面会提醒重启或者查看全副日志。咱们抉择重启而后期待 Ubuntu 做最初的初始化操作即可。

重启实现之后应用下面零碎信息配置的用户登陆即可。留神这个用户 不是 ROOT,然而具备和 ROOT 雷同的权限。

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

Window 主机地址如下:

单方向主机 Ping 一下,如果都能联通,能够进行下一步,否则须要查看网卡配置是否正确。

Xshell 连贯配置

集体应用的版本为 Xshell7 教育版,在上面的界面中新建一个 SSH 近程连贯,配置如下:

第一次连贯 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)

正文完
 0