Servers and Whatnot

So I’ve been on a little fun into setting up a webserver. Using an old computer which uses a shuttle case + motherboard. This case and motherboard has been through a lot. Stuff taken in and out loads.

And the fan failing. That was fun. It kept overheating and after much playing around, we found that the fan on the cpu heatsink had died. Shuttle being nice and kind when they designed this heatsink, made a size fan that you can’t get anywhere. Instead, I got a generic case fan and duct taped it to the heatsink! Clever, eh?

So my server. What is it serving? Well, it’s backup server. Thanks to the backuppc package, all the computers will be backed up in my house. Every week a full backup is done. Followed up by a incremental backup each day. Backuppc is also very clever. If there are files that are the same across backups and computers, the file will only be stored once. I can’t backup my whole house yet though. This is because of the hard drive in the server. It’s only a 120GB one. That means I’m currently only backing up one computer as a test.

What else is my server serving? SSH. The first thing I did when I set up the server was install SSH. This is for two reasons. The server is now on top of a shelf somewhere else in the house with only power and an ethernet cable attached. SSH is my means of remote access. The other reason is so I can have a nice SSH tunnel when I go to sixthform in September. No more annoying school filters to me :-) Another part of my SSH server is a key based authentication. I decided that I didn’t really want to put my server out on the internet, if someone was able to bruteforce the password. Therefore, I have set up key based authentication and completely turned off Password authentication.

Quotas. I also managed to set these up. Just as a play around really. It was pretty simple to do:

  1. sudo apt-get install quota
  2. Open up fstab and pop in the usrquota option to the partitions that need to be quotaised
  3. Restart
  4. sudo edquota -u username
  5. The quota config for that user will show up. Under the blocks and inodes column, you are able to see what the current use of that user is.
  6. You are then able to edit the number of blocks (1,000 blocks = about 1MB) that the user can make under the first hard and soft columns.
  7. The second quotaing is the number of files which can be set under the second hard and soft columns
  8. Save and quit. You’re set!

What’s the difference between hard and soft quotaing you ask? From what I’ve read around the internet, a soft quota is one that limits the user slightly. The user is allowed to go over the soft quota. But only for a limited time, before they have to delete the files. The hard quota is a strict quota. You hit that quota, and that’s it. Delete the file or be able to do nothing!

And of course, to do my bit, my server is folding proteins. Slowly but surely…

Folding stats

Ruby on Rails Fun

Still my early summer holidays. Apart from the many household jobs my parents have instructed me to do, I’ve also be learning a new programming language.

I’ve be learning the great web development language known as ruby on rails. I’m not quite a 1337 h4xx0r at it yet, but hopefully one day! Or perhaps not. I’m not a 1337 h4xx0r at php and javascript and I’ve been using them for quite a while now.

Advantages?

I think this ruby on rails magic makes all this web development lark much easier because of the following things I’ve found so far:

Firstly, the “Model, View, Controller” way of running things. Ok. So this wasn’t easy to understand straight away. But as soon as it goes *click* in your head, it sure is amazing. I remember half heartedly trying to learn ruby on rails a while back and gave up pretty quickly because of the confusion from this MVC. If you want to learn ruby on rails, I do recommend getting a good book (I’ll talk about that in a minute), and also making lots of examples to remember what all the different components of MVC do.

Number 2 in ruby on rails features has to be Migrations for databases. Migrations allow you to easily synchronise database changes between developers of the web application. You make a change to the database that needs to be synchronised? Well then you setup a database migration step and the changes will be updated when the developer next runs db:migrate. Another good use for database migrations would be to easily manage the database states between the development and the actual deployment on a server. I can’t see PHP doing that with any great ease.

Number 3? Well… I don’t have a number 3! I’ve only got to page 100 so far. Actually 99. But still!

The elite book

Before starting to learn I spent much time trying to find the best book to guide me through learning the language. After browsing through the surprisingly small amount of RoR books on amazon, I found that the best beginners book is one that goes by the name of “Agile Web Development with Rails”. It’s a bit of a mouthful for a book title, but it surely is a great book. It is very well written and easy to understand.

The book takes you through building a project that is an e-commerce site. I find this is the best way to learn a new language and is what I’ve done for almost every other programming language I’ve learnt. I would have preferred for it to be a more useful project, such as a blogging system or something else. But looking at it now, I can see that an e-commerce system probably contains lots of different concepts that you will learn.

