linux命令大全卸载安装
linux命令大全卸载安装详细介绍
以下为你介绍 Linux 系统中不同包管理系统下软件安装和卸载的常用命令:
1. Debian 和 Ubuntu 系列(使用
apt或
apt-get)
- 安装软件
- 使用
apt:sudo apt install <软件包名> - 使用
apt-get:sudo apt-get install <软件包名>
- 使用
- 卸载软件
- 仅卸载软件:
sudo apt remove <软件包名> - 卸载软件并移除配置文件:
sudo apt purge <软件包名>
- 仅卸载软件:
- 更新软件包列表:
sudo apt update - 升级已安装的软件:
sudo apt upgrade
2. Red Hat 和 CentOS 系列(使用
yum或
dnf)
- 安装软件
- 使用
yum:sudo yum install <软件包名> - 使用
dnf(适用于较新的 CentOS 和 RHEL 系统):sudo dnf install <软件包名>
- 使用
- 卸载软件
- 使用
yum:sudo yum remove <软件包名> - 使用
dnf:sudo dnf remove <软件包名>
- 使用
- 更新软件包列表并升级已安装的软件
- 使用
yum:sudo yum update - 使用
dnf:sudo dnf update
- 使用
3. Arch Linux 系列(使用
pacman)
- 安装软件:
sudo pacman -S <软件包名> - 卸载软件
- 仅卸载软件:
sudo pacman -R <软件包名> - 卸载软件并移除依赖和配置文件:
sudo pacman -Rns <软件包名>
- 仅卸载软件:
- 同步软件包数据库并更新所有软件:
sudo pacman -Syu
4. OpenSUSE 系列(使用
zypper)
- 安装软件:
sudo zypper install <软件包名> - 卸载软件:
sudo zypper remove <软件包名> - 更新所有软件:
sudo zypper update
示例
Debian/Ubuntu 系统
- 安装
nginx:sudo apt install nginx - 卸载
nginx并移除配置文件:sudo apt purge nginx
Red Hat/CentOS 系统
- 安装
httpd:sudo dnf install httpd - 卸载
httpd:sudo dnf remove httpd
Arch Linux 系统
- 安装
firefox:sudo pacman -S firefox - 卸载
firefox并移除依赖和配置文件:sudo pacman -Rns firefox
OpenSUSE 系统
- 安装
vim:sudo zypper install vim - 卸载
vim:sudo zypper remove vim