Simple Home File Server (Based On Ubuntu) - Page 3

4 Enable The root Account

After the reboot you can login with your previously created username (e.g. administrator). Because we must run all the steps from this tutorial as root user, we must enable the root account now.

Run

sudo passwd root

and give root a password. Afterwards we become root by running

su

 

5 Configure The Network

Because the Ubuntu installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100): 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
 address 192.168.0.100
 netmask 255.255.255.0
 network 192.168.0.0
 broadcast 192.168.0.255
 gateway 192.168.0.1

Then restart your network:

/etc/init.d/networking restart

Then edit /etc/hosts. Make it look like this:

vi /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts#

Now run

echo server1.example.com > /etc/hostname
/etc/init.d/hostname.sh start

Afterwards, run

hostname
hostname -f

Both should show server1.example.com now.

 

6 Edit /etc/apt/sources.list And Update Your Linux Installation

Edit /etc/apt/sources.list. Comment out or remove the installation CD from the file and make sure that the universe and multiverse repositories are enabled. It should look like this:

vi /etc/apt/sources.list

#
# deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted

#deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://de.archive.ubuntu.com/ubuntu/ gutsy main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ gutsy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://de.archive.ubuntu.com/ubuntu/ gutsy universe
deb-src http://de.archive.ubuntu.com/ubuntu/ gutsy universe
deb http://de.archive.ubuntu.com/ubuntu/ gutsy-updates universe
deb-src http://de.archive.ubuntu.com/ubuntu/ gutsy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://de.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb http://de.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://de.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository. This software is not part of Ubuntu, but is
## offered by Canonical and the respective vendors as a service to Ubuntu
## users.
# deb http://archive.canonical.com/ubuntu gutsy partner
# deb-src http://archive.canonical.com/ubuntu gutsy partner

deb http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb http://security.ubuntu.com/ubuntu gutsy-security universe
deb-src http://security.ubuntu.com/ubuntu gutsy-security universe
deb http://security.ubuntu.com/ubuntu gutsy-security multiverse
deb-src http://security.ubuntu.com/ubuntu gutsy-security multiverse

Then run

apt-get update

to update the apt package database and

apt-get upgrade

to install the latest updates (if there are any).

 

7 Install Some Software

apt-get install samba smbclient smbfs beep ntp ntpdate

Samba, SMBlient and SMBFS form the base of the home file server. NTP and NTPdate will keep the time synchronized. Beep is needed to let the PC-speaker beep when the file server is up and running.

 

8 Install The Second Hard Disk

First we need to find out what name Ubuntu has given to the second hard disk:

fdisk -l

You should get a listing of the hard drives installed on your PC. There will be a little paragraph for each one that will look like this:

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 4678 37576003+ 83 NTFS

In Windows disk drives are assigned an alphabet letter.The main hard drive was c:/. In Linux it’s kind of the same, but in a different format. All hard drives installed are listed in the ‘device’ or /dev directory. All drives start with theprefix “hd” ( ‘hard drive’). I will now show the steps to add hda1.

Now we create a mount point:

mkdir /media/store

This mount point will get writable permissions for all users:

chmod 777 /media/store

The hard disk hda needs to be mounted:

mount /dev/hda /media/store

This is a temporary mount. In order to do his automatically at every boot, we need to:

vi /etc/fstab

The text editor window will appear with the fstab file loaded up. You will see something that looks kind of like this:

# /etc/fstab: static file system information.
#
#
<file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 none swap sw 0 0
/dev/hdb1 /media/hdb1 ext3 defaults 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0

All you have to do is add a new line for the new drive… I will add the following line to my fstab for my new drive:

/dev/hda1 /media/store ntfs defaults 0 0

To make the hard drive show up right now, without rebooting - just reload your fstab file with the following command:

mount -a

 

9 Configure Samba

The Home File server must be visible in the home network. The default value is MSHOME. If your workgroup has a different name edit:

vi /etc/samba/smb.conf

and change the line:

workgroup = MSHOME

Make the hard disk hda visible and writeable for all users, add the following lines to the bottom of smb.conf:

[hda public hard disk]
comment = Public Folder
path = media/store
public = yes
writable = yes
create mask = 0777
directory mask = 0777
force user = nobody
force group = no group

Now Linux users can log in to the Home File server.

Save and exit the vi editor and restart Samba:

/etc/init.d/samba force-reload

For home use one user name is sufficient. In this example I will add the user family:

smbpasswd -a family

Fill in a password at the next prompt. Now you are able to use family as user if you access your home file server from Internet Explorer.

 

10 Beep

Your home file server will probably not have a turned on or attached monitor. So when you start up your home file server you do not excatly know when Ubuntu and Samba are loaded and can be used in the home network.

By making the PC-speaker beep 3 times, you will know that the system is ready:

vi /et/rc.load

Simply add this line:

beep -l 900 -r 3 -f 500

Now  reboot and enjoy your own Home File Server:

shutdown -r now

Share this page:

24 Comment(s)