Home > System Tutorial > LINUX > body text

How to install software packages using commands in linux

下次还敢
Release: 2024-04-11 23:18:22
Original
1016 people have browsed it

在 Linux 中安装软件包,可以使用包管理器(apt-get、yum、dnf),从软件仓库下载,手动解压二进制包,或从源代码自编译。

How to install software packages using commands in linux

如何在 Linux 中使用命令安装软件包

在 Linux 系统中安装软件包可以通过以下命令行工具:

1. 包管理器:

apt-get (Debian/Ubuntu):

<code>sudo apt-get install <软件包名称></code>
Copy after login

yum (CentOS/Red Hat):

<code>sudo yum install <软件包名称></code>
Copy after login

dnf (Fedora):

<code>sudo dnf install <软件包名称></code>
Copy after login

2. 软件仓库:

直接从软件仓库下载和安装软件包:

<code>wget https://packages.example.com/<软件包名称>.deb
sudo dpkg -i <软件包名称>.deb (Debian/Ubuntu)</code>
Copy after login

或者:

<code>wget https://packages.example.com/<软件包名称>.rpm
sudo rpm -i <软件包名称>.rpm (CentOS/Red Hat)</code>
Copy after login

3. 二进制包:

如果软件包为二进制格式,则可以手动将其解压并安装:

<code>tar -xzf <软件包名称>.tar.gz
cd <解压后的目录>
./configure
make
sudo make install</code>
Copy after login

4. 自编译:

从源代码编译和安装软件包:

<code>wget https://example.com/sources/<软件包名称>.tar.gz
tar -xzf <软件包名称>.tar.gz
cd <解压后的目录>
./configure
make
sudo make install</code>
Copy after login

附加说明:

  • 使用 sudo 命令以 root 权限安装软件包。
  • 软件包名称对大小写敏感。
  • 安装前,确保已为您的 Linux 系统配置了相应的软件仓库或源。
  • 建议定期使用 apt-get updateyum update 命令更新软件仓库缓存。
  • 某些软件包可能需要额外的依赖项,可以在安装时提示您安装。

The above is the detailed content of How to install software packages using commands in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!