How to Install and Remove Software In Ubuntu Linux

How to Install and Remove Software In Ubuntu Linux

A major functionality of any operating system is the ability to expand it – to add in new software over time to improve your work flow or just for entertainment value. Linux, being an open source operating system provides thousands of software titles to meet just about every need. But after tracking down the ideal software title, there’s just one barrier to overcome: actually installing it on your system. In our earlier articles, we showed a way for users to keep Ubuntu system clean. In this article, we will share with you a way by which you can install softwares in Ubuntu Linux and can remove unwanted software as well.

Installing software under Ubuntu Linux isn’t the same as with Windows. Users are empowered over what happens to their system, but this comes at the expense of a little time to understand the terminology and techniques.

Installing programs on Windows is relatively easy. For example, anyone willing to use the VLC media player can browse to the web site, download the .exe file, and install the software. Although the user might not realize it, a lot of work goes into making this seemingly simple task possible. Once the original software has been created by the programmers, it must be made into a form that we, the end-user, can use.

As Ubuntu is based on Debian project the package-management system used under Ubuntu is also borrowed from the Debian Project. Most people refer to it simply as the Debian package- management system. In order to install a software Ubuntu relies on packages. The Ubuntu CD contains hundreds of them, as shown in following Figure.

Understanding what a package actually is and what it contains is of vital importance. With Windows, an installation .exe file is effectively a piece of software combined with an archive of files. After running the executable, it triggers a small program within the executable that then unpacks the contents of the file and installs them to the hard disk.

This is not a case with Ubuntu Debian packages (.deb files) which merely contain the program files, along with a handful of configuration files to ensure the software is both installed and set up correctly. Debian package files are useless without the various pieces of software that are used to manipulate them and that constitute the Debian package-management system. This approach has a number of benefits. The package-management software builds its own database, so it knows exactly which programs are installed at any particular time. It also keeps tracks of version numbers. As a result users get much more control over the software on their system. It also means that if a program starts to act strangely, its configuration files can simply be refreshed using the package manager. Ultimately the need to uninstall and then reinstall the software vanishes, which is not the case with Windows programs.

Dependency Management

In addition to actually installing programs, a vital component of package-management software is taking care of dependencies. Altogether, the package manager must ensure that if you install a piece of software, any software it relies on to work properly is either already present on the system or is installed at the same time. Sometimes, the software you want to install might rely on other programs on your system, but more often, the dependencies take the form of system libraries. It helps if you realize that not all packages contain software that you, as a user, will use directly. Some packages contain nothing but library files, which are shared pieces of code that are equivalent to .dll files under Windows. The key library on an Ubuntu system is the GNU C Library, without which the Linux kernel couldn’t function, and this is provided by the libc6 package. But practically every program has its own needs when it comes to library files, and these requirements must be handled by the package manager.

Note: One reason why Windows installation files are often so large is that they typically come with all the system files they need in case those files are not already present on the system. Windows isn’t alone in this regard; installation files for the Apple Macintosh are similar.

Dependency management, sometimes referred to as dependency resolution is a key feature of, the Debian package-management system. You might already have seen this in action: when you mark a program for installation in the Synaptic Package Manager, you may be informed that additional packages need to be installed. If you refuse this request, the program will be deselected. The package manager simply won’t letyou install a piece of software unless you let it take care of the dependencies. There’s no point in letting you install the software because it probably won’t work. But dependency management doesn’t just mean adding in packages that a piece of software needs. It might also mean removing packages already present on your system. This might happen if other packages are incompatible with the software you want to install, something that’s referred to as package conflict resolution. In addition, sometimes you might want to remove a package that other packages rely on, a situation known as reverse dependency. In such a case, the package manager either prevents you from removing that software or removes the reverse-dependency packages, too.

Note: You can see what dependencies a package has by right-clicking its entry in the Synaptic Package Manager, clicking Properties, and then clicking the Dependencies tab.

Open the program (System -> Administration -> Synaptic Package Manager), click Settings Repositories on the menu, and then take a look at what appears. The headings in the list are the repositories that you can access. Any with a check alongside them are those that APT, and therefore the Synaptic Package Manager, use. Those without a check are ignored. Underneath each repository heading are the sections on that server that you can access.

