Linux command
dnf-install 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Install
sudo dnf install [package1] [package2]
Example
sudo dnf install [path/to/file]
Example
sudo dnf install [https://example.com/package.rpm]
Example
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-[10].noarch.rpm
Example
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-[8].rpm
说明
dnf install is the primary command for installing software packages on Red Hat-based distributions including RHEL, CentOS, Fedora, and AlmaLinux. It handles installation from multiple sources: repository package names, local RPM files, or direct URLs to RPM packages. The command automatically resolves and installs all required dependencies, downloading them from configured repositories. When installing from URLs, this is commonly used to add third-party repositories like EPEL or RPM Fusion by installing their release packages. The tool verifies package signatures, checks for conflicts, and can handle complex scenarios like replacing packages or allowing erasure of conflicting packages with --allowerasing. Root privileges are required as installation modifies system files.
参数
- -y, --assumeyes
- Automatically answer yes to prompts
- --allowerasing
- Allow erasing conflicting packages
- --downloadonly
- Download only, don't install
FAQ
What is the dnf-install command used for?
dnf install is the primary command for installing software packages on Red Hat-based distributions including RHEL, CentOS, Fedora, and AlmaLinux. It handles installation from multiple sources: repository package names, local RPM files, or direct URLs to RPM packages. The command automatically resolves and installs all required dependencies, downloading them from configured repositories. When installing from URLs, this is commonly used to add third-party repositories like EPEL or RPM Fusion by installing their release packages. The tool verifies package signatures, checks for conflicts, and can handle complex scenarios like replacing packages or allowing erasure of conflicting packages with --allowerasing. Root privileges are required as installation modifies system files.
How do I run a basic dnf-install example?
Run `sudo dnf install [package1] [package2]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -y, --assumeyes do in dnf-install?
Automatically answer yes to prompts