Sunday, February 19, 2012

Make your own local repo for Arch Linux

Every one Arch user has built a package from AUR at least once. It is very useful to have some (unofficial!) packages locally, instead of building them and throw the binary away after installing it. This is the way I'm doing with my Broadcom B4312 wireless drivers. I keep the binary package safe, so I am able to install it right away after reinstall my Arch system. Yes, I reinstall my system very often, because I tried some other ditro too - Ubuntu, Fedora, Opensuse etc.
Having all such packages, like drivers and/or some extra packages from AUR in one place is very useful.  Here is how.

First, move all prebuild packages into one directory.
Then, create a repository structure:

repo-add /path/to/repo.db.tar.gz /path/to/*.pkg.tar.xz

/path/to/ is a directory where you moved your packages
and repo.tar.gz is mandatory - this is repo structure itself and is created / updated every time you execute the command above; the repo name is the name of your new repository, in my case this is always ame - the repository for my AmeOS.
That's all, your shiny new repo is ready to use.

Next, add your repo to your pacman.conf - just open for editing the file /etc/pacman.conf with root privileges

sudo gedit /etc/pacman.conf or sudo kwrite /etc/packman.conf or whatever text editor you use.
I personally like nano.

Add the following next to testing section:
Server = file:///path/to

where repo is the name of your repo, and /path/to is path where your repos is.
Save and sync your repos just to make sure everything is ok

# pacman -Sy

If everything is ok, you should read your newly created repo is synced successfully.
If you wish to add another package to the repo, just use the command

repo-add /path/to/repo.db.tar.gz /path/to/new-package.pkg.tar.xz

And in case you want to remove a package, the command is:

repo-remove /path/to/repo.db.tar.gz some-old-package

The removed package itself is remains into directory and should be removed manually.

No comments:

Post a Comment