Saturday, January 13, 2007

Installing Asterisk, Java SDK, recompiling Kernel on Debian

This is nothing to be proud off.. two things I wanted to install. Note this is not JAVA for Asterisk, keep googling on how to do that, this is just a few packages I installed on a Debian box.

------

a) Java SDK - Sun webpage has jdk-6-linux-i586.bin but I followed some instructions (running the binary and trying to create the Debian package) but they didn't work so I check what was available. I found that testing (etch) had a Sun Java package ready to apt-get install.

-------


b) Asterisk again (this is a second server, I want to experiment with IAX and SIP trunks between asterisks)

For (a) I couldn't install it on normal ways so I cheated. Following is what I did -not on purpose.

Installed Sarge from Netinstall and updated it.
5 cd /etc/apt/
1 vi sources.list
2 apt-get update
3 apt-get dist-upgrade
4 shutdown -r now


Upgraded to Etch (by changing the sourcelist)
5 cd /etc/apt/
12 apt-get install fakeroot
13 apt-get install java-package ncurses-dev wget bzip2
17 vi sources.list
18 apt-get update
19 apt-get dist-upgrade
20 uname -r
21 shutdown -r now


Install Jdk 5 (not 6)
22 apt-get install sun-java5-jdk
23 which java

After this I went to install asterisk but when compiling Zaptel I got the error that the headers didn't match although they were there and they were the same as the uname -r. I tried to uninstall them and install them again but once uninstalled I couldn't install them again... so I decided to do something that I always fails... build the kernel from the sources.

Upgraded the kernel to latest one on kernel.org
I install a bunch of packages that not sure what they are for
105 apt-get install kernel-package ncurses-dev fakeroot wget bzip2
106 apt-get install make-kpkg kernel_image
130 apt-get install yaird fakeroot
134 apt-get install initramfs-tools


Also in the process I created a Sudo account.
apt-get install sudo
adduser ricardosudo
visudo -> modified a file with PICO
added ricadosudo ALL=(ALL) ALL
sudo adduser ricardosudo src


And here it gets weird:
cd /usr/src
tar jxf /path/to/linux-2.6.19.2.tar.bz2
cd linux-2.6.19.2/
cp /boot/config-$(uname -r) .config
---> basically I am copying the .config left by the default installation to avoid starting from zero.
make oldconfig ---> not sure if necessary. Here you are asked A LOT of things. Try to answer what you can but probably this will remind you a Windoze NEXT NEXT NEXT era.
make menuconfig --> here again I think that I could avoid the previous step. anyway go through the options and remove anything you think you don't need as it will make the kernel smaller and compile quicker. What do I don't need you ask? Go for the obvious - like removing support for ATI if you have an Intel Graphic board.

Example of the screen of menuconfig:



A few things to check are:
Processor type and features ---> Processor family (Pentium 4)
Processor type and features ---> Timer Frequency (1000 Hz)
Processor type and features ---> Preemption Model ---> Preemptible Kernel (Low-Latency Desktop)


Exit to the main menu and SAVE then run:
fakeroot make-kpkg clean

Run the make-kpkg commmand like: fakeroot make-kpkg --append-to-version "<-suffix>" --revision "" --us --uc --initrd kernel_image kernel_headers Where <-suffix> is whatever you want (like -mykernel), and change with a number (like the date, 05112006.)

Example: fakeroot make-kpkg --append-to-version "-mykernel" --revision "01132007" --us --uc --initrd kernel_image kernel_headers

After this you will get 2 deb files, you can use dpkg -i to install them.

dpkg -i linux-headers-2.6.19.2-mykernel_01132007_i386.deb
dpkg -i linux-image-2.6.19.2-mykernel_01132007_i386.deb

Here my box went wrong saying that I needed Yaird initramfs-tools and another package and could continue. I try to apt-get install those package bUt it kept saying "The following packages have unmet dependencies." but also it said to try to run apt-get install -f (note alone, not any other instance).

After this I run the dpkg again and now it worked.

After this I was able to install Asterisk as always and it worked. I am sure that I am doing something wrong and hope to learn what it is along the way.

NOTE: When compiling Zaptel I run the modprobe zaptel and modprobe ztdummy as I don't have any fxo,fxs,tdm board on this box. It will us the ztdummy for timing. An lsmod shows the modules...

rbtest:/usr/src# lsmod
Module Size Used by
ztdummy 5544 0
zaptel 208932 1 ztdummy
crc_ccitt 2304 1 zaptel

Something good came out of this.. NO KERNEL PANIC on an attempt to recompile a kernel. I have to say.. first time I didn't got one of this.

Some links that I used to do this were:

http://www.falkotimme.com/howtos/debian_kernel2.6_compile/
http://wizah.blogspot.com/2005/12/debian-how-to-custom-kernel-compile.html
http://www.debianhelp.co.uk/kernel2.6.htm