Archlinux tools: Pacman

[ Friday, 26 October 2007, mikrobart ]


We are starting a short series of articles aiming to describe the key administration tools and packages used in Archlinux distribution. Today we are taking a closer look at Pacman — the Arch’s package manager of choice.

1. What exactly is Pacman?

Pacman is the default package manager for Arch Linux distribution. It is written for Arch Linux but its advantages were recognized also by other distribution developers (like Frugalware for example).

Pacman uses tar packages as a software source. Those packages are build to be compatible with Arch Linux Build System (ABS).

Pacman repositories do not have as many packages as repositories of the most popular distributions (like Debian, Ubuntu), but repositories are usually refreshed every day.

The main configuration file of Pacman is pacman.conf. It is located in /etc directory. This file contains e.g. repositories addresses or localization of the log file.

2. What can Pacman offer us?

Pacman basically enables us to:

  • install and remove packages
  • update packages
  • update the whole system
  • clean cache
  • display information about installed packages
  • display information about packages in a repository
  • and all this using easy to remember commands.

3. How to use Pacman?

a) Packages installation:

pacman -Sy package_name – packages installation and local packages database synchronization
pacman -S package_name – packages installation along with dependencies
pacman -Sl repository_name – display packages list of a given repository
pacman -Sv package_name – information about operation

b) Removing packages:

pacman -R package_name – removing package without dependencies
pacman -Rs package_name – removing package along with dependencies
pacman -Rn package_name – purging package

c) System update:

pacman -Su – update all the packages
pacman -Syu – update all the packages and synchronize local packages database

d) Database queries:

pacman -Ss keyword – search for all packages matching the keyword (where the keyword is a part of the package name)
pacman -Qi package_name – information about package
pacman -Ql package_name – list files that a given package consist of
pacman -Qs package_name – search files installed on hard disk

e) Other commands:

pacman -Sw package_name – download package without installation
pacman -A /file/path/file.tar – install package
pacman -Sc – clean cache (old files)
pacman -Scc – clean cache (all files)

You can learn more commands typing

man pacman

.

4. How does repository entry look like?

Repository entry consist of the repository name (in brackets ‘[]‘) and server address (after ‘Server=’), Here’s an example from /etc/pacman.conf

[repository_name]
Server = ftp://server.net/repo

After you add a new repository you should refresh repositories list using the following command:
pacman -Sy

This was just a short introductory article to get you acquainted with the basics of using Pacman. All that can be found in the user’s manual but — according to my experience — people tend to skip the manuals. I hope we encouraged you to give Pacman and Archlinux a try in general. If so, keep track of the PolishLinux RSS because there is next article about Archlinux User-Community Repository (AUR) coming soon!

Subscribe to RSS feed for this article!

10 Comments

fold this thread yoshi314  Monday, 29 October 2007 o godz. 11:59 am #  Add karma Subtract karma  +0

“pacman -Ss password – search a new password in the database”

bad translation? :>

(Comments wont nest below this level)
 
fold this thread Leonardo  Monday, 29 October 2007 o godz. 2:49 pm #  Add karma Subtract karma  +0

Yes, It should be “keyword” i think. Or package.

(Comments wont nest below this level)
fold this thread michuk  Monday, 29 October 2007 o godz. 5:55 pm #  Add karma Subtract karma  +0

Of course. Corrected. Thanks.

 
 
fold this thread me  Tuesday, 30 October 2007 o godz. 4:49 pm #  Add karma Subtract karma  +0

Is there a pacman command to search package in the repository (not installed package)? Like “apt-cache search something”

(Comments wont nest below this level)
fold this thread Phillip Smith  Wednesday, 31 October 2007 o godz. 12:30 am #  Add karma Subtract karma  +1

Yes – ‘pacman -Ss keyword’

 
 
fold this thread Phrodo_00  Tuesday, 6 November 2007 o godz. 12:38 am #  Add karma Subtract karma  +0

Nice article, however you forgot pacman’s most kickass feature: pacman -Rsc , that will delete the package, the packages that depend on it and the packages it depens on and those depend on (and so on) that aren’t required by any other package and weren’t explicitely installed.

(Comments wont nest below this level)
fold this thread michuk  Wednesday, 7 November 2007 o godz. 1:20 am #  Add karma Subtract karma  +2

…thus deleting your whole OS :)

 
 
fold this thread schiv  Friday, 9 November 2007 o godz. 12:29 pm #  Add karma Subtract karma  +1

hi pacman -A is deprecated. pacman -U takes care of that now.

There is also pacman -Rc, similar to -Rs but at the moment i can’t recall its purpose by itself, not forgetting -Rsc which is mentioned above. -Rsc won’t delete the whole OS heheh, its a handy tool to get rid of junk. To force remove there is -Rd. Anyway, i guess this is just an introduction for potential users so u don’t have to edit the article and slot in every detail.

Btw im posting to say thanks, i noticed a new option which is -Rn for purging! Damn my ignorance.

(Comments wont nest below this level)
 
fold this thread lldmer  Saturday, 4 October 2008 o godz. 1:06 am #  Add karma Subtract karma  +1

pacman -A is deprecated, should be pacman -U to install a package.

(Comments wont nest below this level)
 
fold this thread Randy  Monday, 14 June 2010 o godz. 9:19 pm #  Add karma Subtract karma  +0

I could never decide if I like apt-get or pacman better. I’m on the fence about it.

(Comments wont nest below this level)
 
Name (required)
E-mail (required - never shown publicly)
URI

Adjust field size: shrink | enlarge)


You can use simple HTML in your comments. Some examples are as follows:
  • A hyperlink: <a href="polishlinux.org">GNU/Linux for everyone!</a>,
  • Strong text: <strong>Strong text</strong>,
  • Italic text: <em>italic text</em>,
  • Strike: <strike>strike</strike>,
  • Code: <code>printf("hello world");</code>,
  • Block quote: <blockquote>Block quote</blockquote>

New AdTaily ads!

Are you a film buff?

film buffs community, movie recommendations and reviews

RSS: Comments

You can follow the comments to this article through a special channel RSS 2.0 .

Related articles: Arch

 more »

Related articles: Software managers

 more »

PolishLinux Top Content


Become our fan on Facebook!

PolishLinux.org on Facebook

Follow PolishLinux on Twitter!

Follow polishlinux on Twitter

Google Ads