Softpanorama

May the source be with you, but remember the KISS principle ;-)
Contents Bulletin Scripting in shell and Perl Network troubleshooting History Humor

Installing software via Apt

Installing software via Apt

I regularly sit in the #ubuntu channel on the Freenode network helping folks with Ubuntu issues. One of the things I see people often doing is attempting to install software from source before researching easier installation methods. This tutorial is focuses on using the command line to perform a set of tasks. I have written a CLI cheatsheet for those of you who feel the need to brush up on your CLI skills.

The proper steps for software installation on Ubuntu, in my opinion, are as follows:

Step 1

Search the Ubuntu software repositories (known as repos). The Ubuntu repos are huge and there's a good chance that the app you're looking for is already packaged for use in Ubuntu. It's important to note here that it's best to install software from the repos which are meant for your version of Ubuntu. Mixing release packages (using Jaunty repos in Karmic) or distros (using debian repos in Ubuntu) can cause problems on your system, so stick with the proper repos. If you're unsure as to which version of Ubuntu you are using, run lsb_release -a in a terminal.

You can search the Ubuntu repos with the following commands (package "foo" is used here as an example):
apt-cache search foo - Find packages that include "foo" in the package filename or description
apt-cache search -n foo - Find packages that include "foo" in the package filename

Example 1: You are looking for an irc client but you don't know of any apps which can perform the required task, you would type the following:
 

apt-cache search irc | grep client

This command tells the system to search the repos for all packages which have "irc" in the description or package filename and filter that search for packages which also have "client" in the description or package filename. Piping the apt-cache command to grep narrows the search down more thanthat which would have resulted in apt-cache search irc.

Example 2: You are looking for the Xchat IRC client, you would type the following:
 

apt-cache search -n xchat

This command tells the system to search the repos for all packages filenames that contain "xchat".

Once you think you have found the proper package, you can do a bit of investigation with these commands:

apt-cache show xchat - Show information about package xchat
apt-cache depends xchat - Show the dependencies of package xchat
dpkg -L package xchat - List all files in package xchat

Once you have found the proper package, you can install it with the command:
 

sudo apt-get install xchat


Installing software from the repos has many benefits. The three biggest benefits are that a) the software is easy to install and remove, b) the system will resolve dependencies for you and c) the system will keep the software up-to-date for you.

Step 2
If you're unable to find your desired software after searching the repos, you can try to find a PPA (Personal Package Archive) from which to install the desired software. Personal Package Archives are a type of software repository which are provided by other users to distribute pre-packaged software for Ubuntu. You can search for a PPA here. Most PPA's will include instructions on how to add that PPA to your Ubuntu sources, update your sources and install the desired packages.

Installing software from a PPA has the same benefits as installing software from the official Ubuntu repos.

Step 3
If you're unable to find your desired software after using the above methods, you can try and find a .deb package that was built specifically for Ubuntu. Keep in mind that other distros also uses .deb packages but dependency and other issues come into play when attempting to use a .deb package which wasn't built specifically for Ubuntu. It's also a bad idea to convert a .rpm package into a .deb package and install the software that way. Some folks will tell you that using a Debian .deb package or converting a .rpm package are acceptable methods of installing software in Ubuntu, but these methods are neither recommended nor supported.

There many ways to find a .deb package which is compatible with the Ubuntu system. One way is to use websites such as GetDeb or Gnome Files to search for your desired software. Another way is to use a Linux-specific search engine such as Google Linux to aid your search.

One of the drawbacks to installing from a .deb package is that you may be required resolve dependencies yourself. This can be a rather large job because some dependencies may have dependencies of their own - this is known as "dependency hell" and is a place no user wants to be. Another drawback is that the system will not keep the software up-to-date for you, as it will in installing from the repos, so you're left to update the software manually.

Step 4
The chances of having to compile software from sources are slim these days thanks to the Ubuntu repos, PPA's and the good folks who package .deb files. However, if you've come this far and are still unable to install the desired software, you can attempt to compile and install the software from source. I have been using Linux since 2001 and Ubuntu since 2005 and I don't bother compiling software anymore. Call me lazy if you wish, but if I end up at this step and still don't have the desired software installed, I simply look for another app to do the job - one that is either in the repos or can be installed via a PPA or .deb package. If you have arrived at this step and still wish to continue, my advice is to unpack the sources and read any included instructions, these files are often included as README or INSTALL files. The good news is that you can launch your favorite IRC client and visit the #ubuntu channel on the Freenode network where there are users just like you who spend their time helping folks solve problems.

Using a computer should be fun and easy, so it's best to begin with the least stressful steps to get the job done.

 
Posted by Ian MacGregor
Tags: Software, Tutorial, Ubuntu  

6 comments:

tracyanne said...
Ian this would be even better if you were a little more in depth, and you provided information about the GUI tools for searching the repositories.

Also what happens if the person doesn't know the names of the application they want, only it's type?

