Robot Yacht is a fully autonomous sailing vessel tasked with sailing around the Island of Corsica unmanned, with little or no human intervention...

Setting up Apache Properly

Posted: February 17th, 2009 | Author: admin | Filed under: linux, software, web | Comments Off

So we should have just installed the apache package using apt-get. Apache will run by itself automatically and by rights shouldn’t need anything doing to it. However, when we restart, the read-only file system will cause Apache to fail as it cannot write to it’s log files. Apache will also through up another error:

Could not reliably determine the fully qualified domain name...

Both of these problems can be fixed relatively easily. Lets look at the log files first.

Changing the log file

Voyage is set up pretty well, it has a small read/write portion that can be used and log files will work if they are in the /var/log folder. They have to be in this folder and not inside another folder within /var/log. By default the apache log files are as follows:

ErrorLog /var/log/apache2/error.log
Which is no good as it isn’t directly in the /var/log folder. To change this we must edit the configuration files. The config files are located in the following folder:
/etc/apache2

We can use nano to edit the following files; apache2.conf & sites-available/default. Within these files we need to search for all cases of .log as there are more than one type! Nano can search by typing [ctrl]+[w]. Search for .log and replace any occurrences (I had three!) The replacement strings are below:

In apache2.conf

ErrorLog /var/log/apache2error.log

In sites-available/default

ErrorLog /var/log/apache2error.log
CustomLog /var/log/apache2access.log combined

That should fix the error log problem, now for the fqdm (Fully Qualified Domain Name) issue.

Setting up hosts

The first thing we need to do whilst we are still in the apache2 folder, nano httpd.conf then we need to add a couple of lines:

ServerSignature Off
ServerTokens production
ServerName RobotYacht

The first two lines tighten up Apache’s security and make sure it doesn’t give out too much information. The last line tells apache what the server is called which seems to make it much happier!

Now we need to edit or create a hosts file. My installation of voyage didn’t include a hosts file so i needed to make one! The hosts file lives in /etc so we need to change directory. Then we create or edit the existing file by typing

nano hosts

We now just need to add a couple of lines (replace robotyacht with the hostname you set!)

localhost.robotyacht localhost
127.0.0.1 localhost.robotyacht localhost

Now just save and next time you reboot, apache should run like a dream!


Setting up Voyage – installing packages

Posted: February 16th, 2009 | Author: admin | Filed under: linux | Comments Off

You probably noticed we used the apt-get command to install Nano, well we can install a huge number of packages and we can also use apt-get to uninstall packages…

apt-get install packagename
apt-get remove packagename

Fairly self explanatory really!

Robot Yacht needs quite a few additional packages which we will install now and set up later… These first three will be used to set up a web-server that will host information over Robot Yacht’s wireless network and at a later stage over the internet.

apt-get install apache2
apt-get install php5
apt-get install mysql-lite

Apache is the standard in web servers – nearly every website on the internet is hosted using apache. PHP5 is a scripting language very similar to perl, but built from the ground up for web use. MySQL-Lite is a version of MySQL Database that stores its data in flat files – this will be very handy for storing data from instruments such as a GPS.


Setting up Voyage – Basic Networking

Posted: February 16th, 2009 | Author: admin | Filed under: linux, networking | 2 Comments »

Connect to a wireless network

wifi

This will probably only work if you have a very similar system to what I have set up. This should work if you have an Atheros card and your wifi is protected by a WEP key. WPA gets more complicated…

wlanconfig ath0 create wlandev wifi0 wlanmode sta
ifconfig ath0 up
iwconfig ath0 essid "YOUR NETWORK SSID"
iwpriv ath0 authmode 1
iwconfig ath0 key 1234123412341234
dhclient ath0
The first line creates the ath0 device, the second turns it on, the third tells it which network to connect to, the fourth sets the authmode which is hardly ever anything but 1. The second to last line sets the WEP key and the last line tells the box to ask the network connected to ath0 for an IP address using DHCP. Phew!
You should be able to prove your box can connect to the internet by sending a ping:
ping google.com
to stop pinging type [ctrl]+[c]

Change the Hostname

You have probably noticed the command prompt says:

voyage:~#

This is the computers Hostname and we want to change it – not only could you have more than one Voyage box on your network, but we want something more memorable! Remember your computer can be accessed at http://hostname/ on your local network – we’ll set this up later.

To change the hostname, we need to edit a file. Files can be edited using a number of editors, I tend to use Nano, which is not installed as standard. To install we need to type the following commands:

apt-get update
apt-get install nano 

The first command updates the database for available packages, the second installs the one we want. The box needs to be connected to the internet before this will work!

Make sure you set the file system to read/write (remountrw) before you try editing any files otherwise you wont be able to save your changes.

nano /etc/hostname

Make the changes and then press [ctrl]+[x] to save the file.

Reboot the system for the changes to take effect.


Setting up Voyage – Users and Passwords

Posted: February 16th, 2009 | Author: admin | Filed under: linux, security | Comments Off

Change the default password

First and foremost the default password for the root user needs to be changed!

To do this you need to log in using the default user/password.

voyage login:root
Password:voyage

You should now be greeted by the following:

voyage:~#

To change the password first we need to remount the system as read/write (it defaults to read only to protect the card)

voyage:~#remountrw

To change the root password, simply type: 

voyage:~#passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated sucessfully

This is the most important user on your computer as it has control over EVERYTHING! Lets make sure we set a good password! To test that it works we can logout by typing:

logout

users-256x256

Create a new user

We don’t really want to be using the root user for everything so we can set up a new user (fred) using the following command:

useradd fred

Make sure you are logged in before you try this! We can also set Fred’s password by using the passwd command:

passwd fred


Voyage Linux – fitting name, fitting linux

Posted: February 16th, 2009 | Author: admin | Filed under: linux | 2 Comments »

The chosen operating system for this project is Voyage Linux. Voyage is a light weight build of Debian and the excellent package management system has passed from Voyage’s big brother. This is an almost perfect operating system for the project because it requires just 128mb of storage on the Compact Flash card, but retains the power and expandability of a much larger distribution.

Installing Voyage

Voyage is not like any operating system that I have come across before, it requires another operating system to build the distribution and copy onto the CF card. Looking at the readme file for Voyage, I thought that I could use OSX (on my iMac) to build the distribution, this did not work – no idea why…

So looks like I need a copy of Debian. This was easily achieved by using Parallels Desktop to run Debian as a virtual machine on my mac. The install of Debian was very straight forward.

What was not so straight-forward was getting Debian to detect the CF card. Took quite a bit of effort and a restart of Debian – may have been the restart that fixed the issues!

Then debian is used to format the compact flash to ext2 format using fdisk.

Then voyage.update is fired up and the on screen instructions are followed. There are 5 settings, where is the distribution source code, where is the compact flash, what kind of board are you installing it on (selected ALIX!), the bootloader (grub didn’t work on the first attempt so went for lilo) and what console configuration you require (I chose console not serial as I have a VGA output!) then copy the files to the card and exit.

The install took less that 5 minutes.

Pop the compact flash into the ALIX board and boot up!

voyagemotd

For info: I installed Voyage 0.5.2 which has since been outdated by Voyage 0.6

More info about Voyage can be found at http://linux.voyage.hk/