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
Sub pages
Suggested articles
24 Comment(s)
Comments
I already have a file server that I use Debian on for about 2 years. This tutorial added the Beep thing and I think its really useful. Nicely done.
Is there a way to do this without a static ip for people whos isp wont give them a static ip? Possibly port forwarding?
Just skip network configuration step. By doing this you will use the IP assigned by your modem / router which could assign different IPs to your Server, then you would need to check the server's IP each time you wish to SSH to it. To see the servers ip just run the following command:
ifconfig
then your IP should be either your wifi card IP if you are connected via wifi or your ethernet card IP if you are connected via cable.
Remember, to ssh to your server you need to know the server IP. If it is not static you can only connect via ssh if you are connected in the same network. To make sure your server has a "static" IP given by your router ("static" because your router gives IP in the form of 192.168.*.* or 10.0.*.*, etc and they are assigned by order of connection so they can change from time to time for one particular device) you need to configure your router. You could do:
a)
Configure your router to begin assigning IP starting a certain IP, ie if your router began assigning IPs starting from 192.168.1.100 you could change that value to 192.168.1.110 and then you could have 10 IPs which can be manually assigned to other computers. Although, by doing this you need to be sure not to assign the same IP to more than one computer or else one of the computers sharing IP will not have connection.
b)
Another way to do it (although it may be seen as bad practice) is to change the lease time in your router which max value is 2880 minutes (2 days). This means that if you connect to your router and then you turn off your computer, the IP will still be assigned to your computer for a period of 2 days, so if your server shutdowns and later on you turn it on, it will still have the same IP as last time only if it was shutdown less than two days.
To connect to your router enter in your internet browser the router IP (ie 192.168.0.1, 192.168.1.1, etc depends on the router) and login with router's admin user and password (if you son't know just google "configure <router model>" where <router model> could be Linksis DWxxx or something).
I suggest method a) and method b) to be extra sure your IP won't change. For more information google manual IP configuration using routers or something like that.
Remember, Saint Google knows everything.
Can you confirm the command to create the BEEP function? You have instructed to create this file:
vi /et/rc.load
It would not let me create that. I assumed you meant /etc/ and not /et/ and tried again, but i hear nothing after a reboot. Otherwise, everything went smoothly. Thanks!
I had the same problem and did some research. On my system (Hardy), the file is "/etc/rc.local". I just added the beep command above the exit 0 line and it works now.
Thanks for the tutorial, it was great.
"Because we must run all the steps from this tutorial as root user, we must enable the root account now."
That's not true and not recommended. New Linux users should run superuser commands as sudo, and if a root shell is really needed, you can use sudo -s
I would agree; and propose that anyone who needs to read a tutorial should not be logging in with the root account.
I agree, i also think that people who have to take lessons to learn to drive should not be allowed near a car and further that people who have to go to medical school to learn how to perform sugery have no business carrying out operations. what kind of world do we live in where people need to learn how to do things before they do them, Jerks
Yes i totally agree how arrogant to think you should use the root account to administer your server not knowing everything there is to know about everything Linux .Imagine... the nerve.
I'm new to Linux and I've noticed a certain arrogance displayed by quite a few knowledgeable Linux geeks.
Seems if you have to take a tutorial your a total nub ...more power to the majority of smart Linux users that give of their considerable knowledge without the attitude.
Now back to the tutorial ![]()
i asked in the forum because i could not get it to work.
Olli replied with this.
add
guest ok = yes
change
force group = no group
to
force group = nogroup
and it worked after that
Yes it is very confusing
for simple samba domain controller and file server up in few minutes
for the 9.4 version there seems to be a problem with the
directory mask
create mask
force user
force group
after I deleted these files it worked for me.
Thx for the instruction
All the steps worked as advertised except two. I had trouble mounting a second disk and I had trouble with the 'beep' trick.
I had an existing drive with linux on it already that I was simply going to use as a second drive to retain the half-terra byte worth of data. I found out that i had to use 'sdb1' instead of 'sdb' to mount it.
The beep trick is not in /et/rc.load. It's in /etc/rc.local
Well done sir. I appreciate the tutorial here.
some how I am unable to use sudo passvd root command nor the
/etc/network/interfaces command lines.
is there any good reason for this ?
I'm inexperienced with linux and trying to understand it.
How do I edit this to have specific users. I don't want it public. I want 3 specific users only to have access to the file server.
vi /et/rc.load
Simply add this line:
beep -l 900 -r 3 -f 500
this should be
sudo nano /etc/rc.local
beep -l 900 -r 3 -f 500 //add this line before the exit 0
beep is not installed by default in Jaunty server edition.
[code]sudo apt-get install beep[/code]
Couple of changes with newer versions of Ubuntu Server
If mounting an ntfs drive use the ntfs-3g type. Call "apt-get install ntfs-3g".
edit the /etc/rc.local file for the beep
the correct spelling is 'passwd' not 'passvd'
greets
When I type sudo passvd root
I get the following message sudo: passvd command not found
and when I try to use the /etc/network/interfaces command
it says Acces denied.
How? Why?
sorry I'm inexperienced with linux.
*using ubuntu 7.10 samba file serve*
Hi,
Check for the incorrect command. It should be "passwd" not passvd
Hello Friends.
In one way or another it will not work.
This possibility of linking up with major Putty just do not.
change ip. I can not fence, which command do you use it.
Sincerely yours, Kim Jessen.
I have spent the better part of the last two days attempting to set up this server using an old HP pavillion 6630 desktop machine and have encountered numerous issues getting here. I did, however, finally get to this point and am now completely out of tricks. I am running the set-up and get to the partition manager stage. All it shows are two sets of three question marks in place of the prompts about re-writing the entire disk, and the only two user options are to continue or go back. no matter which one i press it comes out into a solid blue screen that is completely unresponsive. At first i assumed it was either the hard drive or a connection issue, however when i try to boot into windows 98, it works just fine. This seemed like the best tutorial on the subject, and I was wondering if you had any insights?
Make sure there is already a user 'family' on the system, the tutorial omits this step, but it is essential on a 'virgin' install.
For instance:
sudo adduser --shell /bin/bash family
English |
Deutsch