Debian常用命令

一键脚本

dd系统

bash <(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') -d 11 -v 64 -a -p "自定义你的root密码"
bash <(wget --no-check-certificate -qO- 'https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh') -d 11 -v 64 -p "密码" -port "22"

# -d =Debian -c=Cenos -u=Ubuntu -dd=自定义镜像 , 版本号

Debian 查看当前系统的版本

查看”/etc/issue”文件

最简单的方法是查看/etc/issue这个文件

# cat /etc/issue
Debian GNU/Linux 9

如果还想知道 Debian 的小版本号,需要如下命令

# cat /etc/debian_version
9.4

查看”/etc/os-release”文件

如果想查看更详细的版本信息

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

使用 lsb_release 命令

系统默认可能不支持lsb_release命令,需要手动安装一下

# apt-get install lsb-release

然后通过如下命令查看

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.4 (stretch)
Release:        9.4
Codename:       stretch

Debian 11 Bullseye 上安装 Docker

sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/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/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

命令验证 Docker 版本:docker -v 

编辑docker配置文件 nano /etc/docker/daemon.json

{ 
    "log-driver": "journald",
    "storage-driver": "overlay2",
    "registry-mirrors": [ 
    "https://mirror.ccs.tencentyun.com",
    "https://docker.mirrors.ustc.edu.cn"
    ]
}

registry-mirrors : 配置镜像源地址
insecure-registries :配置私有库,例如 Harbor

重启配置 systemctl daemon-reload
重启docker systemctl restart docker.service

docker 方法2

curl -sSL https://get.docker.com/ | sh
systemctl enable docker
systemctl start docker

 

查看程序运行ID及端口占用:

[email protected]:~$ ps -e | grep transmission
 3167 ?        00:00:00 transmission-gt

[email protected]:~$ lsof -iUDP | grep 3167
transmiss 3167 maxime   17u  IPv4  58714      0t0  UDP *:51413 
transmiss 3167 maxime   18u  IPv4  58718      0t0  UDP maxime-laptop:42349->bbox.lan:5351 

Docker清理缓存及镜像缓存:

docker system prune -a
docker system prune