Fedora Home Server

From DreamsteepWiki

Jump to: navigation, search

Contents

Notes for setting Up a Home Server with Fedora

The primary purpose of this kind of server is to provide a system for archiving personal and family-related files such as photos, videos, scans, sound files, and text documents. This server is configured only to boot Fedora, for simplicity.

Hardware:

  • (2) 1 TB Seagate SATA drives. (rsync is used to copy data files from one volume to another, so no RAID configuration is needed).
  • Intel Dual-Core 1.8 MHZ CPU.
  • 2 GB RAM.
  • DVD/CD drive.

Installing Fedora:

  • Have the Fedora installer automatically partition the primary drive.
  • Install with "Web Server" options.
  • Once Fedora is running log in as root, then:
yum install gparted yumex samba vnc mediatomb grsync

This installs gparted for graphic partitioning/formatting of drives, Yum Extender (GUI for Yum), Samba, a VNC Server and client for graphic access to the machine, a UPnP (Universal Plug and Play) server for media files, and a graphic front-end for rsync, which (IMHO) is the easiest way to backup and synchronize drives, folders, files, etc. As much as I like SSH, I also like to control my computers with a mouse! I will never be an 'A-List' geek because of my GUI wanton ways, but so what...

  • Set SELinux Policy to Permissive (or disable it entirely). Under the Boolean item check all Samba options so it can run.
  • Go to Administration -> Firewall and enable FTP, Samba, SSH, and WWW ports.
  • Edit the smb.conf file, but copy it first, just in case.
cp /etc/samba/smb.conf /etc/samba/smb.conf.original
gedit /etc/samba/smb.conf
  • This is all that is needed in the smb.conf file. Any other text can be deleted.
[global]
   workgroup = home
   netbios name = fedora
   security = share
   hosts allow = 192.168.1.0/24
[share]
   comment = Home File Server
   path = /sharepoint
   force user = someone
   force group = someone
   guest ok = yes
   read only = no

The above is not secure at all, but it provides full and simple access on a LAN in a home environment, where security is not as important as accessibility.

  • Check the Samba configuration:
 testparm /etc/samba/smb.conf

Result should be something like:

Loaded services file OK.
  • Start the smb service and tell it to run on boot.
chkconfig smb on service smb start
  • Restart the smb service
/etc/init.d/smb restart


Analysis of Configuration File:

[global] (signifies security parameters)

workgroup = home (names a windows workgroup name)

netbios name = fedora (our netbios name)

security = share (takes on permissions from the share, which we set earlier)

hosts allow = 192.168.1.0/24 (only allows this subnet to connect i.e. 192.168.1.100, etc.)

[share] (Signifies the name of the share when mounted. You can change to anything you like.)

comment = Home File Server (creates share point comments)

path = /sharepoint (The full path the volume you want to share. Note if you want to share more than one volume, copy the “share” section and alter accordingly.)

force user = someone (forces all users of this mount to become this user and obtain access to whatever this user has access to)

force group = someone (forces all users of this mount to become this group and obtain access to whatever this group has access to)

guest ok = yes (allows anonymous accounts to access, which is how we can connect without a password)

read only = no (allows us to write to the volume. If you set this to yes, you could make this an anonymous “read” only volume)


The Samba notes above were extracted from: http://magazine.redhat.com/2007/06/26/how-to-build-a-dirt-easy-home-nas-server-using-samba/


  • This is what I use in my smb.conf file. This is about as insecure as it can be, but for a home server it provides convenient file access to the whole remote server, which is handy for backups, etc.
[global]
   workgroup = home
   netbios name = fedora
   security = share
   hosts allow = 192.168.1.0/24
[share]
   comment = Home File Server
   path = /
   force user = kloge
   force group = kloge
   guest ok = yes
   read only = no


Setting Up Autologin for Fedora 9

The server needs to autologin to a user, so it can start up fully when the power button is pressed. After Fedora 8 this process is a little more involved, but it works fine.

Edit the gdm custom.conf file:

gedit /etc/gdm/custom.conf