Searching for Software on Ubuntu Linux

Before searching for software, it’s nearly always a good idea to refresh the package databases. Just click the Reload button on the Synaptic Package Manager toolbar to grab the latest package lists from the various repositories that are in your sources.list file. Reloading can take a few minutes on a slow connection, but it ensures that you have access to the latest software within the repositories. To search for software, you can click any entry in the list of packages and simply start typing. This will match what you type against the package names in the list. Alternatively, you can click the Search button the toolbar. By default, this searches through both package names and the descriptions, for a higher chance of a match. You can either type the specific program name or a keyword that may be within the description. For example, if you were looking for graphics drivers for your ATI Radeon card, but you didn’t know the name of the package that contains them, you could type radeon.

Installing Software on Ubuntu Linux

When you click the check box next to a piece of software in the search results and select Mark for Installation, you’ll be informed of any uninstalled dependencies that the program needs and asked to confirm their addition to the list of packages to be installed. If you right-click the file and selecting Mark Suggested for Installation or Mark Recommended for Installation, you’ll see a list of programs that, although not essential to the running of the program in question, will enhance its features to some degree. For example, if you choose to install the mutt e-mail program, it’s also recommended that you install locales and mime-support, so Mutt will have multiple language support and will be able to better handle file attachments. You don’t have to install these recommended programs; the software will run fine without them. But it can often be rewarding if you do so. After you’ve made your selection of software (bear in mind that you can install more than one piece of software at once), click the Apply button on the toolbar.

Here, you’re once again asked to confirm what needs to be installed. If any software needs to be removed in order to meet dependency issues, you’ll be told about this, too. Additionally, you’ll be shown the total size of the files that will be downloaded, as well as the anticipated impact on your hard disk in terms of size after the programs are installed. At the very bottom of the Summary dialogue box, you’ll see a check box marked Download Package Files Only. As it suggests, this will download but not install the packages. If you then select the package for installation again in the future, you won’t need to download it, and installation will be instantaneous (unless a newer version of the package has been released; in which case, the newer version will be downloaded and installed).

Synaptic Package Manager

Removing Software on Ubuntu Linux

To remove a piece of software, search for it by name, then click the check box alongside it, and then select Mark for Removal. This will remove the software but leave behind any configuration files it created. This means you can install it again in the future, and it will function as it did before removal. However, you can also select Mark for Complete Removal, which will remove the configuration files. As with installing software, the Synaptic Package Manager will attempt to manage dependencies when you remove software, but in this case, it will enforce the removal of any software that explicitly relies on that software. This isn’t an issue most of the time, but unfortunately, some packages have major reverse dependencies. For example, if you decide that you’ve had enough of the Base database program and want to remove it, you’ll find that you’ll also need to remove the entire OpenOffice.org suite, as well as the ubuntu-desktop meta package. Sometimes, packages have what seem like weird dependencies. For example, if you try to remove the Firefox web browser, you’ll see that you need to remove the seemingly unrelated gnome-app-install package, as well as yelp, the GNOME online help system. The reason for this is that both these packages use a part of Firefox in some way and simply can’t function without it. There isn’t a hard-and-fast solution for situations like this. However, often, you might simply choose to not remove the software and leave it on your system.

Package Management from the Command Prompt:

Synaptic is one of the best examples of package-management programs around, and there’s little reason to shun it and choose to install packages from the command line. However, you may find occasions to use dpkg or the APT tools. For example, if you’re already working at the command line, then this method is quicker than starting up the Synaptic Package Manager.

Using dpkg
The most basic package-manipulation command is dpkg. dpkg allows you to perform a lot of package-related tasks, such as build packages from scratch. Here, we’ll look at just simple package installation, removal, and query functions.

Note: dpkg requires superuser powers to install or remove software, so must be preceded with sudo. But it can be run without superuser powers if you simply wish to query the package database. The same is true of the APT tools.

Installing Packages
dpkg is useful when you’ve already downloaded a specific.deb package and would like to install it. Here is the command:

sudo dpkg -i packagename.i386.deb