I’ve included a direct link to the amazon page for the book on the right, so if you are thinking about buying this book, please follow the link below to help support the running of my blog!

Take 97

Before you ask… No I don’t know why I chose 97 takes for the title! It just seems like that after the number of times I had to rerecord.

Having my summer holidays starting early, I’ve got to find things to fill my day with. Yesterday was “make the samba screencast” day.

New format as well. Full 720p HD format and also a little introduction at the start.

Here it is anyway, in all of it’s hd goodness:

Samba Filesharing

I seemed to be extremely slow in making this screencast too. It took me the whole day to make a 4 and a half minute screencast. I suppose. I wasn’t working on it constantly though.

So, in making the screencast I did the following things:

  • Planned my general script while running through it with a vm
  • Make a little presentation to start off the screencast
  • Get the transitions to work just right
  • Record the intro + presentation
  • Add audio
  • Record the content
  • Add audio
  • Record the ending
  • Add audio
  • Join it all together

Simple, eh? Not really. I kept bumping in to little problems whilst recording which annoyed me everytime.

And with the audio, if I say one word wrong, that’s it, I’d have to start again. Audacity seems to hate me. If I was to want to have a separate track to record to it would decide that the sound would be all broken up. Annoying I know, but I think I fixed it *after* I recorded all the sound. At least it should be better next time!

And today I found out that I forgot to include a part on changing the samba configuration file.

Oh well. Hopefully more will be on the way soon!

It’s good when things don’t work

Things going wrong. You’d expect this to be a bad thing. But I often find this a good thing. Why? Well it may take ages to fix a problem, but you learn so much in the process!

I persuaded my friend to use Ubuntu Linux a while back. So he went and installed it. He found that his wireless network card didn’t work, and there was no way it would work (even under ndiswrapper). So he went ahead and bought a nice wireless card from linuxemporium.co.uk. You’d think that they’d pick one that would work “out of the box”. Well, no! You get this awkwardly written guide (not good for newbies to linux). So I went ahead and re wrote it into simple talk. Great! It worked!

About a month later he decided to reinstall ubuntu and windows so that he could get the partitions right. So he went and did it and began to set up the wireless network card again. This time it didn’t work, even with my simpler instructions. So instead of getting me to help that much he decided he’d just get a nice ethernet cable instead.

Right. So he’s trying to get *everything* to work under ubuntu now. One of those things required his external USB hard drive. Simple you’d think. Plug it in and see it appear on the desktop. Unfortunately not. In this case it was, plug it in and see *nothing at all* happen. So he comes talking to me to ask for help. This is what I found out

  • The device was being recognised as sde – from dmesg
  • The device was not mounted – from mount
  • The device had partitions – from cfdisk /dev/sde

So, I go ahead and tell him to mount the disk manually.

sudo mount /dev/sde1 test

“Please specify a file system type”. Ok then.

sudo mount -t vfat /dev/sde1 test.

“Invalid file system type”. At this point my friend restarted into his windows partition, and the drive worked perfectly. During this time I had a google around and found that there might be an error on the drive. I don’t know much about fsck, but I gave it a go anyway.

fsck /dev/sde
Response: No FSINFO sector 1) Create one 2) Do without FSINFO

Ok then. We’ll press 1 and continue, even though I don’t know what a FSINFO sector is (but at a guess I’d say it is a sector that holds information about the file systems). After that part there were a few other messages like “Free cluster summary uninitialized (should be 10914208) 1) Set it 2) Leave it uninitialized”. We just hit 1 each time and carried on. But at the end of all of that we get a message saying “Leaving file system unchanged.“. I was asking myself why it isn’t saving the fixes, even though I told it to fix it. Ah well. Back to the drawing board.

After a few variations on the fsck command I came up with this nice one:
dosfsck -w -r -v /dev/sde1

So. Ran that. Hit 1 a few times. And tada! All fixed!

And now I know how to operate fsck more! Yipee!

In other news, it’s raining a bit here, and there’s a lot of thunder

/me hides

All this blogging lark

Well. I have myself a blog. How’d you like it? I’ve been wanting to get a blog up and running for months. Finally got around to it.

As you can see, I’m using wordpress, which I found terribly easy to set up. Puts my old WebspotBlogging to shame really.

Ah well