Friday, April 29, 2005

The new home of my Ubuntu Linux related blogs: yusufk's Journal

I've decided to move my Ubuntu related blogs to Ubuntu Linux Forums - vB Journal: yusufk's Journal, beacuse its closer to where I usually find answers anyway. This blog maybe quieter though, not that anyone gives a nut, coz I'm the only one that reads this, hehe.

How to turn on Num Lock on GNOME startup?

Unofficial Ubuntu 5.04 Starter Guide: "


sudo apt-get install numlockx

sudo cp /etc/X11/gdm/Init/Default /etc/X11/gdm/Init/Default_backup

sudo gedit /etc/X11/gdm/Init/Default


4. Find this line


...

exit 0


5. Add the following lines above it


if [ -x /usr/bin/numlockx ]; then

/usr/bin/numlockx on

fi


6. Save the edited file (sample)

7. Read How to restart GNOME without rebooting computer?"

The new home of my Ubuntu Linux related blogs: yusufk's Journal

I've decided to move my Ubuntu related blogs to Ubuntu Linux Forums - vB Journal: yusufk's Journal, beacuse its closer to where I usually find answers anyway. This blog maybe quieter though, not that anyone gives a nut, coz I'm the only one that reads this, hehe.

How to turn on Num Lock on GNOME startup?

Unofficial Ubuntu 5.04 Starter Guide: "

sudo apt-get install numlockx
sudo cp /etc/X11/gdm/Init/Default /etc/X11/gdm/Init/Default_backup
sudo gedit /etc/X11/gdm/Init/Default

4. Find this line

...
exit 0

5. Add the following lines above it

if [ -x /usr/bin/numlockx ]; then
/usr/bin/numlockx on
fi

6. Save the edited file (sample)
7. Read How to restart GNOME without rebooting computer?"

Thursday, April 21, 2005

How to make Ubuntu/Debian .deb packages from source tar.gz

This is my abbrevitated version of : Hands On


Step 1: Make the source files

Un-tar your source files. This should result in a directory ./the_app

cd into the_app directory: cd the_app

Make the application according to the instructions in the README file, usually just means running the make command in the the_app directory: ./make


Step 2: Prepare the "control" file

Then create a directory DEBIAN: mkdir DEBIAN

cd into DEBIAN: cd DEBIAN

Create a file called "control" based on the following example:


Package: your_package_name_without_ext

Version: 1.0

Section: base

Priority: optional

Architecture: all

Depends: prog1 (>= 2.05a-11), prog2 (>= 2.0-12), prog3, prog4 (>= 1:2.0.7-8), prog5 (>= 3.02-8), prog6 (>= 2.4.2-3), prog7 (>= 5.0-5)

Maintainer: Yusuf

Description: A little sumthing sumthing on your program


Step 3: Put all the files in their places

Now you've got to create a directory structure with the files needed as they will be installed on your system.

So if you need the bin files in your /usr/local/bin directory then copy the bin files into the_app/usr/local/bin : cp the_app.sh usr/local/bin


Step 4: Create the Package

Decend into the directory containing the_app and run: dpkg-deb --build the_app

Thats it! You should now have a the_app.deb package


Extract a gzip compressed tar archive in Linux

To extract the archive filename.tar.gz into the current directory:


tar xzf filename.tar.gz


If this fails, the version of tar may not support gzip compression. In this case, you can use the traditional two-stage command:


gzip -dc filename.tar.gz | tar xf -

How to make Ubuntu/Debian .deb packages from source tar.gz

This is my abbrevitated version of : Hands On

Step 1: Make the source files
Un-tar your source files. This should result in a directory ./the_app
cd into the_app directory: cd the_app
Make the application according to the instructions in the README file, usually just means running the make command in the the_app directory: ./make

Step 2: Prepare the "control" file
Then create a directory DEBIAN: mkdir DEBIAN
cd into DEBIAN: cd DEBIAN
Create a file called "control" based on the following example:

Package: your_package_name_without_ext
Version: 1.0
Section: base
Priority: optional
Architecture: all
Depends: prog1 (>= 2.05a-11), prog2 (>= 2.0-12), prog3, prog4 (>= \ 1:2.0.7-8), prog5 (>= 3.02-8), prog6 (>= 2.4.2-3), prog7 (>= 5.0-5)
Maintainer: Yusuf
Description: A little sumthing sumthing on your program

Step 3: Put all the files in their places
Now you've got to create a directory structure with the files needed as they will be installed on your system.
So if you need the bin files in your /usr/local/bin directory then copy the bin files into the_app/usr/local/bin : cp the_app.sh usr/local/bin

Step 4: Create the Package
Decend into the directory containing the_app and run: dpkg-deb --build the_app
Thats it! You should now have a the_app.deb package

Extract a gzip compressed tar archive in Linux

To extract the archive filename.tar.gz into the current directory:

tar xzf filename.tar.gz

If this fails, the version of tar may not support gzip compression. In this case, you can use the traditional two-stage command:

gzip -dc filename.tar.gz | tar xf -

Tuesday, April 19, 2005

APT syncing a home machine

Thanks to Hellkom, its not worth it for me (or any South African for that matter) to get an ADSL line at home. I won't even mention dialup (ok I have, but I regret it). So this creates difficulties. One of them is the fact that it is a pain to keep my home maching up to date with the latest ubuntu packages.

I sought advice and I found it (courtesy Thomas Fogwill):

There are at least 3 other ways to do what you want:
1) Repository on notebook
2) Manually generate fetch lists
3) Use automated tools

