Out of boredom I'm posting this, which is a walkthrough I wrote for myself instead of actually sharing it.
I built a cheap little $300 PC, using an Asus motherboard with integrated video, sound, and gigabit LAN, an AMD x2 5700+ CPU, RAM I had laying around, and 4 hard drives I had somewhat laying around. I bought a nice looking case with a gigantic side panel fan bundled with a cheap PSU, and bought a SATA DVD/CD R/RW drive for my gaming PC and took the DVD RW drive out of it for this. Basically you'll need a monitor, keyboard, and mouse for the initial setup, but if you don't mind using telnet (as dangerous as it can be, the server is only accessible through your own network) you can just telnet into the terminal interface of ubuntu to mount new hardware or change file settings remotely. You'll also need at least 2 hard drives... though I'm sure you can partition the main drive into two parts and share the 2nd partition, which I'd do, but the old IDE drive I'm using as the OS HDD is about 5 years old and god knows when it's going to s'plode. I'd rather not use it to hold any data besides the OS.
This is mostly written expecting the reader to have a pretty base understanding of installing an operating system, as well as hardware, and understanding a command-line interface. This took me several hours of reading other tuts to finally get right, but it shares to Windows with absolutely no problems, though it gets along much better with other linux systems. It also allows any and all computers on my network to read from, write to, modify, and delete data, something I'll soon be changing once my brother gets his computer working again.
Setting up ubuntu for use as a server
I use ubuntu intrepid, version 8.1 for the GUI aspects of it, and I already had a disk laying around since I run it on my laptop, but it makes this a tad easier. Once all is said and done you will no longer need a monitor, keyboard, or mouse once you set up telnet.
Install File for Ubuntu Intrepid is at Download Ubuntu | Ubuntu
you'll download the .iso file, just open it in any cd burning application and burn it to a disc, then insert the disc and boot from the CD-ROM drive of your soon-to-be server. I'd recommend instaling with only the hard drive you wish to install the OS to plugged in and with power; once you can boot into linux, shutdown and install the remaining hard drives.
After installing all your hard drives, open the terminal, from the Applications tab > Accessories > Terminal, and type
sudo passwd root
Then enter your password to allow you root access to files and folders on your ubuntu installation.
Type sudo apt-get update
This command runs the updater, updating all of the files on your computer.
Once that's done:
Type sudo apt-get upgrade
This upgrades your linux kernel, as well as other files.
Now you have to create a directory as a mount point for each of your hard drives you want to share, to keep it simple, I call the directories storea, storeb, ect.
Type sudo mkdir /media/storea; sudo mkdir /media/storeb;
so on and so forth. This creates the directories in /media.
Now you have to change the read and write permissions for all users to these directories, to do so, type
sudo chmod 777 /media/storea; sudo chmod 777 /media/storeb;
so on and so forth. This lets all users, groups, and others read from, write to, and execute the data in those folders.
Now you have to edit your boot file to automatically mount the hard drives in your computer to the selected folders whenever you start the computer. To do this, type
sudo fdisk -l
This will list all the disks on your computer; look for titles such as sda, sdb, sdc, ect. One will be hosting your server, so you don't want to set it to share. If you have partitions as well, they'll be named sda1, sda2, ect. You'll want to mount these as well. Since my shared drives are not partioned, I only have to share sda, sdb, and sdc, sdd is partitioned and holds my operating system.
Now you have to edit fstab, a file that runs commands when the computer is booted. To do so, type
sudo gedit /etc/fstab
Add the following to the bottom of fstab:
/dev/sda1 /media/storea ntfs defaults 0 0
#/dev/hard_drive_name /mount_point file_system defaults 0 0
/dev/sdb1 /media/storeb ntfs defaults 0 0
/dev/sdc1 /media/storec ntfs defaults 0 0
Basically, /dev/sda1 is the name of the hard drive on the computer, /media/storea is the directory I'm mounting it to, ntfs is the file system the hard drive is formatted in (readable and writable by linux, macOS, and windows) and defaults 0 0 will stay the same for every drive mounted.
You must create a folder for each drive you want to mount. This is also assuming you aren't using RAID 0, if you are, you'd only have to mount one drive, since you'd only have a single logical drive intalled, partitions aside.
To mount these drives now, type sudo mount -a
Now, make sure you have samba installed. To do this, type
/sudo apt-get install samba smbclient smbfa
Once Samba is installed, you have to configure it to share the hard drive's directories by doing the following:
Type sudo gedit /etc/samba/smb.conf
At the end of the [global] section add
usershare owner only = false
Look for the ######Authentication###### section
change
# security = user
to
security = share
Add the following, one for each hard drive, to the bottom of smb.conf:
[120gb] #Share Name on the network, change this for each drive you ad
comment = Public Folder
available = yes
path = media/storea #Path the hard drive is mounted in on your computer, changes for each drive you ad
public = yes
writeable = yes #Allows network users to read/write data directly to and from the hard drive
create mask = 0777
directory mask = 0777
force user = nobody
guest ok = yes #Disables login requirement
force group = nogroup
If you don't change the security = share field, or ff you set guest ok = no and public = no, then when you type //server_name from a windows PC, you'll need a login, to set up your login, type the following:
sudo smbpasswd -a your_username
Substitute your_username for the username you wish to use. "I don't have one made yet!" you might think, but this command will create the username for you, then allow you to enter your password in the next prompt
then enter your_password
If you have a pc speaker attatched to the motherboard for beep codes, the following is a neat trick:
type sudo apt-get install beep
This installs the software beep
Type sudo gedit /etc/rc.local
Add the following line before exit 0
beep -l 900 -r 3 -f 500
This will make your system beep 3 times with long pauses when the operating system is fully loaded.
Now to install telnet service, allowing you to telnet into the console of the server from any computer to act as if you were on it:
sudo apt-get install telnetd
now restart the networking by typing
sudo /etc/init.d/networking restart
Now restart and enjoy your own file server!
Some commands of note:
sudo /etc/init.d/samba force-reload
This reloads Samba so that changes can take effect without requiring a reboot. Useful if you added a new hard drive and don't want to restart the system to get it to show up.
Using telnet: If you are able to set a static IP address from your DHCP server on your router, more power to you, if you can't, you'll have to check the current DHCP table on your router's listing to see what computer has what IP address at the moment. Once you know, open windows CMD prompt (Start > Run > CMD ) and type telnet servers_ip_address
You'll be prompted for your username and password you created when setting up the computer's OS. From there, you can run any and all of the commands we just did here, including a remote shutdown or restart by typing
sudo shutdown -r now
shutdown is the command to shut down, -r is the modifier for restart, now is the time, you can type now for instant, or 1-x for any number of minutes. To cancel a timed shutdown or restart, just hit ctrl d or ctrl c to cancel the script from running. If you just want to shutdown
sudo shutdown now
Because of how Linux works, a lot of the things we're doing here can only be done by the root user, or in Windows terms, the Administrator. While you may be the administrator of your windows PC, there is no solid root to a linux system. When you setup the sudo passwd root command to enable root, you password protected anyone from using the system as a root user without that password.
The sudo command basically means run the command following this command as if it were issued by a root user. If you want to skip having to use it all together, just type su when you login, you'll be prompted for the root password, but then you'll be the fully fledged root user.
For those who are scared of linux: give it a try. it's free, it's open-source, it's developed by people who have a true passion for what they're doing, and, most of all, it's insanely, INSANELY, secure and stable vs Windows. About the only thing I still use Windows for is gaming.
Last edited by Sean; 03-11-2009 at 10:58 PM.
Bookmarks