Both of these are issues that I come across regularly.
Mr. Maddog said...
It's not even worth compiling tarballs anymore. It made sense in the old days when it was just CLI programs, but now there's so many dependencies you have to have already installed. Not just the library packages but the 'source code' for them as well. It's way easier to use Software Center, Synatic or even apt-get. Maybe some people think they're 'leet using only UNIX commands...
Ian MacGregor said...
Mr. Maddog, I totally agree.
Nox said...
How safe is it to use PPA @ https://launchpad.net/ubuntu/+ppas ?
Ian MacGregor said...
tracyanne, Thank you for the reply, I'll add some extra commands to this tutorial. However, the GUI vs CLI debate boils down to the tool being used and personal preference. I can understand people using a GUI web browser over a CLI web browser because they get a better web experience. But, searching for and installing an app just doesn't justify the extra overhead and potential bugs that accompany a GUI tool in my opinion. I can find an app in the terminal faster than the time it takes for synaptic to authenticate, launch be ready to use. What happens if xorg breaks? What if the system is frozen and the only thing it will allow you to do is ctrl+alt+f1? What if the system you're using is a server? What good is a GUI going to be in these cases? I feel that users should learn their way around the command line now so they aren't stuck when the time comes for them to need these skills.
Ian MacGregor said...
Nox, I've not heard anything negative about them and I've been sitting in the main Ubuntu help channel for years. These PPA's are recommended by Ubuntu developers so I am assuming they are safe to use.

Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[Jun 28, 2017] AptGet-Howto - Community Help Wiki

Notable quotes:
"... /etc/apt/sources.list ..."
"... /etc/apt/preferences ..."
"... /etc/apt/preferences ..."
"... /var/cache/apt/archives ..."
"... /var/cache/apt/archives ..."
"... not ..."
"... /etc/apt/apt.conf ..."
Jun 28, 2017 | help.ubuntu.com

The apt tool on Ubuntu 14.04 and above makes this very easy to list installed packages apt list --installed

All these commands except the search commands must be run as root or with superuser privileges, see sudo for more information.

Installation commands auto-apt

Maintenance commands

Removal commands

Search commands

For more information on apt-get, apt-cache and dpkg consult their manual pages by using the man command. These manuals will provide a wider scope of information in addition to all of the options that you can use with each program.

Typical usage example

I want to feel the wind in my hair, I want the adrenaline of speed. So let's install a racing game. But what racing games are available?

apt-cache search racing game

It gives me a lot of answers. I see a game named "torcs". Let's get some more information on this game.

apt-cache show torcs

Hmmm... it seems interesting. But is this game not already installed on my computer? And what is the available version? Which repository is it from (Universe or Main)?

apt-cache policy torcs

Ok, so now, let's install it!

apt-get install torcs

What is the command I must type in the console to launch this game? In this example, it's straightforward ("torcs"), but that's not always the case. One way of finding the name of the binary is to look at what files the package has installed in "/usr/bin". For games, the binary will be in "/usr/games". For administrative programs, it's in "/usr/sbin".

dpkg -L torcs | grep /usr/games/

The first part of the command display all files installed by the package "torcs" (try it). With the second part, we ask to only display lines containing "/usr/games/".

Hmmm, that game is cool. Maybe there are some extra tracks?

apt-cache search torcs

But I'm running out of space. I will delete the apt cache!

apt-get clean

Oh no, my mother asked me to remove all games from this computer. But I want to keep the configuration files so I can simply re-install it later.

apt-get remove torcs

If I want to also remove config files :

apt-get purge torcs

Setting up apt-get to use a http-proxy

These are three methods of using apt-get with a http-proxy.

Temporary proxy session

This is a temporary method that you can manually use each time you want to use apt-get through a http-proxy. This method is useful if you only want to temporarily use a http-proxy.

Enter this line in the terminal prior to using apt-get (substitute your details for yourproxyaddress and proxyport).

export http_proxy=http://yourproxyaddress:proxyport

If you normally use sudo to run apt-get you will need to login as root first for this to work unless you also add some explicit environment settings to /etc/sudoers, e.g.

Defaults env_keep = "http_proxy https_proxy ftp_proxy"

APT configuration file method

This method uses the apt.conf file which is found in your /etc/apt/ directory. This method is useful if you only want apt-get (and not other applications) to use a http-proxy permanently.

IconsPage/info.png On some installations there will be no apt-conf file set up. This procedure will either edit an existing apt-conf file or create a new apt-conf file.

gksudo gedit /etc/apt/apt.conf

Add this line to your /etc/apt/apt.conf file (substitute your details for yourproxyaddress and proxyport).

Acquire::http::Proxy "http://yourproxyaddress:proxyport";

Save the apt.conf file.

BASH rc method

This method adds a two lines to your .bashrc file in your $HOME directory. This method is useful if you would like apt-get and other applications for instance wget, to use a http-proxy.

gedit ~/.bashrc

Add these lines to the bottom of your ~/.bashrc file (substitute your details for yourproxyaddress and proxyport)

http_proxy=http://yourproxyaddress:proxyport
export http_proxy

Save the file. Close your terminal window and then open another terminal window or source the ~/.bashrc file:

source ~/.bashrc

Test your proxy with sudo apt-get update and whatever networking tool you desire. You can use firestarter or conky to see active connections.

If you make a mistake and go back to edit the file again, you can close the terminal and reopen it or you can source ~/.bashrc as shown above.

source ~/.bashrc

How to login a proxy user

If you need to login to the Proxy server this can be achieved in most cases by using the following layout in specifying the proxy address in http-proxy. (substitute your details for username, password, yourproxyaddress and proxyport)

http_proxy=http://username:password@yourproxyaddress:proxyport

Recommended Links

Softpanorama hot topic of the month

Softpanorama Recommended

...



Etc

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit exclusivly for research and educational purposes.   If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner. 

ABUSE: IPs or network segments from which we detect a stream of probes might be blocked for no less then 90 days. Multiple types of probes increase this period.  

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Haterís Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least


Copyright © 1996-2016 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License.

The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: August, 07, 2017