Add the following to it and change userName to the name of the user to auto login..

[daemon]
TimedLoginEnable=true
TimedLogin=userName

The above allows auto login for the user named "userName"

Next we edit the gdm schemas file to shorten the "TimedLoginDelay" setting:

gedit /etc/gdm/gdm.schemas
 <schema>
 <key>daemon/TimedLoginDelay</key>
 <signature>i</signature>
 <default>5</default>
 </schema>

The "<default>" tag is the number of seconds the login will take. The default is 30, but 5 (or 0) is much faster! The above takes effect after a reboot.


Setting Up VNC Server for Fedora 9

VNC server will allow the machine to be accessed through a VNC client. This will allow full visual control of the home server computer so it can run headless (i.e., no monitor, keyboard, or mouse required).

To activate VNC:

  1. Go to System -> Preferences -> Internet and Network -> Remote Desktop
  2. Check the Allow other users to view your desktop & Allow other users to control your desktop.
  3. Uncheck Ask for your confirmation.
  4. In Administration -> Firewall -> Add Ports, add ports 5900-5910, or whatever number of ports are needed for the VNC server.


If the above doesn't work, follow the steps below.

In Administration -> Firewall -> Add Ports, add ports 5900-5910, or whatever number of ports are needed for the VNC server.

Set up the VNC servers:

gedit /etc/sysconfig/vncservers

Add this to the file:

VNCSERVERS="1:userName"
VNCSERVERARGS[1]="-geometry 1280x1024 -depth 24"

Substitute your user name login for "userName". As configured above, the server listens to port 5901 for connections.

Change the VNC Server password for the user:

vncpasswd

This password is saved in /home/userName/.vnc/passwd.

Restart the VNC server for the changes to take effect.

service vncserver restart

To automatically start the VNC Server on boot:

chkconfig vncserver on


Mounting Hard Drives

For simplicity, Fedora 9 is on the the same drive as the data kept for the home server. However, the other internal drive needs to be mounted to act as a backup for the data. First, log into the terminal as root.

Create a mount point in the media directory:

 mkdir /media/tback

Set the permissions of the mount point directory:

 chmod 777 tback

Add any other mount points you may need. In my media directory I have: tback, tb-drive1, and tb-drive2. The other share points are for external USB drives that are periodically connected for external file backup.

To temporarily mount a disk volume:

mount -t ext3 /dev/sdb1 /media/tback

To have a drive automatically mount every time the machine is booted, add it to the file system table (fstab).

gedit /etc/fstab

On my system, I added this line to the fstab:

/dev/sdb1        /media/tback        ext3    defaults    0 0

For volumes that are labeled with spaces in the name you need to surround the name in single quotes like this:

/dev/sdb1        /media/'TB Drive 1'        ext3    defaults    0 0

The syntax below with the rw and umask options defined is typically used as well:

/dev/sdb1        /media/'TB Drive 2'        ext3    rw,defaults,umask=0000    0 0

Speeding Up the Yum Package Manager

The following enables the fastest repository mirror to be the default, and uses the delta (differences) between packages, rather than downloading the entire package to be updated.

yum install yum-fastestmirror
yum install yum-presto


Using S.M.A.R.T. to Check on Hard Drive Status

It's a good idea to check on the internal temperature of your hard drives, especially for a server, where the drives are likely to be on for extended periods of time. Most modern hard drives support S.M.A.R.T., a monitoring system that reads and records internal sensor data on the hard drive device, and tracks performance, errors, drive temperature, hours of use, etc.

To add S.M.A.R.T. capability to Fedora install smartmontools:

yum install smartmontools

The smartmontools package contains two utility programs (smartctl and smartd) to control and monitor storage systems using the Self- Monitoring, Analysis and Reporting Technology System (S.M.A.R.T.) built into most modern ATA and SCSI hard disks. In many cases, these utilities will provide advanced warning of disk degradation and failure.

