working on file

This commit is contained in:
Jason S. Evans 2016-02-23 15:17:17 +01:00
parent 7202ca972d
commit b6a38ba421
1 changed files with 68 additions and 85 deletions

View File

@ -55,6 +55,7 @@ NOTE: All of the commands in this guide assume that the user is running the comm
In a Windows environment, programs are packaged in .exe or .msi installers which will then install most of the files needed to run the program. If your computer doesn't have some dependant applications, then the program that you are trying to run will either not install or not run properly. You will then have to scour the internet in order to find the missing required applications or libraries. For example in CentOS 7, in order to install the VIM text editor, I need to add the following packages:
....
gpm-libs x86_64 1.20.7-5.el7 base 32 k
groff-base x86_64 1.22.2-8.el7 base 942 k
perl x86_64 4:5.16.3-286.el7 base 8.0 M
@ -87,11 +88,13 @@ In a Windows environment, programs are packaged in .exe or .msi installers which
vim-common x86_64 2:7.4.160-1.el7 base 5.9 M
vim-filesystem x86_64 2:7.4.160-1.el7 base 9.6 k
which x86_64 2.20-7.el7 base 41 k
....
Imagine trying to manually install all of these programs one at a time just to be able to install a text editor! In the early days of Linux, we faced these kinds of problems, however this problem is fixed with package management systems such as apt, yum, and others. In order to install VIM in CentOS 7 today, I simple have to run `yum install vim`. Individaual binary programs, other resources making up the software, along with installation scripts (which tell the package management systems what other packages are required) makeup what we call packages.
Imagine trying to manually install all of these programs one at a time just to be able to install a text editor! In the early days of Linux, we faced these kinds of problems, however this problem is fixed with package management systems such as apt, yum, and others. In order to install VIM in CentOS 7 today, I simple have to run `yum install vim`. Individaual binary programs, other resources making up the software, along with installation scripts make up what we call packages.
From the list above, you can see gpm-libs. The following files are required before this one package can even be installed:
....
/sbin/ldconfig
libc.so.6(GLIBC_2.15)
rtld(GNU_HASH)
@ -100,11 +103,13 @@ libc.so.6(GLIBC_2.15)(64bit)
libncurses.so.5()(64bit)
libtinfo.so.5()(64bit)
rtld(GNU_HASH)
....
Package managers simplify all of that. They look at the package that you want to install such as VIM, LibreOffice, etc., then look at what other package it depends on, the dependancies of those packages, and so on; then it downloads them all and installs them.
Package managers simplify all of that. They look at the package that you want to install such as VIM, LibreOffice, etc., then look at what other package it depends upon, the dependancies of those packages, and so on; then it downloads them all and installs them.
This is what it looks like when I install the Midnight Commander package in Ubuntu:
....
root@51fa0970b940:/# apt-get install mc
Reading package lists... Done
Building dependency tree
@ -186,9 +191,9 @@ update-alternatives: using /usr/bin/mcedit to provide /usr/bin/editor (editor) i
Setting up unzip (6.0-9ubuntu1.5) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...
....
Most package systems are built around collections of package files. A package file is usually an archive which contains compiled binaries and other resources making up the software, along with installation scripts. Packages also contain valuable metadata, including their dependencies, a list of other packages required to install and run them.
==== Some different package management systems:
While their functionality and benefits are broadly similar, packaging formats and tools vary by platform:
@ -207,12 +212,11 @@ In Debian and systems based on it, like Ubuntu, Linux Mint, and Raspbian, the pa
Fedora and enterprise level distributions like Red Hat Enterprise Linux (RHEL), CentOS, and Oracle Linux use RPM files. In CentOS, Oracle, and RHEL, yum is used to interact with both individual package files and repositories. In recent versions of Fedora, yum has been supplanted by dnf, a modernized fork which retains most of yum's interface.
SuSE also uses RPM files. However, the package management software is known as zypper and has a tightly integrated GUI called YaST. Zypper's command line interface is very similar to yum and YasT can be access from a graphical mode or from the command line.
SuSE also uses RPM files. However, the package management software is known as zypper. Zypper's command line interface is very similar to yum and YasT can be access from a graphical mode or from the command line.
FreeBSD's binary package system is administered with the pkg command. FreeBSD also offers the Ports Collection, a local directory structure and tools which allow the user to fetch, compile, and install packages directly from source using Makefiles. It's usually much more convenient to use pkg, but occasionally a pre-compiled package is unavailable, or syou may need to change compile-time options.
Update Package Lists
~~~~~~~~~~~~~~~~~~~~
==== Update Package Lists
Most systems keep a local database of the packages available from remote repositories. It's best to update this database before installing or upgrading packages. As a partial exception to this pattern, yum and dnf will check for updates before performing some operations, but you can ask them at any time whether updates are available.
@ -227,8 +231,7 @@ Most systems keep a local database of the packages available from remote reposit
|FreeBSD Ports |`portsnap fetch update`
|=========================================
Upgrade Installed Packages
~~~~~~~~~~~~~~~~~~~~~~~~~~
==== Upgrade Installed Packages
Making sure that all of the installed software on a machine stays up to date would be an enormous undertaking without a package system. You would have to track upstream changes and security alerts for hundreds of different packages. While a package manager doesn't solve every problem you'll encounter when upgrading software, it does enable you to maintain most system components with a few commands.
@ -236,15 +239,15 @@ On FreeBSD, upgrading installed ports can introduce breaking changes or require
[cols="^,<,^",options="header",]
|=======================================================================
|System |Command |Notes
|Debian / Ubuntu |`apt-get upgrade` |Only upgrades installed packages, where possible.
| |`apt-get dist-upgrade` |May add or remove packages to satisfy new dependencies.
|CentOS |`yum update` |
|Fedora |`dnf upgrade` |
|SuSE |`zypper update`|
|FreeBSD Packages |`pkg upgrade` |
|FreeBSD Ports |`less /usr/ports/UPDATING` |Uses less to view update notes for ports (use arrow keys to scroll, pressq to quit).
| |`cd /usr/ports/ports-mgmt/portmaster && make install && portmaster -a` |Installs portmaster and uses it to update installed ports.
|System |Command |Notes
|Debian / Ubuntu |`apt-get upgrade` |Only upgrades installed packages, where possible.
| |`apt-get dist-upgrade` |May add or remove packages to satisfy new dependencies.
|CentOS |`yum update` |
|Fedora |`dnf upgrade` |
|SuSE |`zypper update` |
|FreeBSD Packages |`pkg upgrade` |
|FreeBSD Ports |`less /usr/ports/UPDATING` |Uses less to view update notes for ports (use arrow keys to scroll, pressq to quit).
| |`cd /usr/ports/ports-mgmt/portmaster && make install && portmaster -a` |Installs portmaster and uses it to update installed ports.
|=======================================================================
Find a Package
@ -257,18 +260,18 @@ locate a package is to search with command-line tools.
[cols="^,<,^",options="header",]
|=======================================================================
|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.
|SuSE |`zypper se search_string` |
|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.
|System |Command |Notes
|Debian / Ubuntu |`apt-cache search` |
|CentOS |`yum search` |
| |`yum search all` |Searches all fields, including description.
|Fedora |`dnf search` |
| |`dnf search all` |Searches all fields, including description.
|SuSE |`zypper se` |
|FreeBSD Packages |`pkg search` |Searches by name.
| |`pkg search -f` |Searches by name, returning full descriptions.
| |`pkg search -D` |Searches description.
|FreeBSD Ports |`cd /usr/ports && make search name=package` |Searches by name.
| |`cd /usr/ports && make search key=` |Searches comments, descriptions, and dependencies.
|=======================================================================
View Info About a Specific Package
@ -278,16 +281,16 @@ When deciding what to install, it's often helpful to read detailed descriptions
[cols="^,<,^",options="header",]
|=======================================================================
|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.
|SuSE|`zypper info search_string` |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` |
|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.
|SuSE |`zypper info search string` |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
@ -297,20 +300,20 @@ Once you know the name of a package, you can usually install it and its dependen
[cols="^,<,^",options="header",]
|=======================================================================
|System |Command |Notes
|Debian / Ubuntu |`apt-get install package` |
| |`apt-get install package1 package2 ...` |Installs all listed packages.
| |`apt-get install -y package` |Assumes "yes" where apt would usually prompt to continue.
|CentOS |`yum install package` |
| |`yum install package1 package2 ...` |Installs all listed packages.
| |`yum install -y package` |Assumes "yes" where yum would usually prompt to continue.
|Fedora |`dnf install package` |
| |`dnf install package1 package2 ...` |Installs all listed packages.
| |dnf install -y package |Assumes "yes" where dnf would usually prompt to continue.
|SuSE|`zypper install`|
|FreeBSD Packages |`pkg install package` |
| |`pkg install package1 package2 ...` |Installs all listed packages.
|FreeBSD Ports |`cd /usr/ports/category/port && make install` |Builds and installs a port from source.
|System |Command |Notes
|Debian / Ubuntu |`apt-get install package` |
| |`apt-get install package1 package2` |Installs all listed packages.
| |`apt-get install -y package` |Assumes "yes" where apt would usually prompt to continue.
|CentOS |`yum install package` |
| |`yum install package1 package2` |Installs all listed packages.
| |`yum install -y package` |Assumes "yes" where yum would usually prompt to continue.
|Fedora |`dnf install package` |
| |`dnf install package1 package2` |Installs all listed packages.
| |`dnf install -y package` |Assumes "yes" where dnf would usually prompt to continue.
|SuSE |`zypper install` |
|FreeBSD Packages |`pkg install package` |
| |`pkg install package1 package2` |Installs all listed packages.
|FreeBSD Ports |`cd /usr/ports/category/port && make install` |Builds and installs a port from source.
|=======================================================================
Install a Package from the Local Filesystem
@ -341,42 +344,22 @@ Since a package manager knows what files are provided by a given package, it can
[cols="^,<,^",options="header",]
|=======================================================================
|System |Command |Notes
|Debian / Ubuntu |`apt-get remove package` |
| |`apt-get autoremove` |Removes unneeded packages.|
|CentOS |`yum remove package` |
|Fedora |`dnf erase package` |
|FreeBSD Packages |`pkg delete package` |
| |`pkg autoremove` |Removes unneeded packages.
|SuSE|`zypper rm package`|
|FreeBSD Ports |`pkg delete package` |
| |`cd /usr/ports/path_to_port && make deinstall` |De-installs an installed port.
|System |Command |Notes
|Debian / Ubuntu |`apt-get remove package` |yum remove package
| |`apt-get autoremove` |Removes unneeded packages.
|CentOS |`yum remove package` |
|Fedora |`dnf erase package` |
|FreeBSD Packages |`pkg delete package` |
| |`pkg autoremove` |Removes unneeded packages.
|SuSE |`zypper rm package` |Removes unneeded packages.
|FreeBSD Ports |`pkg delete package` |
| |`cd /usr/ports/path_to_port && make deinstall` |De-installs an installed port.
|=======================================================================
Get Help
~~~~~~~~
In addition to web-based documentation, keep in mind that Unix manual pages (usually referred to as man pages) are available for most commands from the shell. To read a page, use man:
----------
$ man page
----------
In man, you can navigate with the arrow keys. Press / to search for text within the page, and q to quit.
[cols="^,<,^",options="header",]
|=======================================================================
|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` |
|SuSE|`man zypper`|
|FreeBSD Packages |`man pkg` |Working with pre-compiled binary packages.
|FreeBSD Ports |`man ports` |Working with the Ports Collection.
|=======================================================================
In addition to web-based documentation, keep in mind that Unix manual pages (usually referred to as man pages) are available for most commands from the shell. To read a page, use the `man` command. For example, `man yum` will give you a brief manual on how to use yum.
Conclusion and Further Reading
------------------------------