You must specify the entire filename, rather than just the name of the program. dpkg is quick and dirty, and although it will warn you about any dependency issues, it will still go ahead and install the package. After installation, it will run the package’s configuration scripts. But if there are missing dependencies, it won’t be able to configure the program to work on your system, because it probably won’t be in a usable state.

If this situation arises, it’s up to you to install the dependencies that dpkg lists. Of course, some of these will have their own dependencies, which will also need to be installed. This cascade situation is informally known as dependency hell and is the main reason why the APT system was invented. As you’ll see in the next section, APT effortlessly handles dependency issues like this. If the dependencies aren’t met after a dpkg installation, whenever you run the Synaptic Package Manager or attempt to use the APT tools, you’ll be told of “broken” packages or unmet dependencies. APT will refuse to install any other software until the problem is fixed.

Tip: Within the Synaptic Package Manager, you can click the Custom button at the bottom left and then click the Broken entry in the filter list in order to see any packages that have unmet dependencies. To repair the damage, click the check box of the package in question and then click Mark of Re-installation. At the console, you can type sudo apt-get -f install. This will install all the missing dependencies on the system.

Uninstalling Packages
To remove a package, type the following:

sudo dpkg -r packagename

Note that you simply need to type the name of the program, without its version number or the .i386.deb file extensions. In this case, dpkg is slightly better behaved than when installing software. If there any reverse dependencies (other packages that depend on the one you’re trying to remove), you’ll be stopped in your tracks with a couple of error messages. You’ll need to resolve the reverse dependencies first but, of course, they might also have their own reverse dependencies.

Using the APT Tools:
dpkg is the only option if you want to install a package file you’ve just downloaded. However, if you wish to use software repositories, you’ll need to use the APT tools. These still use dpkg in the background to install and remove packages, but they also feature intelligence to handle dependency management.

Installing and Removing Packages:
The most basic APT command is apt-get. You can use this command to install or remove packages contained within the repositories as follows:

sudo apt-get install packagename
sudo apt-get remove packagename

You should specify the program name without the version number. To install the links web browser, for example, you just need to type the following command:

sudo apt-get install links

Note: You can specify two or more programs to be installed and/or removed at the same time. Just separate the package names with a space: apt-get install package1 package2 package3, and so on.

Updating the System

apt-get can also perform various types of system updates. To update all the packages on your system to the latest versions contained within the repositories, type the following:

sudo apt-get upgrade

This is the command-line equivalent of using the Software Updates function of the Ubuntu desktop. To upgrade the system to the latest version of Ubuntu, if there is one, type this:

sudo apt-get dist-upgrade

Perhaps it goes without saying that updating your system can take a long time, depending on the number and size of files to be downloaded. In addition, each package will need to configure itself during installation, and this can also take a long time.

We hoped that you enjoyed this long and resourceful article. If you like it please retweet, and share it with your friends on Facebook.


Join Our Email Newsletter

Like what you read here in this blog post? Get free blog updates in your Email!

About Rajesh Namase

Rajesh Namase is a professional blogger and founder of TechLila. He has a great passion in blogging and SEO. If you’d like to connect with him, use our Contact Us page.

Rajesh has written 221 awesome articles for us at TechLila.

Comments

  1. Hkr says

    Thanks. But I don’t understand very much. Here’s my problem :
    • I used Ubuntu before and I could download stuff from the Installer in Applications menu with Internet . Now I switched to Windows XP (I’m learning, so I can’t obviously use Ubuntu for everything). Now I passed Ubuntu to my friend and he installed it in his system. But unfortunately, he has no internet. So I guess he can’t install anything from Install menu. But he needs some codecs for music and movies. So can I download a .deb installer package with Windows and copy it to his system via USB. If so how ?

  2. Bhadraka Mahmad says

    i am trying to install software bu usb but there is some error occurring while installation so i don’t know how to install software by usb or flash drive

 Comment Policy

Your words are your own, so be nice and helpful if you can. Please, only use your REAL NAME, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please. You can wrap code in [lang-name][/lang-name] tags.


Tell us what you're thinking...

If you want a picture to show with your comment, then get Gravatar!

CommentLuv badge