os/UNIX_LINUX
리눅스 패키지 관리 - apt, yum, dnf, pkg
공간사랑
2017. 10. 20. 19:15
리눅스 패키지 관리
|
Operating System |
Format | Tool(s) |
| Debian | .deb | apt, apt-cache, apt-get, dpkg |
| Ubuntu | .deb | apt, apt-cache, apt-get, dpkg |
| CentOS | .rpm | yum |
| Fedora | .rpm | dnf |
| FreeBSD | Ports, .txz | make, pkg |
| Update Package Lists | ||
|
System |
Command | |
| Debian / Ubuntu | sudo apt-get update | |
| CentOS | yum check-update | |
| Fedora | dnf check-update | |
| FreeBSD Packages | sudo pkg update | |
| FreeBSD Ports | sudo portsnap fetch update | |
| Upgrade Installed Packages | ||
|
System |
Command | Notes |
| Debian / Ubuntu | sudo apt-get upgrade | Only upgrades installed packages, where possible. |
| sudo apt-get dist-upgrade | May add or remove packages to satisfy new dependencies. | |
| CentOS | sudo yum update | |
| Fedora | sudo dnf upgrade | |
| FreeBSD Packages | sudo pkg upgrade | |
| FreeBSD Ports | less /usr/ports/UPDATING | Uses less to view update notes for ports (use arrow keys to scroll, press q to quit). |
| cd /usr/ports/ports-mgmt/portmaster && sudo make install && sudo portmaster -a | Installs portmaster and uses it to update installed ports. | |
| Find a Package | ||
|
System |
Command | Notes |
| Debian / Ubuntu | apt-cache search search_string | |
| CentOS | yum search search_string | |
| yum search all search_string | Searches all fields, including description. | |
| Fedora | dnf search search_string | |
| dnf search all search_string | Searches all fields, including description. | |
| FreeBSD Packages | pkg search search_string | Searches by name. |
| pkg search -f search_string | Searches by name, returning full descriptions. | |
| pkg search -D search_string | Searches description. | |
| FreeBSD Ports | cd /usr/ports && make search name=package | Searches by name. |
| cd /usr/ports && make search key=search_string | Searches comments, descriptions, and dependencies. | |
| View Info About a Specific Package | ||
|
System |
Command | Notes |
| Debian / Ubuntu | apt-cache show package | Shows locally-cached info about a package. |
| dpkg -s package | Shows the current installed status of a package. | |
| CentOS | yum info package | |
| yum deplist package | Lists dependencies for a package. | |
| Fedora | dnf info package | |
| dnf repoquery --requires package | Lists dependencies for a package. | |
| FreeBSD Packages | pkg info package | Shows info for an installed package. |
| FreeBSD Ports | cd /usr/ports/category/port && cat pkg-descr | |
|
Install a Package from Repositories | ||
|
System |
Command | Notes |
| Debian / Ubuntu | sudo apt-get install package | |
| sudo apt-get install package1 package2 ... | Installs all listed packages. | |
| sudo apt-get install -y package | Assumes "yes" where apt would usually prompt to continue. | |
| CentOS | sudo yum install package | |
| sudo yum install package1 package2 ... | Installs all listed packages. | |
| sudo yum install -y package | Assumes "yes" where yum would usually prompt to continue. | |
| Fedora | sudo dnf install package | |
| sudo dnf install package1 package2 ... | Installs all listed packages. | |
| sudo dnf install -y package | Assumes "yes" where dnf would usually prompt to continue. | |
| FreeBSD Packages | sudo pkg install package | |
| sudo pkg install package1 package2 ... | Installs all listed packages. | |
| FreeBSD Ports | cd /usr/ports/category/port && sudo make install | Builds and installs a port from source. |
| Install a Package from the Local Filesystem | ||
|
System |
Command | Notes |
| Debian / Ubuntu | sudo dpkg -i package.deb | |
| sudo apt-get install -y gdebi&& sudo gdebi package.deb | Installs and uses gdebi to install package.deb and retrieve any missing dependencies. | |
| CentOS | sudo yum install package.rpm | |
| Fedora | sudo dnf install package.rpm | |
| FreeBSD Packages | sudo pkg add package.txz | |
| sudo pkg add -f package.txz | Installs package even if already installed. | |
| Remove One or More Installed Packages | ||
|
System |
Command | Notes |
| Debian / Ubuntu | sudo apt-get remove package | |
| sudo apt-get autoremove | Removes unneeded packages. | |
| CentOS | sudo yum remove package | |
| Fedora | sudo dnf erase package | |
| FreeBSD Packages | sudo pkg delete package | |
| sudo pkg autoremove | Removes unneeded packages. | |
| FreeBSD Ports | sudo pkg delete package | |
| cd /usr/ports/path_to_port && make deinstall | De-installs an installed port. | |
| Get Help | ||
|
System |
Command | Notes |
| Debian / Ubuntu | man apt-get | Updating the local package database and working with packages. |
| man apt-cache | Querying the local package database. | |
| man dpkg | Working with individual package files and querying installed packages. | |
| CentOS | man yum | |
| Fedora | man dnf | |
| FreeBSD Packages | man pkg | Working with pre-compiled binary packages. |
| FreeBSD Ports | man ports | Working with the Ports Collection. |