网络配置
sudo vim /etc/netplan/xxx.yaml
network:
version: 2
ethernets:
ens160:
dhcp4: no
addresses:
- 172.16.0.176/24
routes:
- to: default
via: 172.16.0.1
nameservers:
addresses:
- 223.5.5.5
- 223.6.6.6
关闭防火墙
sudo ufw status
sudo ufw disable
sudo ufw allow 5432/tcp
包管理
sudo apt update
sudo apt upgrade
sudo apt install <package_name>
sudo apt remove <package_name>
sudo apt autoremove
apt show <package_name>
apt-get
用法与apt
基本一致,apt
结合了 apt-get
和 apt-cache
的一些常用功能,使其更加简洁和高效,如果你在编写脚本,使用 apt-get
可能会更好.
apt list --installed
安装docker
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker ${USER}
newgrp docker
groups $USER
{
"data-root": "/data/docker",
"registry-mirrors": [
"https://7x3mic2t.mirror.aliyuncs.com"
],
"log-opts": {
"max-size": "100m",
"max-file":"1"
}
}
sudo systemctl daemon-reload
sudo systemctl restart docker
普通用户添加sudo
sudo usermod -aG sudo username
groups username
sudo apt update