Posts tagged ‘pacman’

Remove unused dependencies in Arch Linux

Archlinux-icon.png

This will list all orphans.   I find it best to review what packages it lists here first and foremost.

pacman -Qdt

This will remove them all.

pacman -Rsn $(pacman -Qdtq)

Create a List of all installed packages on Arch Linux

Archlinux-icon.png

Say you need a backup list of every package installed on  your Arch system.  This should be simple enough:

pacman -Qe > intalled_apps.txt

Lets say you’re setting up a new box, or blew away your installation and want to go back just to the way things were.  Well save this file, and once you’ve gone through the initial Arch install simply run

for x in $(cat install_apps.txt); do pacman -S $x; done

Optimize pacman and free space on Arch

Archlinux-icon.png

The pacman cache is a folder containing compressed packages that you’ve downloaded – including older versions, e.g. you’ll have somepackage.0.1.1, somepackage.0.1.2 and somepackage.0.1.3, etc   It can be very useful if something breaks and you need to revert to an earlier package.  But it also takes up a lot of space!   I was able for free up about 4GB of space on my box by doing this:

pacman -Sc   This clears outdated/uninstalled packages.

I got another 1GB freed by running

pacman -Scc   This clears the whole folder, not just the packages that are outdated/uninstalled.

Optimise the pacman database (good to do from time-to-time!)

pacman-optimize && sync

This will attempt to put all the small files together in one (physical) location on the hard disk so that the hard disk head does not have to move so much when accessing all the packages.

http://wiki.archlinux.org/index.php/Improve_Pacman_Performance

How to have Gnu Screen display number of updates for Arch linux

Archlinux-icon.png

1.   sudo vim /etc/cron.hourly/pacmansy

2.  and place this within

pacman -Sy

3.  then :wq the file and make it executable:

chmod a+x /etc/cron.hourly/pacmansy

4.   vim ~/bin/getupdates.pl

and place this within:

#!/usr/bin/perl
use strict;
use warnings;
print ((`pacman -Qu` =~ m/^[^\s]+\s\((\d+)\):/m) ? $1 : 0);

5.  vim ~/.screenrc and do this:  (relevant parts are bolded)

caption always “%{= KW}%-w%{= Gk}%n %t%{-}%+w %-=”

hardstatus alwayslastline “%{= kW} %-= %{= kC}Session:%u%{= kW} %5` | %{= kC}Host:%{= kW} %H | %1` |%{= kC} MEM:%{= kW} %2`MB /%{= kC} SW: %{= kW}%3`MB | %{= kC}Unread %{= kW}%4` | %{kC}Updates:%{kW} %7` | %m/%d %c”
#Backticks to display information in status bar
backtick 1 60 60 /home/username/bin/get_uptime
backtick 2 60 60 /home/username/bin/get_freemem
backtick 3 60 60 /home/username/bin/get_freeswap
backtick 4 60 60 /home/username/bin/get_gmail
backtick 5 60 60 /home/username/bin/get_sessionname
backtick 7 60 60 perl /home/username/bin/get_updates.pl

Now run screen and the number of updates awaiting for you in pacman should be displayed.  Enjoy.

Use pacman through iptables when all Output is dropped

Archlinux-icon.png

Assuming your iptables is set to drop all Output and only allow through what you tell it to, you will need to do a few things to ensure that pacman can still sync, update, and install packages for you.

First thing first, you need to make sure that iptables is allowing the basics (FTP, HTTP, DNS, etc)

    iptables -A OUTPUT -p tcp --dport 20 -j ACCEPT
    iptables -A OUTPUT -p tcp --dport 21 -j ACCEPT
    iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
    iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT

But even with these ports open you’ll notice you cannot do a pacman -Sy.

Simply;

modprobe ip_conntrack_ftp

and pacman should now work as usual.  To have the module loaded at boot, make sure to edit your /etc/rc.conf file and add this to the MODULES = section, and you’re all done.

6 quick steps to install apps from AUR in Arch Linux

Archlinux-icon.png
  1. Browse to http://aur.archlinux.org
  2. Search for your program’s page
  3. Download the tar.gz file containing all required files, it will be linked as “Tarball”
  4. Uncompress the tar.gz file, cd to the extracted directory and type in ‘makepkg -s’. This will also install any missing dependencies with pacman
  5. When it is finished, type in ‘pacman -U <insert name of program and version>.pkg.tar.gz
  6. Your program is installed!

Improve database access speeds in pacman on Arch

Archlinux-icon.png

Pacman stores all package information in a collection of small files, one for each package. Improving database access speeds reduces the time taken in database-related tasks, e.g. searching packages and resolving package dependencies.

The safest and easiest method is to run

pacman-optimize && sync

as root. This will attempt to put all the small files together in one (physical) location on the hard disk so that the hard disk head does not have to move so much when accessing all the packages. This method is safe, but is not for-sure. It depends on your filesystem, disk usage and empty space fragmentation.

How to manage packages using Pacman in Arch Linux

Archlinux-icon.png

Pacman is the default package manager for Arch Linux. Pacman uses tarballs (.tar) packages as a software source. Those packages are built 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, Fedoram or Suse).

Continue reading ‘How to manage packages using Pacman in Arch Linux’ »