Posts Tagged ‘server’

My Server

16, March 2011

Laptop Server
The Server I use is an Aspire Laptop, 5633WLM Core 2 Duo T5500 1.66 GHz with 1Gb of RAM with a missing screen [don’t ask] with a standard install of Xubuntu. I’ve built a rack so that it stands upright so save space and it is linked to my monitor via a KVM switch. It runs an Apache web server, an Apt cache server, backup server to an attached USB Hard Drive, the Folding@Home application, Torrent Server, a bunch of other cron run scripts and the Mediatomb Media Server.

Home Server

Home Server

Apt Server
Apache Server
Torrent Server

Apache Server [simple]

1, December 2010

So I wanted to have a web album of my photos on my local network so needed my server to be able to serve up the web pages.

install apache;

$ sudo apt-get install apache2

open your favorite web browser and type http://localhost into the address bar, if it work you should get a page saying so.

Now stop the service with;

$ sudo /etc/init.d/apache2 stop

and edit to config file with;

$ sudo gedit /etc/apache2/sites-available/default

amend the directory path to your site from the default /var/www/localhost/htdocs to something like /home/bob/www/localhost/htdocs so that you can find and add docs without being root etc. Add your site index.html file to this folder and restart the service with;

$ sudo /etc/init.d/apache2 start

and point your browser at the site again with http://localhost or http://my_servers_name if you have given your server a host name on your network.

Sheevaplug – automount USB drive at boot

17, February 2010

The problem with the Sheevaplug is that it boots too damn fast and the USB drive is too slow to be available for the fstab mount.

The solution, see here for my post on setting up the fstab file to mount your USB drive. When you edit the fstab on the Sheeva you will find it empty but you should end up with an entry similar to this.

/dev/sda1 /mnt/usbdrive ext3 auto,user,rw,exec 0 0

My usb drive is mounted at /dev/sda1 and I created a mount point called /mnt/usbdrive, the drive is formatted as ext3 but you can replace this with the format of your drive or just replace with the word auto for it to check.

Once you have your fstab in place you need to create a script which will slow down the boot for the USB drive to start. Thanks to restamp on the forum see here for the solution.
First navigate to the init.d folder, in a [Terminal] issue the command;

cd /etc/init.d

then using whatever text editor you have installed [I added nano], open a file called wait4usbdrive with;

nano wait4usbdrive

then copy into it restarts script;

# If /etc/fstab has been configured to mount a USB drive, pause to give
# the USB drive devices time to show up in /dev. If this is not done,
# will fail, requiring manual intervention…
case "$1" in
grep -q ^/dev/sda /etc/fstab &&
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
[ -b /dev/sda ] && exit 0
sleep 1
exit 1

Then make it executable with;

chmod +x wait4usbdrive

Then link it to the rcS.d folder with this command;

ln -s ../init.d/wait4usbdrive /etc/rcS.d/S25wait4usbdrive

Now you can shutdown and restart the plug and the USB drive should now auto-mount. My USB drive is a 1.5 TB iomega with it’s own power supply.


20, December 2009

Just decided to give Folding@Home a try, it’s a project which uses the spare processing time of thousands of private users PC’s to process calculations which help scientists study disease and in time cure them. More information can be found on the Folding@Home site. The project is run of the client PC’s using software which can be downloaded from the site for various o/s. The software then downloads sections of work from the project servers, works on the section using your PC’s spare processing time then uploads the results before downloaing another section to work on. As a user you gain points for the work your PC completes which you can then either assign to your own “Team” or join another Team of users. You can then track your personnal/Team results. I have decided to join the Team Ubuntu which has an id of #45104. First you need a user name, check that yours is unique by checking it here.

I have decided to use my server to help this project when it is not processing work for myself. The server is currently running a 32bit version of Ubuntu Jaunty [v 9.04]. I therefore downloaded the 32 bit version of the Floding@Home software from the above site currently at version 6.02 [20/12/09]. I then created a new Directory called Floding@Home in my home Directory and extracted the contents of FAH6.02-Linux.tgz to this Directory.

I then opened a [Terminal] and cd to the new Directory.

~$ cd Folding@Home

Then ran the following;

~/Folding@Home$ sudo ./fah6

This then asks the following questions;

User name [Anonymous]? Type in your username, then press [Enter].

Team Number [0]? Type in the number 45104, then press [Enter].

Passkey []? Leave blank, press [Enter].

Ask before fetching/sending work (no/yes) [no]? to make things automatic, leave at no and press [Enter].

Use proxy (yes/no) [no]? I’m not behind a proxy, so I left at no, and pressed [Enter].

Acceptable size of work assignment and work result packets (bigger units may have large memory demands) — ‘small’ is <5MB, ‘normal’ is <10MB, and ‘big’ is >10MB (small/normal/big) [normal]? again I left at the default of normal, and pressed [Enter].

Change advanced options (yes/no) [no]? and again left at default, pressing [Enter]. The program then ran, updated, downloaded the first batch of work and started to process…..

