Skip to content

启用root账号

bash
sudo passwd root

sudo nano /etc/ssh/sshd_config

PermitRootLogin yes

删除非root用户

bash
userdel usos

静态 ip

vi /etc/netplan/50-cloud-init.yaml

yml
network:
  ethernets:
    ens33:
      dhcp4: false
      dhcp6: false
      addresses:
      - 10.0.35.8/24
      routes:
      - to: default
        via: 10.0.35.250
      nameservers:
        addresses:
        - 223.5.5.5
        - 223.6.6.6
        search:
        - localhost
        - local
  version: 2

时间设置

timedatectl set-timezone Asia/Shanghai

查看lvm磁盘占用

# 查看
df -h

fdisk -l

# 查看磁盘挂载情况
lsblk
# 查看lvm卷组的信息,如果看到 Free PE / Size > 0,表示还有扩容空间。
vgdisplay


# 扩容
#lvextend -L 10G /dev/mapper/ubuntu--vg-ubuntu--lv      //增大或减小至19G
#lvextend -L +10G /dev/mapper/ubuntu--vg-ubuntu--lv     //增加10G
#lvreduce -L -10G /dev/mapper/ubuntu--vg-ubuntu--lv     //减小10G
#lvresize -l  +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv   //按百分比扩

# 扩容
sudo lvresize -l  +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
# 生效
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv