Initial VPS setup

27 November, 2008

Initial VPS setup

    – Add normal user account
        – adduser <username>
        – Generate ssh keys
            – ssh-keygen
        – Add other ssh keys to ~/.ssh/authorized_keys
            – change permissions chmod go-rw authorized_keys
    – Disable root login
        – /etc/ssh/sshd_config
            – PermitRootLogin no
    – Add the bzr ppa to /etc/apt/sources.list
        – #bzr
        – deb hardy main
        – deb-src hardy main
    – In order to install the latest and greatest bzr 1.9 at the time of writing the updates repo needs to be added also.
        – deb hardy-updates main
    – Install bzr
        – mkdir vc
        – cd vc
        – bzr init-repo bzr
    – To give bzr a little more room to breath create another swapfile and activate it
        – dd if=/dev/zero of=/swapfile bs=1024 count=196608
        – mkswap /swapfile
        – swapon /swapfile
        – Add the following to the fstab file so that the swapfile will be available after a reboot
            – /swapfile       none           swap     sw                         0 0            
    – Fix the locale problem (i386)
        – apt-get install language-pack-en
    – Edit the sudoers file by adding the following line
        – <username> ALL=(ALL) ALL


Building Liquid State Machine on Centos 4 64-bit

12 November, 2008

download the lsm toolbox from here:

unpack it to your working directory

Before trying to build the lsm toolbox you need to check that you have access to the gcc4 compiler from within your working environment, you can check this by:

$gcc -v

Which should return something similar to this

Using built-in specs.

Target: x86_64-redhat-linux

Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –enable-checking=release –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –with-gxx-include-dir=/usr/include/c++/3.4.3 –enable-libgcj-multifile –enable-languages=c,c++,java,f95 –enable-java-awt=gtk –disable-dssi –with-java-home=/usr/lib/jvm/java-1.4.2-gcj- –with-cpu=generic –host=x86_64-redhat-linux

Thread model: posix

gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)

Should you not have the gcc4 complier installed you need to install the package gcc4-4.1.2-14.EL4 and usually create a sim link in your ~/bin folder to ensure that the version 4 compiler will be picked up first.

cd ~/bin
ln -s /usr/bin/gcc4 gcc
export PATH=/home/<username>/bin:$PATH

Now that the build environment is sorted out its onto the actual process of building the lsm toolbox. So, edit the Makefile in lsm/csim/src change the default build rule to

default: version.i filepermissions csim.mexga64 install.m

The default build rule should be around line 135 in the Makefile. Depending on where matlab is installed the file paths which are hardcoded in the build file may need to be changed. In this example using the vim regular_expression to change the path from /usr/local/matlab to /opt/matlab/ins


Now move to the csim directory and run the make command as normal.

Should an error similiar to the quote below occur,

Invalid MEX-file ‘/home/<username>/<working directory>/lsm/csim/csim.mexa64′: /opt/matlab_sp3_64/ins/bin/glnxa64/../../sys/os/glnxa64/ version `GCC_4.2.0’ not found (required by /usr/lib64/

The solution to seems to be to move the file out of the way so that matlab will use the system one first. The file can be moved via the normal unix command ‘mv’ as shown below.


Book Meme

11 November, 2008

Jumping on the meme train:

“HeadFirst: Does that mean you can refer to only one dog” Head First Java

  1. Grab the nearest book.
  2. Open it to page 56.
  3. Find the fifth sentence.
  4. Post the text of the sentence in your journal along with these instructions.
  5. Don’t dig for your favourite book, the cool book, or the intellectual one: pick the CLOSEST.