Note: works in Ubuntu Jaunty v9.04.

An Apt Server using apt-cacher-ng

17, May 2009

I decided that due the increasing number of PC’s and laptops in the house all requiring the same package downloads from Ubuntu that downloading them once to a server and then serving them onto the various other machines was a better use of my broadband bandwidth. I therefore decided to install apt-cacher following this post with some changes, the main one being I used the Debian version of apt-cacher called apt-cacher-ng.

The PC I used for this is a laptop with a missing screen [don’t ask] with a standard install of Ubuntu.

First install apt-cacher-ng by copying & pasting the following into a terminal after the prompt;

sudo apt-get install apt-cacher-ng

and test that the service is running by typing this to http://your_server_name:3142/apt-cacher-ng into your web browser changing the your_server_name to the name of your server or it’s ip address. When I installed Ubuntu on my server I called the PC bob during the installation therefore I used http://bob:3142/apt-cacher-ng. You can also use http://[localhost]:3142/ the page that gets displayed is an error page with info. and links to various web pages.

If you want to change any of the settings in the apt-cacher config file then, copy & paste the following into your Terminal;

sudo gedit /etc/apt-cacher-ng/acng.conf

I changed the location of the Cache directory so that it was outside my o/s partition and within my home partition as the folder get quite large. If you do this then you need to change the permissions on the folder to add the apt-catcher-ng user group.

sudo chown -R apt-cacher-ng.apt-cacher-ng /Path/To/Your/New/apt-cache-archive

you can now update the repository source list on the server & all the client PC’s or add the redirection in /etc/apt/apt.conf.d/.

Redirection Method

adding a file called 02proxy to /etc/apt/apt.conf.d/ to redirect apt/synaptic requests via server to apt-cacher.
In a Terminal;

touch ~/02proxy

this creates a file called 02proxy in your home folder.

echo ‘Acquire::http { Proxy “http://bob:3142&#8221;; };’ >> ~/02proxy

change bob to your server name, this adds the line Acquire::http { Proxy “http://bob:3142&#8221;; };  to the file

sudo mv ~/02proxy /etc/apt/apt.conf.d/02proxy

this moves the file from your home folder to /etc/apt/apt.conf.d/

now go to “continue from here” below.

The source.list Method

Backup first In a terminal copy & paste;

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

to make a backup of the list in the same directory, then there are a couple of options to amend the sources.list file;

Option :1

sudo gedit /etc/apt/sources.list

when this opens you need to insert your_server_name:3142 in every line, i.e.

deb Jaunty main restricted


deb http://your_server_name:3142/ Jaunty main restricted

which made mine look like this;

deb http://bob:3142/ Jaunty main restricted

you can use the search and replace option in gedit to make this a faster process then save and close it.

Option :2

Another option is to open a Terminal and type;

sudo sed -i ‘s/http:\/\//http:\/\/bob:3142\//g’ /etc/apt/sources.list

this uses sed to search for the string http:// in each line of the sources.list file and replace it with http://bob:3142/, you just need to replace bob with the name of your server.

continue from here;

now restart the apt-cacher-ng

sudo /etc/init.d/apt-cacher-ng stop

sudo /etc/init.d/apt-cacher-ng start

if you get a permissions error here check the permissions on your new apt archive folder.

and update the source list with

sudo apt-get update

to update the package list.

if you get errors it’s worth rebooting the PC and trying again especially if you changed any details in the conf file.

Once the update has run you should see that it has placed several directories and files in the Cache directory at /var/cache/apt-cacher-ng or wherever you moved it too.

Now go to your client PC and after updating it’s source list run the apt-get update command to make sure that works ok.

Now we need to import any existing packages in the servers apt-get cache into the apt-cacher-ng cache, so copy and paste into a Terminal;

$ test -x /var/cache/apt-cacher-ng/_import || sudo mkdir -p -m 2755 /var/cache/apt-cacher-ng/_import

change the path if you have moved the cache ddirectory, this creates a new directory called _import within it.

Now in a Terminal;

$ cd /var/cache/apt/archives

import the old packages with:

sudo  cp *.* /var/cache/apt-cacher-ng/_import

Now open the apt-cacher-ng info. page at http://your_server-name:3142/acng-report.html

scroll down to the bottom of the page and hit the import button. After a while the import should finish and you should notice an increase in the space in the disk space that the cache directory takes.

You can now remove the _import directory with;

$ sudo rm -fr /var/cache/apt-cacher-ng/_import

and the old apt cache with;

$ sudo rm -fr /var/cache/apt/archives/*.deb

to save space.

Now download a different packages on each of your PC’s so that you can check each PC’s downloads are going into the apt-cacher-ng cache on the server. The only way I found to do this was to check the number of files in the cache at /var/cache/apt-cacher-ng using properties then add a package and re check to see if the count increased.

The apt-catcher-ng service produces a report at http://your_server_name:3142/acng-report.html i.e. mine is at http://bob:3142/acng-report.html.