September 22, 2006
Creating a Local Repository in Vector Linux
I recently upgraded my aging, but much-loved laptop the other day from Vector Linux 5.0 SOHO
to Vector 5.1.1 SOHO. I'll try to post a review later, but the short version is: "slick, fast, better, more features".
I often like to compile my own software even when binaries are available (sometimes you can't find binaries). Sometimes options are missing, sometimes they just don't work, sometimes...well you know the reasons. The problem was that with Vector Linux I could not figure out how to use slapt-get (or gslapt, if you prefer) to install local software packages. I spent a lot of time searching and ran into several dead-ends, instructions that assumed the reader was a power-user, and some flat-out bad advice. So I'm going to lay out the steps as plainly as possible on how to use slapt-get to install binaries you've downloaded or compiled yourself.
This is pretty easy to do, it's just long because I'm sympathetic to newer users so I go into detail where it may seem redundant to some.
I'm going to assume you know how to do the
dance. This builds the software and throws the binaries into your system, bypassing your package manager. I'll also assume you know how to use
which turns the compiled software into a package. If you don't know how to do these things, do some Googling and come back when you can go from source to ready-to-install package.
Create Local Repository Directory
OK, we're going to make a directory where you will store the packages you create for use with slapt-get. You can put it pretty much wherever you want and call it whatever you want. When I was going through this process I found some instructions that almost-worked that suggested putting the directory in /usr/src/ , so that's what I did. As tempting as it may be, do not place your new directory in /home/ftp/pub/veclinux/packages/
; whenever you do a
you'll delete your packages in that directory. It also makes since to make the directory owned by root since only root should be installing packages and using checkinstall anyway. So my new directory was /usr/src/local_repo/ .
Vector comes with software that can automatically build the checksums and package information required by slapt-get. You just need to run the command
with a switch that tells it whether it should build the info for all the packages in the directory or just the new ones. Now, if you don't mind cd'ing to your local repository and running this command every time you add a new package, then you can skip to the part below that talks about adding your local repo to the slapt-getrc; I'd just suggest playing with the
command to get comfortable with it and see what it does. However, with a couple easy steps, you can save a a little work each time and make it easier to remember.
As root, create a new file in /root/ called "build_repo". In this file add:
The middle line should be the new directory you created in the previous step to hold your downloaded/created packages. Save your addition, close the file, and make it executable. As you can see, when this script is run, it changes to the local repository directory and runs the makeinfo-slapt command with the "new" option. If you want it to build the info for all your packages every time you run it, then use "all" instead of "new"; in most cases, you won't need to do this.
Add an Alias
As root, open root's .bashrc. We're going to create an alias that automates executing the script we just created above. Near the bottom of root's .bashrc, add:
That means that as root, we can just type
buildrepo and it will execute the script we created. If you're using the command line, end your shell session or open a new terminal (then su to root) so that it incorporates the changes you made to root's .bashrc.
Modify your slapt-getrc
We now need to make sure slapt-get knows about our new local repository. As root, open your /etc/slapt-get/slapt-getrc file. We need to add the line
...to the file. Obviously, if the directory you created is elsewhere, you should use that path instead. There are a couple different places you can add this line. I like to put it in the "FAVORITE" group so slapt-get tries to use my packages first, but you can also put it in the "VECTOR" group.
Once you've made the changes, save the file and close it.
Running the script
Now we just need to populate the new directory of ours. If you've downloaded or compiled a package recently, just move it to the new directory as root. If you don't have any .tgz packages on hand, you'll need to download or compile at least one and put it in your new repo directory.
Now as root (from any directory) run our
buildrepo command. You'll see some output that indicates it's building the necessary files (and deleting old ones). When it's done, it will give you a prompt.
Now do a
slapt-get --clean (this probably isn't required, but since we modified your slapt-getrc, it will give you a clean slate). If you like to manage your packages from the command line, just do a
slapt-get --update and it should add your new local packages; if you're using gslapt, just open it and click update. Now using the command line or gslapt, do a search for the package(s) you put in your local repository. You should see them and be able to use them.
Now every time you download or compile a new package, just move it (them) to your new local repo, as root run "
buildrepo", then update your slapt-get using the command line or gslapt...good to go.
First, make sure you're root and have made the changes above as root.
If you get errors running buildrepo, try cd'ing to your local repo and running
makeinfo-slapt all. If you get errors at this point make sure the package(s) you put in the directory were compiled correctly. If the errors go away follow the rest of the steps and then go back and make sure you built build_repo script correctly.
If you just can't make it work and want everyting back the way it was, just delete the directory you created, delete the "build_repo" script in /root/, remove the changes made to slapt-getrc, remove the additions to root's .bashrc, clean slapt-get, and then update slapt-get; you're back to the way things were.
This is pretty much exactly what I did (excluding the trial and error) and it worked like a champ. If I've made a mistake somewhere or skipped a step, please let me know. It's also possible that there's an easier way to do this and I'm just hard-headed, if this is the case, please let me know.
Posted 13 years, 2 months ago on September 22, 2006
The trackback url for this post is http://www.suseroot.com/blog/bblog/trackback.php/69/