Raspberry pi course - Managing software packages

Adding software to your Raspberry Pi can be achieved in two ways.  You can use the command line tool apt-get or you can use a graphical interface to select what needs to be installed.  The apt tool or Advanced Packaging Tool is great because it provides a quick and easy way to add, remove and update programs.  Enter the following command to install a program called wget.  This program is used to download files from the internet using the command line.

$ sudo apt-get install wget

Enter the root password and confirm that you want to install the program.  After a few minutes the program will display its progress and where it is downloading the program from.   If wget is already installed your will receive the following message.

                wget is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 238 not upgraded.

Confirm that wget is installed by entering

$ wget

If everything has been installed correctly, you will be presented with the version information for wget.

                wget: missing URL

                Usage: wget [OPTION]… [URL]…

                Try `wget –help’ for more options.

You can also install multiple packages at once using the following

$ sudo apt-get install wget vsftp

If you are not sure of the program that you want to install you can always use the apt-cache utility to search for a program.  The apt-cache utility is specifically designed for searching the software package cache.  The software package cache contains a list of existing software that is available for the Raspberry Pi.  Enter the following command.

$ sudo apt-cache search wget

Apt will return a list of matches related to wget.

The list of software packages needs to be kept up to date by comparing packages on your system with a remote database of updates, newly added packages and out of date packages.  The following command is used to resynchronise the package index file.

$ sudo apt-get update

Enter the root password and the Raspberry Pi will obtain a list of package updates.   These updates come from a number of sources online which are listed in the following file.

/etc/apt/sources.list

Enter the following to take a look at this file.

$ cat /etc/apt/sources.list

In this file you can see references to ftp and http locations which are used to obtain the software.

Deleting a package follows a similar process to the installation procedure.  Simply enter

$ sudo apt-get remove wget

In this example the wget package is being removed but you can remove any package by entering its name.

 

Raspberry pi course - System updates

Next Raspberry Pi Keeping the system up to date – Week 5  Day 3.0 >>