Raspberry Pi - Managing Software



We have discussed the simple menu based ADD/REMOVE software tab under Preferences for installing software. It is one of the easiest ways to manage and install software on your Raspberry Pi.

But here, we will be discussing how we can use the command line to install software in Raspberry Pi.

To install software, we require the authority of the root user or superuser but, sometimes that leaves our Raspberry Pi computer files vulnerable, including to any malicious software that might get in.

We can use sudo instead of a root account. Putting sudo before a command will indicate that one wants to carry it with the authority of the root user.

Update Cache Memory

If you want to install software on your Raspberry Pi, you first need to update the cache memory. It is the list of the packages, which the package manager knows about.

Use the following command to update the cache memory −

sudo apt-get update

Find the Software

To find the package name or software, we need to use the package manager cache. In Linux terminology it is the apt, cache.

It contains an index of all the packages available for install. It collects information of the software package and, also used to search for the available packages which are ready for installation on Raspberry Pi.

With the help of following command, we can search the required software −

sudo apt-cache search pkgname

Suppose if you want to search the games packages, you can use the command as follows −

sudo apt-cache search game | less

The list might be long. Hence, we have used less.

And suppose, if you want to find the package name for a particular game say chess, you can give the title in the command as follows −

sudo apt-cache search chess

This command will search for all the packages with name chess.

Install Software

Once you finish the searching, you can now install the software. For searching, you used apt-cache. However, for installing, you need to use apt-get command.

The command will download the specific package from the internet and install it. It will also install other dependencies.

For example, if we want to install the chess game say 3dchess, then the command will be as follows −

sudo apt-get install 3dchess

Run the Software

Following are the two ways to run a particular program in Raspberry Pi −

From command line

You can run some programs directly from the command line. You need to type the name of the program as follows −

3dchess

It will directly run the program.

From Application menu

Another way is to use the Application menu. After installing, you can find the application in the Application menu.

In Raspberry Pi, most of the end-user applications require the X-server. It means they need the Desktop environment to run them.

Upgrade Software

You can use the package manager to keep your software.

Following is the command with the help of which we can update all our software −

sudo apt-get upgrade

On the other hand, if you want to update just one application, you can do it by issuing its install command again.

For example, we have installed the chess game above, now enter the same again −

sudo apt-get install 3dchess

The above command will prompt the apt to check for any updates of the package and install them. If it finds no updates, it will tell us that we are running the latest version of the software.

Remove Software

You can also use the package manager to remove software from your Raspberry Pi computer.

You can use the following command to remove the software −

sudo apt-get remove 3dchess

The above command will remove the 3dchess package, but it will leave some traces of the application. These traces might include user files and any files containing settings.

You can also completely remove the application by using the following command −

sudo apt-get purge 3dchess

What software is installed?

You can use the following command to find out what software is installed on your Raspberry Pi computer −

dpkg --list

With the help of following command, you can search for a specific package −

dpkg –-status packagename
Advertisements