Ubuntu 24.04 Server 版系统安装及配置

Ubuntu 24.04 Server 版安装及配置

文章目录

  • Ubuntu 24.04 Server 版安装及配置
    • 一、获取安装文件
    • 二、虚拟机配置
    • 三、安装界面
    • 四、配置网络
    • 五、扩容根分区

一、获取安装文件

二、虚拟机配置






三、安装界面

选择English(US)

问是否升级内核

配置键盘

手动配置ipv4网络(可选)

子网、IP、网关、DNS

是否配置静像源

系统使用默认静像源

使用默认磁盘分区


设置服务器用户及账号信息

不升级,默认的LTS版本维护周期5年

安装SSH服务!!按空格选择它

不安装系统应用

系统安装中

一定要等到这个状态,才算安装完成

系统重启时,提示这个,敲回车,确认卸载光盘

四、配置网络

bash 复制代码
[root@master01:/etc/netplan]# vi /etc/netplan/50-cloud-init.yaml
bash 复制代码
`这个是原先在安装界面时,配置好的IP地址,打开配置文件显示的内容`
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens33:
            addresses:
            - 192.168.100.10/24
            nameservers:
                addresses:
                - 8.8.8.8
                search: []
            routes:
            -   to: default
                via: 192.168.100.2
    version: 2

✅ 推荐手动配置网络

bash 复制代码
`在安装界面未配置IP时,可按视频教程手动配置以下内容`
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens33:
            dhcp4: no
            addresses:此外冒号后不要有空格
              - 192.168.100.10/24
            routes:
              - to: default
                via: 192.168.100.2
            nameservers:
              addresses: [119.29.29.29,8.8.8.8,114.114.114.114]
    version: 2
bash 复制代码
[root@master01:/etc/netplan]# netplan apply

五、扩容根分区

🚨 为什么只用了 49G?不是应该用满 100G 吗?

这是因为:

Ubuntu 安装程序默认设置有限制

  • 默认只给根分区分配 48~50G 左右(取决于版本和安装选项)

  • 即使你给了 100G 磁盘,它也不会自动把全部空间都用掉

  • 除非你手动调整分区大小

✅ 如何解决?扩展根分区到 100G?

你可以通过以下步骤 扩大逻辑卷并扩容文件系统

🔧 步骤一:检查当前 LVM 结构

bash 复制代码
sudo lvdisplay

🔧 步骤二:扩展逻辑卷(LV)

bash 复制代码
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

-l +100%FREE 表示使用剩余所有空间(这里是 49G)

🔧 步骤三:扩展文件系统(ext4)

bash 复制代码
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

注意:如果提示不支持,可能是文件系统类型不同,但 Ubuntu 默认是 ext4。

✅ 验证结果

bash 复制代码
df -h
相关推荐
gfdgd xi8 小时前
GXDE OS 25.2.1 更新了!引入 dtk6,修复系统 bug 若干
linux·运维·ubuntu·操作系统·bug·移植·桌面
qing222222228 小时前
Ubuntu:设置程序开机自启动
linux·运维·ubuntu
自由日记9 小时前
mysql初修1
数据库·mysql
少年攻城狮9 小时前
OceanBase系列---【oceanbase的oracle模式新增分区表】
数据库·oracle·oceanbase
BullSmall9 小时前
MySQL8.0全栈初始化脚本集
数据库·mysql
六月闻君9 小时前
MySQL8主从数据库复制故障
数据库·mysql
洲覆10 小时前
缓存异常:缓存穿透、缓存击穿、缓存雪崩
开发语言·数据库·mysql·缓存
xcLeigh10 小时前
KingbaseES数据库:本地连接全攻略!从环境检查到问题排查,新手也能轻松上手
数据库
rexling110 小时前
【玩转全栈】----Django基本配置和介绍
数据库·django·sqlite
Deamon Tree10 小时前
如何保证缓存与数据库更新时候的一致性
java·数据库·缓存