Really, Really simple file server - $0
Setting up a really, really simple file server at my house for a grand total out of pocket cost of $0.00.
Here is what I'll cover in this document:
1. Why I wanted a file server
2. What learning I did before I started
3. What hardware I used
4. What software I used
5. How I configured it
Why I wanted a file server - Bottom Line: Music, Photos, and Family Files
I mostly wanted it for photos and music. Both of these are problematic for us in the English house. We have three computers in the house. We have a desktop (with multiple user profiles), a laptop (with multiple user profiles, and a third laptop (running Linux). When I started this project, there was music and photos stored on multiple machines under multiple profiles.
I had purchased an external hard drive, which worked well for about a week. It did allow me to go around to all the computers and consolidate all the music and the photos. Then, it failed. Fortunately, I had consolidated all the data on the Windows desktop. Otherwise, I would have been back at square zero.
The other problem I had with the external drive was that it was not as portable as I wanted. Transferring files from the desktop, to the laptop, over the network, to the external drive was, to put it lightly, a slow nightmare.
What learning I did before I started – Bottom Line: Listen to Linux Reality.
I planned ahead. I think that's important. What I wanted to see in windows explorer was 3 network drives. I wanted one for music, one for photos (and the little bit of video we do), and one for documents. I drew it on a piece of paper. One was called Z: (FileCabinet). One was to be called M: (JukeBox). One was to be called P: (PhotoAlbum)
Now, I am not a Linux user of much experience. The last time I had a computer up and running Linux in the house was in 2002 – 2003. At the time, I tried out Fedora (version 2) and an early version of Ubuntu. But, I had a lot of trouble with it, and ditched the effort after a while.
Recently, I bought a laptop from Dell, and took the plunge back into Linux. I needed a laptop for school, and went looking on the Dell website. For $650, I got a nice Inspiron with Ubuntu pre-loaded. I have to say, the version that came from Dell works very well.
Once I bought the laptop, I knew that I'd need to do some learning, so I opened up my mind a bit. I found, by a friend's advice, the Linux reality podcast. Wow. This show is so great. The host is a guy named Chess, who has a friendly way of explaining things in English that are elsewhere only explained in the cryptic language of man pages. Listening to Chess' explanation of the Linux file system was like pulling the curtain on the Wizard of Oz. While every show I've listen to by Chess has been worth the time, the essentials are Episodes 2 – 4, 8 -9, 11, 12-15, 25 and 26, 37, 39, and 55 and 59. Episodes 25 and 26 are about windows networking, so I listened to them multiple times. episodes 55 – 59 are a pretty in-depth discussion of Linux servers (web, file, print, email, etc). I only really listened to the file server parts.
What hardware I used – Bottom Line: Recycle on old PC
My dad had a few unused PCs taking up space in his house. I had an old HP machine sitting out in the garage gathering dust. I asked my dad for his old computer, which he brought me.
Neither of the machines that I started with were capable of booting into windows. No matter. I didn't even try.
I opened both of the machines and went to work with a screwdriver. I disconnected everything that I wasn't going to use: 3.5” floppy drive, zip drive, CD/DVD writer. I left them in place, just disconnected the power. I pulled several cards from their PCI slots. There was a modem, a cable modem, a old TV receiver chip. I took them out. I found the most simple graphics card of the two machines, and plugged it in.
By the time I was done I had a machine that had a P4 processor, 130 GB hard drive, single network input, simple graphics card, and one CD/DVD drive.
What software I used – Bottom Line: PC Linux OS and SSH
What happened next was that time became a factor. I had only one day to get the system set up, and had spent half of it on hardware. I also did not have an extra keyboard, mouse, or monitor in the house. So, I needed to “borrow” them from the desktop and have them back in place by dinner time.
I had two live CDs in the house. One was for partedmagic, and the other was for PCLinuxOS. I used the partedmagic CD to wipe clean the hard drive. I then took the machine into the room where I was going to put it, plugged it in to the wall and to my network router/DSL modem, and booted the PCLinuxOS live CD. The CD worked without a hitch, and recognized my network and the internet connection. So, I hit the install icon, and walked through the install. All went smoothly.
I set up the root password, and added one user.
Next, I went to the package manager and installed OpenSSH. (This would allow me to log into the computer and get a command line interface from other machines on my network. On Linux, I can log right in with the “ssh” command. On windows, I can use PuTTy.) I started the ssh server. I did an “ifconfig” to find out what my IP address was. I tested the ssh portal from my Linux laptop. Once I saw that I could log in from the remote computer, I disconnected the monitor, keyboard, and mouse, and walked away.
I plugged the mouse and monitor back into the windows desktop and grinned. Aside from the “funny noise” in that room, you'd never know that I just set up the backbone of a file server.
How I configured it – Bottom Line: The Samba.conf file that worked.
Here's where I'll take some journalistic licenses. I'm going to put in the format of the samba share file that ultimately worked and let me mount the network drives onto the windows machines. Reading it, you may get the impression that I just did this the first time and that it worked. That would not be true. I had to mess around with it a few times before it looked like I wanted it to.
Needless to say, you'll need Samba. Specifically, the samba server. It came with PCLinuxOS, so I didn't have to install it.
I know I've already mentioned the Linux reality podcast. Episode 24 and 25 were essential. The best piece of advice that Chess gives is to make all of your user names and passwords the same. So, a windows user named “joe” with the password “hello” should be set up as a Linux user (using the “useradd” command) named “joe” with the password “hello”, and samba user name “joe” with the password “hello”. That makes it so easy!
I would up using just two user names and passwords. I used the same name for myself and my wife on each of the windows machines, and gave them the same passwords. Those are the same user names and passwords that I used in Linux and in Samba.
Here are the ONLY live (non-commented) lines in my samba.conf file. I've cahnged some of the names to protect myself, but this is all my samba..conf file has in it. There are a ton of things you can do with samba, and the default file I had was some 250 lines long with lots of comments to read. I wound up getting rid of all of it except for these.
[global]
workgroup = english_family
server string = samba
security = share
[JukeBox]
comment = Music
path = /home/travis/JukeBox
browsable = yes
writable = yes
create mask = 0774
directory mask = 0774
; preserve case = yes
; default case = lower
[FileCabinet]
comment = Files
path = /home/travis/FileCabinet
browsable = yes
writable = yes
create mask = 0774
directory mask = 0774
; preserve case = yes
; default case = lower
[PhotoAlbum]
comment = Pictures
path = /home/travis/PhotoAlbum
browsable = yes
writable = yes
create mask = 0774
directory mask = 0774
; preserve case = yes
; default case = lower
At that point, all I had to do was browse to the folders from the windows machines, and right click on them. I picked “Map Network Drive”, and entered in a password for each. Now, they show up as hard drives. I called them M: (for music) P: (for photos) and Z: (for the other stuff).
They're working well as of this writing.
(Note for Linux geeks. I set a workgroup name in samba that is different from my MS-HOME workgroup. While not advised by the wise folks on the internet, I think it worked in my favor. Because, I can path all the windows “Map network drive” and linux samba share mounts using the workgroup name, and this saves me having to use the IP address. I think this is a good thing, because I never set up a static IP address for the server. We'll see.)
(Another note for Ipod users: I do NOT recommend doing podcasts on the server. There are two reasons: (1) You never need to back up podcasts. Let the podcasters do that. and, (2) Itunes does not have a feature to “watch” folders for new files. So, you'd have to keep unloading and re-loading the podcast folder.)
0 Comments:
Post a Comment
<< Home