配置 Ubuntu 24.04 模版机
一、下载 24.04 Server Arm 镜像
Ubuntu官网:https://cn.ubuntu.com/
123网盘:https://www.123865.com/s/lfKDVv-j9mNH?提取码:YYDS
二、开启 root 用户
切换用户:
sudo su
给root
用户添加密码:
passwd root
开通root
远程登录:
vim /etc/ssh/sshd_config
PermitRootLogin yes # 改为yes
重启 ssh 服务:
systemctl restart sshd
三、静态ip地址设置
编辑网卡文件:
vim /etc/netplan/< 替*换 >-cloud-init.yaml
添加以下配置:
network:
version: 2
renderer: networkd
ethernets:
ens160:
dhcp4: no
addresses:
- 192.168.10.3/24
routes:
- to: 0.0.0.0/0
via: 192.168.10.2
nameservers:
addresses:
- 8.8.8.8
- 233.5.5.5
默认:
# 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:
ens160:
dhcp4: true
version: 2
使网卡配置生效:
netplan apply
四、设置时区
查看当前时间:
date
设置上海时区:
sudo timedatectl set-timezone Asia/Shanghai
五、换阿里 apt 源
备份官方源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
编辑源配置:
sudo vim /etc/apt/sources.list
阿里24.04 ARM64 apt
源配置,更多查看阿里源配置文档:
deb https://mirrors.aliyun.com/ubuntu-ports/ noble main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ noble-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ noble-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu-ports/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ noble-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble-backports main restricted universe multiverse
更新源和软件包:
sudo apt update && sudo apt upgrade -y
安装常用命令:
sudo apt install -y wget git