If you're looking to get to know Linux through one of the most popular distributions, Ubuntu, then you should learn about the command line installation tool apt-get. This tool makes installing from the command line a snap. In this Basic Linux Commands series entry you will learn all you need to know
What is apt-get?
The apt-get command is often considered a front end (even though most consider a "front end" to be a graphical application) for the APT package management system. The apt-get system uses a listing of repositories that keep track of what sites are available to download packages from. Alongside this is a database of applications installed on your system. With this combination, apt-get will know what you have installed vs what is available to install. The user can also add to the repository listing so more software titles are available.
Apt-get is issued from the command line by either the root user or using sudo. Apt-get can do the following:
- install - Install applications onto your system.
- upgrade - Upgrade already installed applications.
- distribution upgrade - Upgrade to a newer distribution release.
- remove - Uninstall applications
- check - Checks for broken dependencies and updates package cache.
As mentioned before, apt-get requires root (or sudo) privileges. To use apt-get you will first need to know the application you want to install. We will use aterm as an example. To install aterm with apt-get you would issue the command apt-get install aterm. To remove aterm with apt-get you would issue the command apt-get remove aterm.
Upgrading with apt-get
One of the limitations with apt-get is that you can not upgrade a single application. Instead, there are two ways to upgrade with apt-get:
1) Do a full upgrade which will upgrade every package on your system.
2) Do a distribution upgrade.
One word of advice here. Doing a major distribution upgrade (i.e. going from Ubuntu 7.10 to 8.04) is not always the best choice. A minor distribution upgrade (i.e. going from Ubuntu 8.04 to 8.10) is generally fine. So if you are running a .10 release in Ubuntu, and you want to upgrade packages, it is best to use apt-get upgrade over apt-get dist-upgrade.
If you look in the /etc/apt/sources.list you will see a listing of the current repository sources available to your machine. You can add to this list by editing the file with a text editor (such as nano.) The entries will look somewhat like this:
deb http://host/ distribution section1 section2 section3
deb-src http://host/ distribution section1 section2 section3
If there is an application that is not found with your current repository list, you most likely will have to do a search for the application's apt repository. Sometimes a package will be found in various repositories such as the universe repository. There are a number of repositories that handle different packages. Ubuntu repositories can include:
- main - This is the major part of the distribution.
- restricted - Software not licensed under the GPL (or similar license).
- universe - Software licensed under the GPL (or similar license) and supported by users.
- multiverse - Software not licensed under the GPL (or similar license), but supported by users.
The apt-get system is a very easy command line package management tool. Using this tool alongside Synaptic will ensure your system's packages are managed as efficiently and as cleanly (and as simply) as they can be.
Simplify Linux application installation and archiving
If you are new to Linux than you might be baffled as to how to handle two important tasks: Application installation and directory archiving. Never fear, Bright Hub is hear. In this series of articles you will learn how to master the tools to help you tackle these tasks.
- Simplifying Linux Installation and Archiving
- Linux Command Line: apt-get
- Linux Command Line: urpmi
- Linux Command Line: rpm
- Linux Command Line: tar
- Linux Command Line: bzip2/bunzip2