Contact SalesSitemapCustomer Login

Custom Linux Environment - Part 03 - A Livable System

Contents

[edit]

A Livable System

A livable system is, by definition, one that you're happy using on a frequent basis. Essentially, it means you have quite a few things on it that you can or do use on a day to day basis. There's a number of these for me, but perhaps the most important is...


[edit]

Joe

I like coffee. I like Joe. Joe is Joe's Own Editor. (Again, us strange people with the recursive acronyms!) You can get it from joe's own site.

I configured mine with --prefix=/usr --sysconfdir=/etc. It links to ncurses for terminal definitions if it's there, and that's a good thing. Terminal definitions mean we don't see problems. Once it compiles, there's not really a check suite, so go ahead and make DESTDIR=foo install.

You should have an etc/joe/lots of joe/jstar/etc rc files. Move them all to names like joerc.new, then from your base dir (Mine was /tmp/joe ), mkdir install; cd install; joe doinst.sh and add a line for each one that goes something like

( if ! [ -e /etc/joe/joerc ]; then cp /etc/joe/joerc.new /etc/joe/joerc; fi; )

This will create a script that's run when the package is installed to move /etc/joe/joerc.new to /etc/joe/joerc if /etc/joe/joerc does not already exist. In other words, wouldn't you hate it if you overwrote a really customized config file on installation by mistake? I've done it. Nothing like losing hours of work on a written from scratch httpd.conf. Makes me crave coffee again just thinking about it. Muaha.

[edit]

screen

Screen is one of the most useful utilities I know. Imagine being able to switch between remote terminals on the same screen - Priceless, right? That's what screen does. I fed it --prefix=/usr --sysconfdir=/etc again, since it has a screenrc file. Same information about doinst.sh above applies, only figure out which file to do it with yourself. :)

Finish packaging and install.

[edit]

pkg-config

It's available from freedesktop.org over here. Snag it - It allows programs to reference .pc files - You've seen them occasionally getting installed to /usr/lib/pkgconfig/name-version.pc.

Basically, it lets program A execute a simple command and get the flags it needs to add for a specific lib, search paths, and installed version in an easy-to-parse format. One of those little tools in the background you'll probably never think about.

You might, however, want to edit /etc/profile at this point, and add a variable called PKG_CONFIG_DIR=/usr/lib/pkgconfig;/usr/local/lib/pkgconfig; or somesuch. Because that's how it knows where to look.

[edit]

zlib

zlib is " A Massively Spiffy Yet Delicately Unobtrusive Compression Library (Also Free, Not to Mention Unencumbered by Patents) ". It is indeed spiffy. It's a fast compressed I/O library, in effect, and very useful for things wanting to save drive space.

Get it from here.

It's pretty simple to configure --prefix=/usr --shared, and we've used over a third of its configure options already!

Package and install it like normal.

[edit]

readline

Readline is one of those old cranky packages you will run into sometimes. It has been around forever, and there's a couple of things you have to do to make it install right. However, I'm going to take a time out and mention the most important:

When compiling readline as a shared library, you have to set the library to pull in ncurses. It doesn't know about ncurses, it's just going to look around for lcurses, not find it, and not link to any cursor library. You have to specify SHLIB_LIBS=-lncurses on the make line for it to link properly. If it doesn't, our next package won't be very happy with it.

When I configured it, I passed it --prefix=/usr --enable-shared --with-curses --infodir=/usr/info --mandir=/usr/man.

Don't forget to apply all of it's patches before you make SHLIB_LIBS=-lncurses; It's a Gnu program.

[edit]

pcre

Pcre is touchy, just because we're running on a 64MB environment. Essentially, what it comes down to, is that configure doesn't catch all of our CFLAGS and CXXFLAGS quite like it should.

I tossed the flags --enable-pcregrep-libz --enable-pcregrep-libbz2 --enable-pcregrep-libreadline --enable-utf8 --enable-unicode-properties at it.

The cflags I'm using are still --march=native -mmmx -msse -msse2 -Os -maccumulate-outgoing-args. You'll need to use joe on your makefile, while drinking joe. Bwahaha.

Make check it. Some of the tests may fail with an errno 12, that's an unable to allocate memory error. Ignore it.

[edit]

glib

Alright. Now it's time for glib. A couple points to note - glib needs to have its tests run while !root, because some of its test suite is file access and directory access. When root, you automagically have access to all files and directories no matter what the permissions on them are set to. This means that there's nothing anyone can do to block you out, but for a test that tests the effectiveness of setting permissions that means that the tests come back as if they were all broken. As you can imagine, this breaks the test suite. I compiled glib in /usr/local/src as a non-root user.

