最小化安装后常用工具
sudo apt-get install vim# ifconfig
apt install net-tools
# nload
apt install nload
# 很多都要用到
apt install build-essential
# 开发相关
apt install gcc g++apt install iproute2 ntpdate tcpdump telnet traceroute \
nfs-kernel-server nfs-common lrzsz tree openssl libssl-dev \
libpcre3 libpcre3-dev zlib1g-dev ntpdate traceroute gcc openssh-server \
lrzsz tree openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev ntpdate tcpdump \
telnet traceroute iotop unzip zip -y
设置 root 密码
允许root远程登录
-- 查看远程登录服务是否启用
systemctl status sshd
systemctl status ssh
重启ssh服务
systemctl restart ssh
其他
-- 备份镜像源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bakdeb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiversesudo apt update
备份虚拟机
设置静态ip
ubuntu 网卡配置
查看linux网关
-- 备份
cp /etc/netplan/01-network-manager-all.yaml 01-network-manager-all.yaml.bak-- 编辑静态ip
vim /etc/netplan/01-network-manager-all.yaml# Let NetworkManager manage all devices on this system
network:version: 2renderer: NetworkManagerethernets:ens33:dhcp4: falsedhcp6: falseaddresses: - 192.168.10.100/24routes:- to : defaultvia: 192.168.10.2nameservers:addresses: - 114.114.114.114- 114.114.115.115- 233.6.6.6
root 修改文件权限,否则apply时会报错
chmod 0600 01-network-manager-all.yamlnetwork apply
Ubuntu桌面版关闭GUI环境
-- 关闭
sudo systemctl set-default multi-user.target
-- 启用
sudo systemctl set-default graphical.target