(1) Repository on notebook (I do this)
I keep my downloaded packages on my notebook
(in /var/cache/apt/archives/). Things I want to install at home, but not
on my notebook, are downloaded with apt-get -d install ...
I have a www directory linked to /var/cache/apt/archives/,
and generate a Packages.gz file here like this:
apt-ftparchive packages . | gzip -c > Packages.gz

Then, I add this www directory to my wife's sources.list (at home). If
any packages are ever missing from this dir, I rebuild them with
dpkg-repack.

The following is a useful little script to rebuild ALL installed
packages:
dpkg --get-selections | grep [^De]install | cut -f1 | sh -c "while read STRIN; do dpkg-repack $STRIN ;done"

Note: dpkg-repack uses the files on the filesystem to rebuild the
package. Thus, any config/customisation you've done will be included in
the deb.

2) Manually generate fetch lists
This should also work (untested). Apt stores its downloaded package
files here: /var/lib/apt/lists/
You should be able to copy your updated files over from your notebook,
then do an apt-get --print-uris install|upgrade|dist-upgrade on the home
machine. This will print out the uri's of the files that need to be
downloaded. You then take these uri's, download them (at work) with
wget, copy them to the home machine and dpkg -i *.deb to install them.

This will dump the apt-get output into a file that wget can use to
download in batch mode:
apt-get --print-uris -y install ... | grep http | cut -f1 -d' ' | cut -f2 -d' > debs.toget
To batch fetch the debs:
wget -i debs.toget

This should work fairly well, except when packages on the mirror change overnight.

3) Use automated tools
e.g. apt-zip. apt-zip basically automates (2) above.

APT syncing a home machine

Thanks to Hellkom, its not worth it for me (or any South African for that matter) to get an ADSL line at home. I won't even mention dialup (ok I have, but I regret it). So this creates difficulties. One of them is the fact that it is a pain to keep my home maching up to date with the latest ubuntu packages.

I sought advice and I found it (courtesy Thomas Fogwill):

There are at least 3 other ways to do what you want:
1) Repository on notebook
2) Manually generate fetch lists
3) Use automated tools

(1) Repository on notebook (I do this)
I keep my downloaded packages on my notebook
(in /var/cache/apt/archives/). Things I want to install at home, but not
on my notebook, are downloaded with apt-get -d install ...
I have a www directory linked to /var/cache/apt/archives/,
and generate a Packages.gz file here like this:
apt-ftparchive packages . | gzip -c > Packages.gz

Then, I add this www directory to my wife's sources.list (at home). If
any packages are ever missing from this dir, I rebuild them with
dpkg-repack.

The following is a useful little script to rebuild ALL installed
packages:
dpkg --get-selections | grep [^De]install | cut -f1 | sh -c "while read STRIN; do dpkg-repack \$STRIN ;done"

Note: dpkg-repack uses the files on the filesystem to rebuild the
package. Thus, any config/customisation you've done will be included in
the deb.

2) Manually generate fetch lists
This should also work (untested). Apt stores its downloaded package
files here: /var/lib/apt/lists/
You should be able to copy your updated files over from your notebook,
then do an apt-get --print-uris install|upgrade|dist-upgrade on the home
machine. This will print out the uri's of the files that need to be
downloaded. You then take these uri's, download them (at work) with
wget, copy them to the home machine and dpkg -i *.deb to install them.

This will dump the apt-get output into a file that wget can use to
download in batch mode:
apt-get --print-uris -y install ... | grep http | cut -f1 -d' ' | cut -f2 -d\' > debs.toget
To batch fetch the debs:
wget -i debs.toget

This should work fairly well, except when packages on the mirror change overnight.

3) Use automated tools
e.g. apt-zip. apt-zip basically automates (2) above.

Saturday, April 16, 2005

Ubuntu - Linux for Human Beings

My 1st experience with a pc was with a ZX Spectrum way back in 1990'ish. I later progressed to a Commodore 128 and then finally in 1992 I mananged to get my paws on on my dads 286, which he intended to use for bussiness. DOS was a dream, it was complex enough (at the time) to keep me challenged for hours on end, especially when I had recover (on more than one occasion) from the odd virus, DIR II, Michaelangelo, Stoned, the good old days. When I discovered Windows in 1995, it really was not my forte, it hid the complexity of the pc too much and made things too easy. But, I had to stick with the times and the Games, which soon required Windows and Windows soon lost DOS.


To cut a long story short, for now, until I get to update this, I discovered Ubuntu Linux, much better than my previous encounters with Linux (Mandrake, Red-Hat), works like a charm and its FREE! Check out: Ubuntu - Linux for Human Beings

Ubuntu - Linux for Human Beings

My 1st experience with a pc was with a ZX Spectrum way back in 1990'ish. I later progressed to a Commodore 128 and then finally in 1992 I mananged to get my paws on on my dads 286, which he intended to use for bussiness. DOS was a dream, it was complex enough (at the time) to keep me challenged for hours on end, especially when I had recover (on more than one occasion) from the odd virus, DIR II, Michaelangelo, Stoned, the good old days. When I discovered Windows in 1995, it really was not my forte, it hid the complexity of the pc too much and made things too easy. But, I had to stick with the times and the Games, which soon required Windows and Windows soon lost DOS.

To cut a long story short, for now, until I get to update this, I discovered Ubuntu Linux, much better than my previous encounters with Linux (Mandrake, Red-Hat), works like a charm and its FREE! Check out: Ubuntu - Linux for Human Beings