Toss its configure --prefix=/usr --with-pcre=internal (Saves on memory usage once it's loaded.) --prefix=/usr.

Make it. It should make allright if you're using -Os in your CFLAGS.

When you make check, though, you're going to see some tests fail because of memory allocation errors, out of memory, or errno12. These are all directly related to only having 64MB of RAM and no swap - You'll have to disregard these. Once check works flawlessly except for problems caused by a lack of RAM, go ahead and package and install it.

[edit]

OpenSSL

OpenSSL, as far as most people are concerned, seems to be THE SSL LIBRARY. However, there is another one - GNU TLS.

Why does Gnu TLS warrant mention?

Because it has support for RFC5246, also known as TLS 1.2. TLS does what SSL used to. RFC5246 is what is known as a "proposed standard". The only thing that keeps it from becoming a "standard" is that it has not yet achieved widespread usage. Many RFC's remain both "the way this is done" and a "proposed standard" - RFC's are a very interesting thing. In general, if you want to know how something (such as a protocol) works, hit up the Internet Engineering TaskForce page and read the RFC's on your subject of choice.

If you want to install gnuTLS, go for it. You'll need libgpg-error and libgcrypt, both from the GnuPG site. However, something that ought to be mentioned here:

While apache does have a mod_gnutls available at outoforder.cc, it does not yet list support for TLS 1.2. In fact, TLS 1.2 is very new from a standards point of view, so don't expect much to use it. I will continue to use OpenSSL in general, and will include specific information about GnuTLS support if we compile anything which actually supports it the way we want it to. GnuTLS is pretty easy to compile. However, as of yet, almost nothing has support for GnuTLS.

OpenSSL, on the other hand, you want to ./config it. I used this:

 ./config threads shared zlib-dynamic --prefix=/usr --openssldir=/etc/ssl

Then make it, and then:

 make INSTALL_PREFIX=/tmp/opennsl 

Or so. You'll need to move your man directory from etc/ssl/man to usr/man.

Now, we've got a lot of man pages.

I really prefer to bzip2 -9 my man pages.

But we have a TON of symbolic links. In fact, in man1, probably more links then man files! So, we're not going to do this by hand.

So here is a very touchy script. Use it in the usr/man dir, and it will sort through man1 man2 man3 etc., erase all the links, then recreate all the links to point at $original_file.bz2, then compress everything.

It works, but it DOES spit out a lotta error messages. In the end, it does compress everything though. Like I said, it's TOUCHY. Don't blame me if it breaks, debug it and send it back.

USE AT YOUR OWN RISK. I spent probably an hour making this already, drinking joe in joe.

function compman()
{
for dirname in `echo man{1,2,3,4,5,6,7}`; do
        if [ -d $dirname ]; then
                cd $dirname;
                find . | while read filename; do
                        if [ -L $filename ]; then
                                export file1=`ls -l $filename | cut -f 2- -d "/" | cut -f 1 -d "-" | cut -f 1 -d " "`;
                                export file2=`ls -l $filename | cut -f 2- -d ">"`;
                                ( rm -rf $file1 )
                                ( ln -sf $file2.bz2 $file1.bz2 )
                                unset file1;
                                unset file2;
                        fi;
                done;
                ( bzip2 -9 * )
                echo "Finished in $dirname."
                cd ..
        fi;
done;
}

Once you're ready, package and install. You have a brand new openssl. Mine has bz2'd man files without broken symlinks. Cool.

I now have openssl-0.9.8i-i686-7.tgz, because one way or another I kept not following my own instructions. Phew!

[edit]

irssi

Irssi is my favorite irc client. It's small, fairly lean, extensively featured, and console based. You can get it from their web site. Go snag it.

Building it is very straightforward, after all the strangeness we've had to endure. I tossed --sysconfdir=/etc --prefix=/usr --with-perl --with-ncurses --with-gnu-ld --with-perl-lib=/usr/lib/perl5/site_perl/5.10.0/Slackware-linux/ --enable-ssl --mandir=/usr/man, you'll have to fill the --with-perl-lib in for your own system. Make, and make DESTDIR=/foo install, package it up and install it for real.

If you're like me, about this time you start adding --infodir=/usr/info --mandir=/usr/man --sysconfdir=/etc --prefix=/usr into your ~/.bashrc - Which will be sourced any time you start bash, initial login or not - just because you're tired of typing them all the time. This means confy function will now look like this:

function confy
{
if ./configure --prefix=/usr --infodir=/usr/info --mandir=/usr/man --sysconfdir=/etc $* > configurate.txt 2>&1;
   then echo "configure --prefix=/usr --infodir=/usr/info --mandir=/usr/man --sysconfdir=/etc $* successful.";
   else echo "failure configuring $*."; 
        tail -n 20 configurate.txt;
fi;
}

Which means all you'd have to type in would be:

confy --with-perl --with-ncurses --with-gnu-ld --with-perl-lib=/usr/lib/perl5/site_perl/5.10.0/Slackware-linux/ --enable-ssl

But the output you'd get would be something like this:

configure --prefix=/usr --infodir=/usr/info --mandir=/usr/man --sysconfdir=/etc --with-perl --with-ncurses --with-gnu-ld --with-perl-lib=/usr/lib/perl5/site_perl/5.10.0/Slackware-linux/ --enable-ssl successful.


Then just run irssi. Now you can use screen to get multiple terminals on your VPSLink1 box, and use irssi on one (or more) of them to talk with people while you work. See? It's becoming more homey already, isn't it?


Now, I don't know about yours, but my configure didn't actually set the prefix. Since there's no test suite, here is how we're going to build it:

make DESTDIR=/tmp/irssi install

It will build and install in one swell foop. I mean, fell swoop.


Now, move etc/irssi.conf to etc/irssi.conf.new, and add the following line (again) to install/doinst.sh

( if ! [ -e /etc/irssi.conf ]; then cp /etc/irssi.conf.new /etc/irssi.conf; fi; )

Which, as you now know, reads in English "If there's no /etc/irssi.conf, copy /etc/irssi.conf.new there."

Make sure you remember to move usr/share/doc/irssi to usr/doc/irssi-0.8.12

XML::Parser

Congratulations, it's time to get our first perl module. at your console, type CPAN.

I told mine to configure automatically, and then followed the instructions about o conf on the screen to get set up with mirrors.

Now just type "get XML::Parser" and then "install XML::Parser" and let it fail back through the dependancies and do all the hard work for you.

It will fail making XML Parser itself, messily. If you look on the screen, you'll find out where the .cpan directory is it was making in. Exit cpan and go in there.

Do a make 2>&1 | less, and review the output.

You'll find we're missing expat.h.

We need libexpat.

It came with the system - But, of course, there are no headers. So we need to rebuild it, install things in the current directories as expat is (Since we have no way to uninstall anything) and overwrite the old, incorrectly done package install.

libexpat

A quick search for expat shows it's on sourceforge. It's an XML parser - No wonder XML::Parser is wanting it! Makes the perl bindings easier.

To configure it, we don't even have to toss anything at our new confy - just run it. make it, make check it (ignore the compiler warnings) and package 'er up. If you check the include dir, you'll find the expat.h we were missing.

However, because we're installing expat over an existing install, lets check /usr/lib/libexpat* - Look, we have one we don't know anything about. /usr/lib/libexpat.so.0.5.0.

Now, I'm a daring fool, so I'm going to rm -Rf /usr/lib/libexpat*. I'll let you know if it breaks everything.

...Well, it SEEMS to work just fine. But lets check further. In fact, lets check "exhaustively".

cd /usr && find . | while read filename; do if [ -x $filename ]; then if ldd $filename 2>&1 | grep expat > /dev/null 2>&1; then echo $filename depends on expat; fi; fi; done;

(I have a really wide widescreen monitor.. So if that needs to wrap and isn't, please adjust it so it looks better. --Shadows 03:04, 27 November 2008 (PST))


Now, on my system, nothing, that's right, NOTHING has a dependency on libexpat. That means we're operating in a "scrubbed" environment.

XML::Parser part 2

Make your package and install it. Run cpan again.

clean XML::Parser make XML::Parser install XML::Parser

And this time, it works fine. Voila!


finch

Next we want finch, a console based IM client. It's part of the pidgin package, just search for pidgin and go from there. (Hint: Sourceforge)

Guess what it depends on? That's right, XML::Parser. But it also needs libxml2.

libxml2

On configuring it, it tells me I need libxml2 headers installed. They're ... Not installed on my system. Now, why do I have the source, but no binaries and no installed package?

Ah yes. You remember back in Part 02, when I said we'd tackle libxml2 later? It's time to tackle libxml2.

If you're on a VPSLink1, you have three choices.

1. Upgrade to a VPSLink2. 2. Make sure you have a sizable chunk of drive space free, and tar -cf - * | bzip2 - > system.tar.bz2, download that file to a local 32bit slackware machine with more then 64MB of RAM, decompress it in, say, /home/user/vpslink1, and chroot into it. (This will give you a development/compile box for your vpslink1 that is not RAM limited. It will be useful if you want to run, say, a LAMP stack - you could do this, and only have to upgrade to a vpslink3 instead of a vpslink4, if my math is right on RAM usage.) 3. download the package from ftp.slackware.com. 4. Follow these really excellent instructions.

Why? Because you need 80MB of RAM to compile libxml2. I, for other reasons, have at this point upgraded to a vpslink4 account. I *have* to have a working LAMP stack, and I don't have a 32bit box, I don't want to use uname wrappers to force the OS to believe it is 32bit, and I need to run a number of things besides apache, mysql and php. Such as a full blown ldap/radauth server...

Anyway. If you download the package, skip to the next step.

Otherwise, configure, make check.

The make check says go get a file. Go get it and decompress it. Please note, while sipping joe and feeling cool, that you want to decompress this file in the main libxml2 source directory - it needs xmlconf to exist to run these extra tests, this file creates it.

I get 15 expected failures out of another 2262 additional tests. I call that good.

Be sure and catch those doc directories in usr/share.

Once you're done getting everything just right, running strips, running compman, etc, make your package and install 'er.

finch, again

I'm compiling finch without meanwhile (sametime) and avahi(Bonjour) support. I don't use these protocols. If you do, get the required dependencies - You should be good enough by now.

Here's how I configured my finch:

 confy --disable-gtkui --disable-screensaver --disable-sm --disable-gtkspell --disable-gestures --disable-gstreamer --disable-meanwhile --disable-avahi --dsable-dbus --disable-tk 

You'll notice when you finish configuring, if you don't use confy, that X11 support is listed as Yes. Don't worry, we successfully disabled anything that would call on X. There's also NOT a complete list of protocols there that finch will support. Think of this more along the lines of "Besides the basic protocols like AIM, Y!, and such, we'll also support..."

Go ahead and make. On my system, we use up to about 50MB of RAM, so you probably don't want much running besides BASH. If you have trouble, check out this wiki article - It's got some really good information (Trust me on this): Compile any program.

Anyway. In spite of having passed --mandir, we get one man3 file up in usr/share/man/man3, so move the directories around like they need to be before running compman.

Package and install.

The command name we run is "finch". Might want to read manpages on it too.

It's nifty.

locate

There's a few commands that I have repeatedly tried to reference. One of them is "locate". It's not there. I don't know why it's not there. It's one of those incredibly sys-adminny commands for those who forget where they left binaries laying around, or for finding that .txt file you didn't save where you thought you did.

It's part of a group of utilities called, ironically enough, findutils.

It's gnu software. Go snag it. configure, make, and make check it. Toss --localstatedir=/var/locate at the configure, btw.

Hey - Look at that! DejaGNU and Expect, which we installed so long, get used as part of its test suite!

Pretty nifty stuff, isn't it?

Package and install it - You know the drill by now.

tree

I'm not so cruel as to make you search for this. You can find it on Steve Bakers repository over here.

Tree is incredibly useful to display a directory / file hierarchy visually. So go snag it.

Decompress it like it was a regular .tar.gz file.

Cd into it. Don't even try to configure it, just run "make".

Give it a try with ./tree - See how useful it can be?

Build a package to install it manually, then do so.

bc

One thing I occasionally want is a good calculator. Namely, bc.

If you like reverse polish, get dc. No, there really are two gnu calculator programs. Go check it out for yourself.

One thing though. We need this copy of bc: here.

It's an alpha version... from '06. bc itself was last released in 2000. Very stable software, don't worry.

Throw --with-readline at it when you compile it. Do the usual to package and install.

Voila! We are finished. Pretty nifty, no?


Random Excersize

I still have source files scattered all over my hard drive - But do I have more files then you?

cd / && find . | wc -l

I have 129,140 total files on my virtual hard drive. How many do you have?

The things that amuse me.

Retrieved from "http://wiki.vpslink.com/Custom_Linux_Environment_-_Part_03_-_A_Livable_System"
Recent Changes | RSS RSS Feed