How to install packages

How to use the apt-get command to install packages

The apt-get command is used within LXterminal to install software on the Raspberry Pi. Apt-get is also used to update and remove the Raspbian software which is also know as packages. I will go through the steps to install and remove a package using Raspbian.

This will also work if your are using any Debian based operating system such as Wheezy.

 

lx-terminal To load the terminal either select the LXterminal icon in the bottom left corner of the Desktop or from the Accessories menu.

 

For this example we will install the game Frozen Bubble. A colour based Puzzle game similar to the arcade game Bust-a-Moves or Puzzles Bubble

The apt-get command needs to know what the latest packages available are. This is done with the command sudo apt-get update.

The sudo command give you temporary permissions to use the apt command. Without this you would not have permission to make any changes.

apt-get update command

 

 Various information will be displayed while it updates. Once it has finished type in sudo apt-get install frozen-bubble

apt-get install command

 Often at this stage you will get some information about what is going to be installed and do you want to continue Y/N

If this happens enter Y. In this case I was not asked.

apt-get install comand 2

That's it, Frozen Bubble is installed and now in the main menu under Games

apt-get add to menu

Now you can start playing

frozen-bubble game

 

When a packages is installed other software packages may get installed that you have not selected as they are required for your package to work.

Sometimes though your program will not work when you run it. If you run the program in LXterminal you will get a message saying why the program did not run. You can then look into what additional packages you need to install to get the program working or search the internet for further help.

 

How to Un-install a package

To un-install Frozen-bubble use the remove command.

sudo apt-get remove frozen-bubble

 

Search for Packages

If you are not sure what the name of the program you want is you can do a search which will list all the packages with the word you enter. You can then see what the correct name is to install the package.

So I want to install that game again, you know colour bubble or whatever it is called. I know bubble is in the name so I enter the command

sudo apt-cache search bubble

Note: if you haven't done an update recently then use  sudo apt-get update before you search.

 apt-cache search command

You will see a list of all packages with matching results including Frozen-Bubble

 

Clean up

If you install and remove lots of packages then it is a good idea to do an occasional clean up to make sure no unwanted files are left behind.

Use sudo apt-get autoclean

 

Check what Packages are installed

To get a list of the software packages that are already installed on Raspbian enter the command dpkg --get-selections

If you just want to find out if a package is installed already use dpkg --get-selections | grep packagename
if you are unsure of the name you can enter any text after grep, all results containg that word will be shown.

Google

Leave a comment

Comments for Guest and account owners. Account owners will need to login to use registered e-mail address.

6 comments

  • Comment Link Roboberry Saturday, 10 February 2018 17:01 posted by Roboberry

    Hi Alan, the best way to install packages is the sudo apt-get install packagename method. How you run it depends what you have installed. If it is a desktop program then it will be in your desktop menu. You can enter the programs name in the terminal window to start it. some programs will install programs with different names so you will need to know what those names are to run them. If you use the www weblink if there is one or do a online search. Can you give an example of what you have installed but are unable to run?

    Report
  • Comment Link Alan Saturday, 10 February 2018 11:28 posted by Alan

    I've downloaded several packages by different methods, searching tells me that they are there but how do I find out where they are and how to run them?

    Report
  • Comment Link osh Wednesday, 03 January 2018 13:56 posted by osh

    after uninstalling it might be a good idea to use

    sudo apt-get autoremove

    to get rid of any unneeded files, thus freeing up disk space.

    Report
  • Comment Link Graeme Monday, 04 September 2017 20:01 posted by Graeme

    Hi Kcha
    It seems krita is missing from the list!
    if you enter the command sudo apt-cache search krita is will get a list of all packages with krita in the name. You will want to install krita instead of krita-data as the data files should get installed with the main program.
    try sudo apt-get install krita.
    you will also want to do sudo apt-get update first to get the latest list

    Report
  • Comment Link kcha Sunday, 03 September 2017 07:45 posted by kcha

    i downloaded the package for krita. how do i install it? sudo apt-get install krita-data didnt't work. i have raspbian stretch

    Report
  • Comment Link Gary Monday, 26 October 2015 23:56 posted by Gary

    Will some one please send a step by step manual on the set up of Claws to send and receive email
    I know nothing on how this is done

    Report

Additional information