How to install packages in Ubuntu from Command Line?

Posted by Joys of Programming on in Linux, Ubuntu

Ubuntu offers two tools which can easily help you to install the packages from the command line.

The basic package installation steps in Ubuntu are as follows

  1. Search for the correct package name to be installed
  2. Install the correct package

Two important command line tools for package installation in Ubuntu

  1. aptitude
  2. apt-get

Let’s explore each of these. Note that both these commands require sudo access to install the packages. For both examples, we will consider the scenario of installing the package firefox

aptitude for package installation

  • Search for the package
  • Use the search option to search for the package, you are looking for. It is not necessary that you must know the exact package name, you can simply write some of the letters

    $ aptitude search firefox
    i   firefox                                                        - meta package for the popular mozilla web browser
    p   firefox-3.0                                                    - dummy upgrade package for firefox-3.0 -> firefox-3.5
    p   firefox-3.0-branding                                           - dummy upgrade package for firefox-3.0 -> firefox-3.5
    p   firefox-3.0-dev                                                - dummy upgrade package for firefox-3.1 -> firefox-3.5
    p   firefox-3.0-dom-inspector                                      - dummy upgrade package for firefox-3.0 -> firefox-3.5
    p   firefox-3.0-gnome-support                                      - dummy upgrade package for firefox-3.0 -> firefox-3.5
    p   firefox-3.0-venkman                                            - dummy upgrade package for firefox-3.0 -> firefox-3.5
    p   firefox-3.1                                                    - dummy upgrade package for firefox-3.1 -> firefox-3.5
    p   firefox-3.1-branding                                           - dummy upgrade package for firefox-3.1 -> firefox-3.5
    .....
    

    You can see the states of the package. p denoting no trace on the system, i denoting already installed

  • Install the package
  • Since in my case, the package is already installed, there is no need to re-install it. But else, use the install option of aptitude

    $ sudo aptitude install firefox
    

apt-get for package installation

  • Search for the package
  • Use apt-cache to search for a package

    $ apt-cache search firefox
    kubuntu-firefox-installer - Firefox installer for Kubuntu
    latex-xft-fonts - Xft-compatible versions of some LaTeX fonts
    mozvoikko - Finnish spell-checker extension for Firefox
    openoffice.org - full-featured office productivity suite
    ubufox - Ubuntu Firefox specific configuration defaults and apt support
    webfav - Firefox extension for saving web favorites (bookmarks)
    adblock-plus - advertisement blocking extension for web browsers
    all-in-one-sidebar - A sidebar extension for Mozilla Firefox
    amule-gnome-support - ed2k links handling support for GNOME web browsers
    aptlinex - Web browser addon to install Debian packages with a click
    

    Unlike aptitude, you see a totally different output and also no current state of the packages (installed/not installed)

  • Install the package
  • To install the package, use the install option

    $ sudo apt-get install firefox
    

aptitude looks to be more promising than apt-get because of the detailed information

Tags: , , , , ,

Comments:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2009-2012 Joys of Programming All rights reserved.
Desk Mess Mirrored v1.8.1 theme from BuyNowShop.com.