操作 | 命令 |
ubuntu | |
源操作 | |
源地址 | 阿里源 --- deb http://mirrors.aliyun.com/ubuntu/ xenial main deb-src http://mirrors.aliyun.com/ubuntu/ xenial main deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe |
源配置 | sudo cp /etc/apt/sources.list /etc/apt/sources_init.list sudo gedit /etc/apt/sources.list |
源更新 | sudo apt-get update |
查看源中包的信息 | apt-cache madison pkg 查看可用版本: apt-cache show package 查看包详细信息 apt-cache depends package 了解使用依赖 apt-cache rdepends package是查看该软件包被哪些软件包依赖 |
软件包操作 | |
增加 | sudo apt-get install package=version --reinstall |
删除 | sudo apt remove package --purge 也删除配置文件 |
批量删除 | sudo apt-get clean && sudo apt-get autoclean 清理无用的软件包 |
修改 | |
修复/卸载 | sudo apt-get --fix-missing install |
升级 | sudo apt-get upgrade |
降级版本2->1 | apt install pkg dependent-pkg=1(已存在pkg=2,降级到1) |
查看 | apt list --installed dpkg -l | grep pkg_name |
验证查看 | sudo apt-get check 检查是否有损坏的依赖 |
centos | |
源/包操作 | yum安装 增加软件yum源(.repo文件,其中有软件仓库地址) /etc/yum.repos.d/xxx.repo查看源中的软件版本: yum --showduplicates list docker | expand查看已安装版本 yum list installed | grep docker安装指定版本 yum install -y docker-engine-1.12.6 docker-engine-selinux-1.12.6 卸载 yum remove -y docker-engine-1.12.6 docker-engine-selinux-1.12.6 yum erase -y docker-engine |