I know I’ve blogged this before, but these are the steps I took most recently to get Asterisk running on a fresh Ubuntu Server (Dapper) installation. The instructions will also work on Feisty or Gutsy server.

# apt-get install linux-headers-`uname -r` build-essential libssl-dev libncurses5-dev libspeex-dev sox sox-dev
# mkdir /usr/src/asterisk
# cd /usr/src/asterisk
# wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.18.tar.gz
# wget http://downloads.digium.com/pub/zaptel/zaptel-1.4.9.2.tar.gz
# tar -vzxf zaptel-1.4.9.2.tar.gz
# cd zaptel-1.4.9.2.tar.gz
# ./configure
# make
# make install
# make config
# cd ..
# tar -vzxf asterisk-1.4.18.tar.gz
# cd asterisk-1.4.18
# ./configure
# make
# make install
# asterisk
# asterisk -r

If all goes well, you should see the Asterisk console.

Note: I am not 100% sure which repos have the packages mentioned, but I had the universe and multiverse repos added so my sources.list for apt.

It was a pain, but this ought to work:

# apt-get install kde-devel automake1.9
# tar -vjxf /home/priddle/Desktop/projectmanager-0.1.2-24.tar.bz2 -C /usr/src/
# cd /usr/src/projectmanager/
# ./configure --prefix=/usr
# make
# make install

I just did a clean install and I’m determined to keep it that way. So I removed these packages after:

cervisia cvs gettext-kde hspell kappfinder kapptemplate kbabel kbugbuster
kcachegrind kde-core kde-devel kdebase kdebase-dev kdelibs4-dev kdesdk
kdesdk-kfile-plugins kdesdk-kio-plugins kdesdk-misc kdesdk-scripts kmtrace
kompare kpager kpersonalizer kspy ktip kuiviewer kunittest libacl1-dev
libapr1 libaprutil1 libarts1-dev libartsc0-dev libasound2-dev libaspell-dev
libattr1-dev libavahi-qt3-dev libbz2-dev libcvsservice0 libidn11-dev
libjasper-dev libkonq4-dev liblua50-dev liblualib50-dev libogg-dev
libopenexr-dev libpcre3-dev libpcrecpp0 libsasl2-dev libssl-dev libsvn1
libtiff4-dev libtiffxx0c2 libvorbis-dev libxml2-utils libxslt1-dev lua50
poxml qt3-designer subversion umbrello

So I learned yet another awesome feature in vim today - code folding.

For those of you who don’t know what I’m talking about, code folding lets you shrink the contents of multiple lines of code into 1 line. A lot of the better code editors out there do it, like Dreamweaver and ZendStudio. It’s a handy feature when you have scripts with hundreds of lines of code.

There are several ways you can fold a portion of code in vim. You could type 10:fold for instance, and the 10 lines under the cursor would be folded. You could also specify the start and end lines manually with :[start line],[end line]fold

An easy way I saw to do this, is to use Shift+V in command mode. This will let you highlight lines of code. So it’s as simple as pressing Shift+V then the down arrow until you’ve highlighted a section of code. Then you can press zf to fold (or type in :fold).

Cool right? There’s one more thing I did to keep these folds from session to session - normally folds will disappear after you close vim unless you create what is called a view. I found a page on vim.org that explains how to do this automatically. Just add these lines into your ~/.vimrc file:

autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview

This will save your folds when you exit a document and load them when you open it.

Happy folding!

I figured out this easy way to make a backup over ssh.

ssh remoteserver "cd source/dir && tar -vzcf - ." > yourbackup.tgz

You can also do this (not sure if it really makes a difference)

tar -vzcf - . | ssh remoteserver "cat > yourbackup.tgz"

I did this about 8 months ago and never wrote down my steps. I just had to figure it out again for another server, and thought I’d write it down here to save myself (and possibly someone else) time.

First, this requires you have SSH access to your host. If you don’t, this post wasn’t meant for you. Then again… you probably wouldn’t need vim7 if you didn’t. Anyway, open a shell and enter these commands:

$ mkdir -p ~/local/src
$ cd ~/local/src
$ wget ftp://ftp.vim.org/pub/vim/unix/vim-7.1.tar.bz2
$ tar -vjxf vim-7.1.tar.bz2
$ cd vim71
$ ./configure --prefix=$HOME/local
$ make
$ make install

Vim is now installed in $HOME/local/bin/vim. To use that instead of /usr/bin/vim (your webhost’s OLD vim), open ~/.bash_profile (create it if it doesn’t exist) and add $HOME/local/bin to the front of your path. My path looks like this:

export PATH=$HOME/local/bin:$PATH

That will look for any programs in $HOME/local/bin first. If they’re not there, move on the the system defined path to look.

Note: When I did this, vim wasn’t importing /etc/vimrc, so I had to copy it to my home dir.

$ cp /etc/vimrc ~/.vimrc

You’ll likely need to make some edits so everything works/looks how you want.

So I decided today I was going to make a DVD backup of my music collection. I also decided I was going to use rar to do this.

After about an hour of googling, I had come up with

$ rar a -r -v2100m -vn -m0 -tk -ri15 ~/music-2007-05-26 music

That seemed to work perfectly. The a is for add, r is for recursive, v2100m says split into 2100mb files, vn simply says to call the file .rar, .r00, .r01 rather than file.part1.rar, file.part2.rar, m0 says not to use compression, tk maintains the date on the file, ri15 says to run as the highest priority on the system.

I got halfway done and decided to check a rar. So I ran rar e music-2007-05-25.rar and found that the files were there, but none of the directories had been copied. So I stopped the process and tried just about every switch I could find. Another hour of googling - and I find out that rar e does that, rar x maintains the directories.

I really hate linux some days. What a waste of time that was.

I just had a hell of a time trying to unzip a bunch of zip’s on Linux.

Long story short, to unzip all zip files in a directory run unzip \*.zip

You can use -o to overwrite files with the same filename without being prompted, or -n to never overwrite files.

I’ll need this later… I’m sure.

Installing Thunderbird 2 on Ubuntu was cake.

sudo apt-get build-dep mozilla-thunderbird
tar -vzxf thunderbird-2.0.0.0.tar.gz
sudo mv thunderbird /usr/lib
sudo ln -s /usr/lib/thunderbird/thunderbird /usr/bin/thunderbird

Then, just go to System > Preferences > Menu Layout, and add a new application launcher in Internet. The command is /usr/bin/thunderbird and the icon is in /usr/lib/thunderbird/icons/

Enjoy.

It took forever, but this ended up working to get Asterisk to compile:

apt-get install libssl-dev libncurses5-dev libspeex-dev sox sox-dev \
  build-essential manpages-dev libasound2-dev ssh \
  linux-headers-2.6.15-23-server

Fuck Fedora.

I’m having trouble getting the required MySQL Perl mods installed so I can use MySQL with Asterisk… but I guess I’ll figure it out sooner or later.