Downloading Asterisk from CVS

What is CVS?

CVS is a central repository which developers use to control the source code. When a change is made it is committed to the CVS server where it is immediately available for download and compilation. Another added benefit to using CVS is that if something was working at one point, but a change causes it to break, the version for any particular file can be rolled back to a certain point. This is true for the entire tree as well. If you find something was working at one point but installing the latest version of Asterisk causes that to break, you can "roll-back" to any point in time (see Getting the files from CVS).

Your Initial Download

Asterisk can be obtained from the Digium CVS server. You will need any packages which your distribution requires to download the sourcecode and to compile. Most modern Linux distributions have a category at installation for development tools, but some may vary. Binaries are available, however they are created on a non-regular basis, so you are best to stick to using the CVS method to obtain and compile the sourcecode.

Getting the files from CVS

The following commands can be used to retrieve the sourcecode. Your server will download all the appropriate files from the CVS server and place them in their respective directories. If you don't need zaptel or libpri simply leave them out of the checkout statement.

Asterisk v1.0 RC1


cd /usr/src
export CVSROOT=:pserver:anoncvs@cvs.digium.com:/usr/cvsroot
cvs login - the password is anoncvs
cvs checkout asterisk libpri zaptel

Getting the files using CVSup

In order to get Asterisk using CVSup, create a file containing the following information. You can call the file anything you want such as "asterisk-sup". Place this file in your /usr/src/ directory.


*default host=cvs.digium.com
*default base=/usr/src/
*default release=cvs tag=.
*default delete use-rel-suffix
asterisk
libpri
zaptel

Once you have create the file, change to the /usr/src/ directory and issue the cvsup asterisk-sup command.

Updates

Updating Asterisk from CVS is relatively straight forward. One note however is that the Asterisk directory has a script to automatically update from CVS, compile and install for you. The only problem is that it doesn't do zaptel and libpri, so those will need to be done manually. Before attempting to unload the modules be sure you have stopped Asterisk as it will be using the modules.

Updating zaptel and libpri


cd /usr/src/
cvs -z3 -d:pserver:anoncvs@cvs.digium.com:/usr/cvsroot login
The password is anoncvs
cvs -z3 -d:pserver:anoncvs@cvs.digium.com:/usr/cvsroot update zaptel libpri

Now we must unload the modules from memory before we recompile them. We can check to see what modules are currently loaded by using the lsmod command. You should get an output similar to the following:


				[root@localhost src]# lsmod
				Module                  Size  Used by
				ipv6                  184672  10
				autofs4                12932  0
				sunrpc                109924  1
				8139too                17920  0
				mii                     3584  1 8139too
				tulip                  36384  0
				ztdummy                 3364  0             <-- ztdummy module
				zaptel                218212  3 ztdummy     <-- zaptel module
				floppy                 47440  0
				sg                     27680  0
				scsi_mod               91984  1 sg
				microcode               4768  0
				dm_mod                 32800  0
				

We are looking to see that the zaptel and libpri modules are loaded. Your output may be different from what is shown above. You will be required to unload whatever modules you have loaded. The rmmod command can now be used to remove these modules from memory.


rmmod zaptel
rmmod libpri

Now we must recompile the drivers. We want to change to our zaptel source directory (ie. /usr/src/zaptel/). The first command we run will clean out any previously compiled drivers and get the directories ready for our new drivers. The second command will then compile the drivers and install them into the appropriate directories for us.


make clean
make install

Follow the same procedure for libpri if you need to recompile that. Once the drivers are recompiled, you can then load them into memory using the modprobe command.


modprobe zaptel
modprobe libpri

[someone should probably verify this works like this, and document any common problems people have with recompiling and installing the modules into memory]

Updating Asterisk with make update

Updating Asterisk is actually very simple. All you need to do is a make update in the /usr/src/asterisk/ directory. This will update Asterisk from the CVS server, compile and install for you. After that is done, simply restart Asterisk for the new changes to take effect.