最小化安装后常用工具
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.bak
deb 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 multiverse
sudo 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: 2
renderer: NetworkManager
ethernets:
ens33:
dhcp4: false
dhcp6: false
addresses:
- 192.168.10.100/24
routes:
- to : default
via: 192.168.10.2
nameservers:
addresses:
- 114.114.114.114
- 114.114.115.115
- 233.6.6.6
root 修改文件权限,否则apply时会报错
chmod 0600 01-network-manager-all.yaml
network apply
Ubuntu桌面版关闭GUI环境
-- 关闭
sudo systemctl set-default multi-user.target
-- 启用
sudo systemctl set-default graphical.target