Tuesday, December 18

Linux: Installing packages

People who are new to using Linux, want to install necessary packages? No need to download them manually and waste your time. Linux offers tools for doing this automatically from the Terminal(or shell or console) itself.


In order to execute all the following commands , first user have to become a root user . To become a root user do the following.
  1. First open a Terminal/console/command prompt
  2. Type
    su
Then, you have to type in your root password


Debian/Ubuntu

APT -- Advanced Packaging Tool
apt-get is a tool to automatically update your Debian machine and get and install Debian packages/applications.

To install your desired package , use the command
# apt-get install package_name
apt will search it's database for the most recent version of this package_name and will retrieve it from the corresponding archive as specified in /etc/apt/sources.list. In the event that this package depends on another,apt will check the dependencies and install the needed packages. See this example:

The following options to apt-get may be useful:

-h This help text.
-d Download only - do NOT install or unpack archives
-f Attempt to continue if the integrity check fails
-s No-act. Perform ordering simulation
-y Assume Yes to all queries and do not prompt
-u Show a list of upgraded packages as well


You can also request a specific version of a package using the following syntax:
# apt-get install package_name=version

Don't know the exact package name , just know the word related to a package,use
# apt-cache search word
It gives you list of all packages which contain that word.


To
find new updates if any,use
# apt-get update

If you somehow damage an installed package, or simply want the files of a package to be reinstalled with the newest version that is available, you can use the --reinstall option as
# apt-get --reinstall install package_name

If you no longer want to use a package, you want to remove it ,use the following command
# apt-get remove package_name
When you do this,their configuration files, if any, will remain intact on the system. For a complete removal of the package, Use:
# apt-get --purge remove package_name

To upgrade packages within the same distribution
# apt-get -u upgrade

Completely upgrade the whole distribution to the latest.
# apt-get -u dist-upgrade
-u option,causes apt to show the complete list of packages which will be upgraded.


To
install a local package ,use the command
# dpkg -i package_name.deb

When you install a package, apt stores them in a local repository (/var/cache/apt/archives/), and then proceeds with installation.In time the local repository can grow and occupy a lot of disk space.To manage this local repository the following commands can be used.
#apt-get clean
It removes everything except lock files from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. Thus, if you need to reinstall a package apt should retrieve it again.

# apt-get autoclean
It removes only package files that can no longer be downloaded.


Fedora

Yum -- Yellow dog Updater Modified
yum is an automatic updater and package installer/remover for rpm systems.It automatically computes dependencies and figures out what things should occur to install packages.

To see a list of available softwares/packages,use
#yum list available

To install some software/package, use
# yum install package_name

To search for a package, you can use
# yum search word

To update some software, type
# yum update package_name
If "package_name" is left out,yum will update all softwares/packages in the system.


To see what updates are available, use the following command
# yum check-update


No comments: