Simon Bennett

Web Developer

Web Development Simon Bennett

Blog

Testing Debian and Ubuntu Harddrive Speeds


Sometimes it is intresting to test the speed on hard drives. Its useful for finding out how well a raid array or a SSD is really doing.

First Install hdparm

sudo apt-get install hdparm

Then simply run the command

sudo hdparm -tT /dev/md1p1 /dev/md0 /dev/sda1

My results

/dev/md1p1:
Timing cached reads: 22120 MB in 2.00 seconds = 11073.65 MB/sec
Timing buffered disk reads: 758 MB in 3.00 seconds = 252.58 MB/sec

/dev/md0:
Timing cached reads: 21750 MB in 2.00 seconds = 10887.78 MB/sec
Timing buffered disk reads: 468 MB in 3.00 seconds = 155.92 MB/sec

/dev/sda1:
Timing cached reads: 22142 MB in 2.00 seconds = 11084.49 MB/sec
Timing buffered disk reads: 638 MB in 3.00 seconds = 212.57 MB/sec

/dev/Md1p1
A raid 10 array. Bosting the best results on the server

/dev/md0
A raid 5 array, explaining why its a little slower. Running file system on-top of the raid without a partition, woops!

/dev/sda1
A really old Kingston SSD, still impressive.

Moving files up a Directory Unix/Linux/Mac


One of my favourite commands out there. Sometimes you want the all the contents of a folder to its parent directory. This simple command does it with out leaving hidden files etc behind.

mv * .[^.]* ..

Simple SSH Tunnel (SOCK4, MAC)


There is a time everyone needs to use a proxy whether its to get behind a firewall or to protect against  insecure wifi.

On the mac its a very easy process. You will need a server running openssh-server to connect to.

  • Open terminal on the mac and enter
  • ssh -D 8080 -C -N user@server.com
  • Once you have entered your password to the server your using your ready to inform your mac
  • Open System Preferences > Network
  • Click Advanced for the networking interface your using
  • Click the Proxy Tab
  • Enable SOCKS Proxy and enter proxy server as 127.0.0.1 port 8080 (see photo for help)
  • Click okay and then apply

Screen Shot 2013-04-15 at 15.08.40

Now when you browse the internet it will use the proxy. Always worth checking your ip address to make sure its working before you go and do anything important. You can also set other programs to use the proxy (though skype does not seem to play ball and use the

The new server


Currently I have an array of servers hanging about all over the place doing individual jobs. (Virtual Machines , router, file server, backup server). I have decided to combine them all in to one setup that can run everything.

This new server needs to deliver all these features in just one high performance (ish) server. Now I could have gone and got myself a nice rack server or the like for the job, but after owning a couple and releasing just how annoying they are. After starting a couple of them up in my uni out my housemate walked in and asked if I was watching the F1 due to the stupid turbo fans.

Requirements

  • Lots of space!
  • Ram!
  • Speedy boot drive
  • Cores
  • Dual Gigabit Lan
  • Quite!
  • Look good

Specs

Harddrives
The server will have a SSD boot drive 64GB kingstone (old). Then 2 raid arrays. 4*1TB raid 10 and 3*2TB raid 5. Given harddrive space of 10TB + 64gb boot!

To power that I Will have to get a PSU with enough stat connections. It does not need to be too powerful as it will not have a graphics card to eat up the amps.

Motherboard + CPU + Ram
To get all this connected I needed a motherboard with enough connections plus a good CPU. To get round this issue I went back in history to 2008 and got a first gen i7 920. The motherboard a gigabyte ga-ex58-ud5 has all of the connects I require with 10 Sata post, dual lan and up to 24gb of ram in 6 slots.

The board allows for clocking which means I can have the 4 cores clocked to about 3.9ghz. I may play with the turbo booster so it only clocks when it requires it (starting up virtual machines).

wpid-IMAG1238

The Case
Currently in the post a Fractal Design Define R4. Will review it when it arrives but looks like the best item for the job. Till then read this review from Dawfreak

The Build
As parts are still in the post, the build will be posted about once I can start.

New Server


If your reading this blog post, It means the DNS have moved across to my new linode.

I decided it was time to start again. Setting up the server correctly from the ground up. Starting with HTTP servers. The server is bound to two ip address.

Apache is listening on one of the IP’s and Nginx is on the other. This means through DNS I can set up which websites I want running through nginx. Currently this website is the only one running though it. The websites were I get most traffic will be moved but there is no real rush. The only goal is to leave the other linode so I don’t have to pay for two running.

Update: During the swap no clients noticed any downtime 🙂

Install PHP5 without Apache


When you install just PHP5 on a debian server the install depends on apache. This is no good if you simply want php5. PHP5-CGI will install the depends that would otherwise be fulfilled by apache. This command in this order will solve this issue.

  • sudo apt-get install php5-common php5-cgi php5-cli php5

Install VirtualBox Guest Additions Debian


Install virtualbox guest additions on debian has benfits with the most inportant being with multi cores. Debian will not see the cores you give the it with out them. Guest additions is easy to install.

From the guest computer

  • sudo bash
  • apt-get update; apt-get upgrade
  • apt-get install build-essential module-assistant
  • m-a prepare
  • In your Virtual Box Manager , Click install Guest Additions
  • mount /media/cdrom
  • sh /media/cdrom/VBoxLinuxAdditions.run
  • Follow the bouncing ball to finish

How to install VirtualBox with PHPVirtualBox on Debain 6 Squeeze


Long gone of the days of having many physical servers dotted account the place, I now run a ex i7 desktop machine as a virtualization host. I can’t take credit for all of this guide as my friend Tom Needham’s help refine and create easy to follow list of instructions.
Screen Shot 2013-01-30 at 12.30.16

These steps were performed on a fresh install.

Step 1 – Add Virtualbox Source to source list

  • nano /etc/apt/sources.list
  • deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free
  • Add the virtualbox public key (as root, sudo does not seem to work)
  • wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add –

Step 2 – Install VirtualBox 4.2

  • apt-get update
  • apt-get install  linux-headers-$(uname -r) build-essential virtualbox-4.2 dkms

Step 3 – Download and Install Extension Pack

  • Download from https://www.virtualbox.org/wiki/Downloads
  • Then run command:
  • VBoxManage extpack install file.vbox-extpack

Step 4 – Initialise Virtual Box

  • /etc/init.d/vboxdrv setup

Step 6 – Download and Install PHPVirtual Box

  • I just use apache here with php but you can decide
  • apt-get install apache2 libapache2-mod-php5
  • cd /tmp
  • wget `wget -q -O – http://phpvirtualbox.googlecode.com/files/LATEST.txt` -O phpvirtualbox-latest.zip
  • apt-get install unzip
  • unzip phpvirtualbox-latestzip.zip -d /var/www
  • cp /var/www/config-example.php /var/www/config.php
  • nano /var/www/config.php
  • Edit the username and password for the account to control Virtual box (yours or make one)

Step 7 – Set up Virtualbox Web service

  • Make new file
  • nano /etc/default/virtualbox
  • with content (edit username)
  • VBOXWEB_USER=username
  • Start web service up
  • /etc/init.d/vboxweb-service start

 

Uni Server Setup


Accuse me of being a geek if you wish. Here is a photo of my UNI server and network setup.
IMAG1139

The server on the left hand side manages all my virtual machines, were the server on the right has a large file system used for backups, as well as music collect. (Even though I am really in to 2u.fm at the moment).

The setup works well, and runs all on a gigabit network. The excess network cables go to printer, laptop, desktop, and a WIFI spot.

Install Arduino IDE in Ubuntu


Install Arduino on Ubuntu

I have just installed Arduino IDE on Ubuntu, I can’t take credit for any of these steps I used this guide here.  Only hope to make it faster and easier for you.

Install the packages you need.
sudo apt-get install gcc-avr avr-libc openjdk-6-jre && sudo update-alternatives --config java

Once they have all installed you can plug your Arduino in and type in to terminal dmesg. You will see it running :).

We need to chmod the dev to be able to connect with out being root. Hint: If you run dmesg as root it will tell you the device name

sudo chmod a+rw /dev/ttyACM0

And to make this permanent, then when you restart it should work :).

sudo usermod -a -G dialout username
sudo usermod -a -G uucp username

Now you can download Arduino IDE from Arduino’s download page.
tar xzvf arduino.tgz
cd arduino folder
./arduino

1 2 3 4