Ubuntu 24.04.02 LTS 初始化安装

镜像下载

桌面版:ubuntu-24.04.2-desktop-amd64.iso

本次实验选用的是桌面版

使用的虚拟化软件 VMware Workstation

创建虚拟机

image-20250216234621886

image-20250216235038829

image-20250216235127444

加装镜像

image-20250224102123784

先别启动,接下来设置网络

配置NAT网卡

image-20250216235854241

开启虚拟机安装系统

启动之后,会有一个黑色界面有一个选项是Try or install ubuntu默认是第一个,直接回车就行了

image-20250224102809642

image-20250224103157744

image-20250224103723948

image-20250224103729945

image-20250224104437818

image-20250224104653496

image-20250224104755600

这是一个终端工具,接下来我就不在这里运行了,我会给出代码,你照着在上面那张图运行就行了

设置root用户密码

image-20250224111329361

配置静态ip

直接去那个终端运行就行了,我不截图了

安装必要工具

1
sudo apt-get install network-manager openssh-server vim inetutils-ping net-tools -y

查看需要配置的网卡,输入

1
ip a

image-20250224111556813

1
vim /etc/netplan/01-network-manager-all.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
# Let NetworkManager manage all devices on this system
network:
ethernets:
ens33:
addresses: [192.168.48.128/24]
dhcp4: false
nameservers:
addresses: [192.168.48.2, 114.114.114.114]
routes:
- to: default
via: 192.168.48.2
version: 2
renderer: NetworkManager

image-20250224111831503

这个ip192.168.48.128最后一位128你随意设置,192.168.48.这是网段对应前面配置NAT网卡你的网段,自行修改,网关(routes)也是

最后按esc,然后按shift+冒号键,输入wq保存退出

1
netplay apply

image-20250224112149255

静态ip已经配置好了

关闭防火墙

1. 查看防火墙状态:

要查看 Ubuntu 中 ufw 防火墙的状态,可以执行以下命令:

1
sudo ufw status

这将显示当前防火墙规则的状态,包括是否启用和允许的规则。

2. 开启防火墙:

如果防火墙没有启用,可以使用以下命令来启用 ufw 防火墙:

1
sudo ufw enable

启用防火墙后,它将按照默认规则开始工作,通常会拒绝所有传入连接,但允许所有传出连接。

3. 关闭防火墙:

要关闭 ufw 防火墙,可以执行以下命令:

1
sudo ufw disable

关闭防火墙后,所有传入和传出的连接将被允许,不再受到防火墙的限制。

4. 永久关闭防火墙:

如果想永久关闭 ufw 防火墙,可以执行以下步骤:

  • 停止 ufw 服务:

    sudo systemctl stop ufw

  • 禁用 ufw 服务的自动启动:

    sudo systemctl disable ufw --now

  • 重启系统,以确保防火墙不会在系统启动时重新启用。

设置阿里源

全部复制粘贴就行了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cat >/etc/apt/sources.list<<"EOF"
deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
EOF
sudo apt-get update

设置模板

进行关机

1
sudo poweroff

image-20250224114254416

特别声明
千屹博客旗下的所有文章,是通过本人课堂学习和课外自学所精心整理的知识巨著
难免会有出错的地方
如果细心的你发现了小失误,可以在下方评论区告诉我,或者私信我!
非常感谢大家的热烈支持!