Penguins Unbound
User:goeko > Package(Software) Management

Package(Software) Management

Page last modified 14:02, 26 Apr 2012 by goeko


    There are several commands that help manage packages (Software) on an Debian based distribution as Ubuntu.

    The main tools is apt-get, which you can use to keep your system up to date. But you can also use

    synaptic - a gui based

    aptitude - a curses based tool

    apt-cache - a command line tool to search the list of packages

    dselect - another curses based tool ( not installed on currrent Ubuntu systems 20110321)

    How to update your system

    Most commnly you would use apt from the command line to update software on your system.

    sudo apt-get update; sudo apt-get upgrade


    How to do a release upgrade from the command line

    To upgrade a system from say 10.10 to 11.04 at the command line you just need to

    sudo do-release-upgrade

    and then follow the prompts.

    I believe you can do this on most releases of Ubuntu, but I am not sure. I was upgrading from from 10.04 to 10.10.

    Here is a link to the instructions I used (They list some other steps you might need to do)

    How to search for packages

    You can search for applications in apt with

    sudo apt-cache search {name-of-what-you-are-looking-for-here}

    Often I will pipe the output from apt-cache to a grep to search for something else.

    ie looking for the php mysql module

    systemprompt$ sudo apt-cache search mysql | grep php
    htcheck-php - Simple php interface to database generated by ht://Check
    libphp-adodb - The ADOdb database abstraction layer for PHP
    php-db - PHP PEAR Database Abstraction Layer
    php-mdb2-driver-mysql - PHP PEAR module to provide a MySQL driver for MDB2
    php5-adodb - Extension optimising the ADOdb database abstraction library
    phpbb3 - A fully featured and skinnable flat (non-threaded) webforum
    phpmyadmin - MySQL web administration tool
    php5-mysql - MySQL module for php5
    php5-sqlite - SQLite module for php5


    Check to see what is installed

    To check what is installed you can use dpkg.

    dpkg --get-selections

    You can of course pipe that output throught grep (as in the above example) to look for a keyword.

    Link discussing this


    How to hold a package back

    You on occasion you may want to keep a package from getting updated, you can use this command to keep it from being updated.

    sudo aptitude hold {package}

    You will need to know the package name, you can use the search command(s) above to find that.

    Link discussing the hold command


    How to ReInstall a package

    I had an issue with my kernel, it evaporated... not sure how or why. I was able to boot off an Ubuntu 11.04 server disk and select the "recovery mode" and then re-install the kernel package (after using "dpkg --get-selection | grep linux" to get the list of kernels that were installed). Then I re-installed the kernel package with

    sudo apt-get install --reinstall {package}

    This is the link I got the reinstall info

    How to create packages

    I have not done this, but I found this link talks about the basics of how to create packages.

    Using a Cdrom with Apt

    To add a cdrom into the list of sources that Apt will use to update your system you can add the cdrom

    sudo apt-cdrom add


    Purging Dselect changes

    Not sure this still works or matters. These are old notes of mine for debian, which for a while used dselect for most package management.


    I selected some packages, then I changed my mind, but I had already exited dselect, it had saved my changes. This is what I did to get rid of dselects "memory."

    So when all else fails, edit the file!

    In /var/lib/

    A selected package has the status line of
    Status: install ok not-installed

    And an unselected package has the state of

    Status: purge ok not-installed

    So I just need to changed "install" to "purge" on the packages I didn't want installed, and that seemed to work.

    I could of avoided this if I had exited dselect with a 'X', which dumps the changes you have made.


    Replicating Installed Packages to a Differnet System

    <ubottu> To replicate your packages selection on another machine (or restore it if re-installing), you can type

    aptitude --display-format '%p' search '?installed!?automatic' > ~/my-packages

    move the file "my-packages" to the other machine, and there type

    sudo xargs aptitude --schedule-only install < my-packages ; sudo aptitude install

    ( See also !automate)

    If you don't have aptitude installed, there's a slightly less "intelligent" method using

    dpkg --get-selections


    dpkg --set-selections 

    will do the trick.

    (From Tony Yarusso)


    Beyond Brut Force Remove a package

    Okay, I TRIED to install a packaged, oracle-java7-installer, but it failed.  The package could not download a file that it needed.  And it wasn't going to EVER be able to get that package.  So everytime I updated packages the system would attempt to install the package, but of course it would fail!

    Alright, just remove the package, right ? nope. The attempt to remove the package would first try and finish the install.

    Okay purge the package... nope same thing, it will try again to install the package before removing it.



    I found this article

    that showed how to delete a problem package.


    First delete the install files

    rm -rf /var/lib/dpkg/info/oracle-java7-installer.*

    So in my case I am deleting the package 'oracle-java7-installer' so I delete all files that started with the package name. Be sure to get the correct package name!



     sudo dpkg --force-all -P oracle-java7-installer


    Whoo-hoo! happy as a clam, no more oracle java 7 package errors!

    Powered by MindTouch Core