Hard Drives that run too hot wear out more quickly, and are more prone to errors. The maximum temperature a drive should be is 60 C (140 F), which is hot enough to burn your fingers! Optimal temperatures for a drive are 40-45 C (104- 113 F). If your drives are reporting high temperatures from S.M.A.R.T. it is best to add a cooling fan or two to the case. Quiet cooling fans are more expensive, but worth it.

To check on the status of a hard drive use smartctl -a, followed by a valid path to the device. For example:

smartctl -a /dev/sda
smartctl -a /dev/sdb


Partitioning a Hard Drive

With Fedora or Ubuntu you can use the default partitioning layout, which is easy and automatic, but I prefer to set up the disks myself with the Disk Druid partitioning utility that runs when you install Fedora or Ubuntu. Once you get the hang of Disk Druid it's very easy to customize partitions to almost anything you could want. If you mess up a partition layout you can always remove any partitions you don't want and rebuild it.

Below is what I used for a 1 TB drive running on Ubuntu Desktop 9.04 - "Jaunty Jackalope". The machine dual boots to Windows XP and Ubuntu so the remaining space on the drive was formatted to an NTFS partition so both OSs could access the drive. My preferred file system is EXT3, or EXT4, but NTFS partitions work from both OSs.

/ - 20 GB (For System Files) (ext4)

swap - 6 GB (allocate 1GB per GB of RAM. If more than 2GB RAM, allocate RAM GB + 2, so 4 GB of RAM = 6 GB swap)

/boot - 100 MB (ext3)

/home - 100 GB (ext4)

You may allocate partitions to whatever you like, but if you want to dual boot make sure you put Windows on the drive first.

  1. Decide how much space to give to Windows and format that portion of your drive to NTFS. I like to use Gparted Live for this. This will keep Windows only on the part of the disk where you want it.
  1. Install Windows, and have it do a quick format of the NTFS partition to make the MBR happy.
  1. Install Fedora or Ubuntu and create the partitions you will need with the "Customize" option. Otherwise, you can tell the Linux installer to use the free space on the disk and it will leave the Windows partition alone automatically. If you choose to create your own partitions you will need a root partition /, a swap partition, a /boot partition, and a /home partition. The /home partition can be any size you want, within what your hard disk has available.

You should now be able to dual boot and easily back up your /home partition in Linux without the hassles of LVM. (LVM is what Fedora will do by default, unless you manually lay out all of your partitions. LVM is fine, but it can be more confusing to work with for backups, restores, etc. than a regular EXT3 or EXT4 partition, IMHO.)


Installing Mediatomb

yum install mediatomb

To edit the Mediatomb configuration file:

gedit /etc/mediatomb.conf


In the Mediatomb configuration file set it up to operate as a service:

MT_INTERFACE="eth0"


To edit the Mediatomb XML configuration file:

gedit /root/.mediatomb/config.xml


In the Firewall, open ports: 49152 (udp/tcp), and 1900 (udp/tcp)

To start Mediatomb manually:

mediatomb

To start Mediatomb as a service:

service mediatomb start


If Mediatomb is not set to run as a service:

The terminal window needs to stay open for Mediatomb to keep running this way.

To stop Mediatomb properly:

Hit CTRL + C

To see the Mediatomb front end in a web browser:

Go to: http://localhost:49152


Media Tomb with a Sony PS3

Here are some articles on setting up Mediatomb for use with a PS3:


Setting Up a Static Local IP Address for Your Home Server

These instructions are specific to Fedora, but mostly apply to any server. There is an excellent article on this here: http://www.boutell.com/newfaq/creating/staticlocalip.html.

  • Go to System -> Administrator -> Network
  • Choose a device profile. It's a good idea to back up the existing device profile as well. I named my new profile 'Static'.
  • Click the Edit button.
  • Select Statically set Static IP addresses:.
  • Use an address that is outside the range of dynamic addresses set by your router. For example, my router dynamically sets addresses from 192.168.1.x, where x is 100 - 110. My server will be at 192.168.1.112.
  • Subnet should be 255.255.255.0
  • Gateway should be the address of the local router. For example, 192.168.1.1
  • Save the settings.

The home server should now have a "fixed" address since it is outside the range that the router may dynamically assign.

Personal tools