# Need some guidance for home network

## greedyfly

Hi, Hope you read to the bottom!

I currently have gentoo installed on 3 machines: an amd64 laptop (emachines 6809), an amd64 desktop, and a P4 desktop.

I wanted to outline what I wanted to do with this network and hopefully get some guidance on what packages I will need. Not looking for any specific Howto (except maybe for Distcc where I am failing miserably, see below), but more of a general approach. I have already spent 4 weeks getting this far, but being a noob, I am not sure where to go from here.

The two amds are KDE, the P4 currently has no monitor and I ssh into it to get things done with the other two boxes. Here are there names. PortableOne (laptop), BedroomOne (amd Desktop), and BasementOne (P4 that I want to use as a server)

Things I want to be able to do, and what I have done to accomplish it so far.

Window Environment: 

Done---Installed kde-meta on notebook and laptop

Office Software for word processing: 

Done---installed OOffice on notebook and laptop

Printing: 

Mostly Done-- Cups is working with Bedroom One and I am assuming I can access my usb printer attached to BedroomOne using my network

Music Collection: 

Work In Progress--Using Amarok and alsa-drivers. Want to move the music collection onto BasementOne (P4) and be able to access from any computer in the network

Web Surfing: 

Mostly done, can't get Konqueror (currently my first choice of browser) to use flash, but it works in Firefox (my second choice)

Increase Speed: 

Work In Progress:

 I had distcc working well between the 2 amd boxes, but when I brought in the P4 it all failed with Distcc reporting Error 110 which I have found means no compiler found. Emerged crossdev package on each machine but when I crossdev -t i686 on the amd machines binutils fails to emerge. crossdev -t x86_64 on the P4 worked. Used the gentoo docs but I am not smart enough to follow them. I use emerge on all 3 machines so when the docs say only do xxx on the target I am not sure which is the target. Read some docs that talk about about exporting CC=gcc CXX=g++, others that said I don't need crossdev, and others that mentioned a PORTDIR_OVERLAY setting in make.conf. I don't know what an overlay is (read about it but its not plain enough for me), and read about putting -m32 in CFLAGS, which I guess means build 32 bit libraries, but I don't want to build 32 bit libraries on the amd64s. 

I have ccache enabled on all machines

I have prelinking on both amd64s

Goals: Things I want to do but have no idea where to start (Help me out here !!!)

Move all music files to a drive on P4 and access them from anywhere in the network

Set up a mail server for my network on P4

Set up a web server for my network on P4

Set up a backup drive on P4 for all 3 computers (currently have a 1TB firewire/USB Western Digital Drive that I wish to use)

Set up a contact/address/calander server on the P4 so that I can sync BedroomOne/PortableOne information without typing it in everytime.

I currently have 4 hard drives from older computers not attached to anything. I want to get any data off of them I want to keep then use them in the two desktops.

Question: I currently emerge --sync on each machine individually. Is it possible to store portage stuff on P4 and emerge --sync for all three machines and then emerge from P4 for any one of the 3 machines? If so then I could see P4 being the host in my distcc setup and the amd64s being clients, but I am not sure if I understand all the terminology correctly.

I have one more amd64 desktop that I hope to add to my collection so a small level of scalability would be nice, but I can't take the windows off of it until I get done with all of the above.

If you read down this far thanks and please offer your advice!

Thanks,

greedyfly

----------

## Napalm Llama

I can't help you with the mailserver, (are you sure you really need to manage your own one?), but I'll give a shot at advising you about everything else:

First of all you want a filesharing infrastructure in place.  This can be either NFS or Samba, (or perhaps one of the more exotic ones), but if you want Windows machines to work on your network, you're going to need Samba.  I actually prefer Samba over NFS anyway - it doesn't integrate quite as nicely, but I find it tidier and easier to firewall.  That's just me, though.

Music collection can go on a share (Samba/NFS/whatever) on your server - you can mount it on your clients so that the files always appear with a specific user:group (I have music:users, for example) and -rw-rw-r-- permissions.  This keeps ownerships nice and tidy.

You could also have Kontact (or whatever) put its data files on a share from your server, thus keeping them synced.  There's probably a better way of doing this, though - I don't know what would happen if you started Kontact on both clients and they were trying to access and write to the same data files at the same time.

Web server is nice and easy to do - if you're familiar with Apache then you could use that, (your machine can handle it), but Lighttpd is good, too - it's smaller, faster and easier to configure, at the expense of a lot of advanced features which you probably weren't going to use anyway.

I use rsync for backup.  I have a cronjob that runs the appropriate command automatically in the dead of night.  If you don't leave your PC on overnight, you could add the command to /etc/conf.d/local.start or /etc/conf.d/local.stop .  I use a command like rsync -a --delete /home/ rsync://server/home .  You set up the rsync server by editing /etc/rsyncd.conf and running /etc/init.d/rsyncd start .  You already have the rsync server installed - it comes with the rsync client, which you use whenever you sync your Portage tree.

My server's /etc/rsyncd.conf looks something like this:

```
# /etc/rsyncd.conf

# Minimal configuration file for rsync daemon

# See rsync(1) and rsyncd.conf(5) man pages for help

# This line is required by the /etc/init.d/rsyncd script

pid file = /var/run/rsyncd.pid

use chroot = yes

read only = yes

# Simple example for enabling your own local rsync server

[gentoo-portage]

        path = /usr/portage

        comment = Gentoo Portage tree

        exclude = /distfiles /packages

[home]

        path = /mnt/ext/home

        read only = false

        list = false

        hosts allow = 78.32.xxx.xxx

        uid = root

        gid = root
```

With a file like this, you just have to sync your server against the Portage tree.  Once you've done this, you can sync all your clients against the server.

The line in my clients' /etc/fstab for the music share looks a bit like this:

```
//server/music        /mnt/music      smbfs           guest,uid=105,gid=100,fmask=664,dmask=775,rw 0 0
```

guest means I'm not prompted for a password when the share is mounted (the server is configured to allow passwordless shares).

uid=105 means the owner appears as music

gid=100 means the group appears as users

fmask and dmask specify the permissions files and directories appear with, respectively.

NFS will be a little different of course, but hopefully the same principles will hold.

Here's a sanitised version of my server's /etc/samba/smb.conf , in case you decide to go that route:

```
[global]

 workgroup=mshome

 netbios name = server

 server string = Tom's Server

 browsable = yes

 security = share

 load printers = no

 bind interfaces only = yes

 interfaces = eth0 lo

 hosts deny = ALL

 hosts allow = 127.0.0.1, 78.32.xxx.xxx/255.255.255.240

 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

 remote browse sync = 78.32.xxx.xxy

 remote announce = 78.32.xxx.xxy

 domain master = yes

 preferred master = yes

 wins support = yes

 preserve case = yes

 create mask = 0666

 directory mask = 0777

 guest account = samba

 hide files = /.*/

 # May cause problems

 reset on zero vc = yes

 show add printer wizard = no

 veto files = /lost+found/

[music]

 comment = Music Collection.

 path = /mnt/ext/music

 browseable = yes

 read only = no

 guest ok = yes

 public = yes

 printable = no
```

If I've missed anything, let me know.  Hopefully I've explained everything else satisfactorily  :Smile: 

----------

## NeddySeagoon

greedyfly,

You can share your /usr/portage but not /usr/portage/packages across your network with NFS.

This gives you a single portage tree and distfiles for all three systems, then you can sync once a day with a cron job.

You cannot share /etc/portage/packages as its content is arch dependant - it contains binary packages you build for yourself.

You can move it out of /usr/portage with an entry in /etc/make.conf  see /etc/make.conf.example.

If you prefer, you can make your own portage server and sync two machines to your own master.

You don't mention a firewall or a router.

How do you keep intruders out ?

----------

## greedyfly

Thanks for the replies...I am perusing them now.

I plan to set up Samba and the reply will help with that.

I am getting ready to put the music laden hard drive into the P4 and see if I can access it remotely. 

I think Google and ambition might have got the better of me though. I found this.

http://gentoo-wiki.com/HOWTO_Using_a_shared_portage_via_NFS

I followed the guide and installed NFS on the P4 as the NFS server and the two amd64s as clients that connect to the P4.

I am not 100% sure its working but when I run emerge netstat shows traffic on the nfs connections.

One thing in the guides was the line

```
PKGDIR=/mnt/nfs_portage/packages
```

Neddy, was that what you were saying not to do as  far sharing across net with NFS?

Currently the whole network is behind a linksys router

I will try the NFS route to access the music drive

Also if anyone else ever reads this and follows that guide with amd64 clients remember to use the amd64/desktop profile not the x86/destop profile that appears in the code listings. Portage wanted to downgrade quite a few packages and threw me into a panic until I went back and changed that line appropriately.

----------

## Napalm Llama

If you're using NFS for Portage then I'd suggest you use it for your music as well.  It does pretty much the same thing as Samba, so you may as well save resources and only run one server  :Smile: 

----------

## greedyfly

Well I might have a windows box I need to connect to one day...Samba might be good practice  :Smile: 

I am using Kontact for now and am not sure how to go about syncing up the notebook with the desktops. In Kontact, they talk of LDAP, which I don't think is what I need. Googling seems to turn up groupware servers (egroupware) but that seems to be overkill. Then for LAN in KDE exploring it wants a LISa daemon which I am about to google around to see if that is anything near what I need.

Gentoo/Linux make computing fun again, huge learning curve, but it mostly makes sense once you start thinking of everything as a file and all the software as a means of accessing it. Nice sense of accomplishment tho!

----------

## NeddySeagoon

greedyfly,

By default, /usr/portage contains three things

the portage tree

your distfiles (which are source code)

your saved binary packages

Sharing the tree and sources is fine as they are architecture independant but you don't want to mix your saved binary packages.

The 64 bit binaries will not run on the P4. You must therefore use /etc/make.conf to remap the /usr/portage/packages to somewhere else.

----------

## greedyfly

Neddy,

I created the directory /mnt/nfs_portage on the P4 and mounted it onto the amd64 boxes through /etc/fstab.

```
192.168.1.101:/usr/portage /mnt/nfs_portage nfs         ro              0 0
```

As directed by the guide cited earlier, this was the changes it suggested to /etc/make.conf

```
PORTDIR=/mnt/nfs_portage

PKGDIR=/mnt/nfs_portage/packages

DISTDIR=/mnt/nfs_portage/distfiles

#DISTDIR=/usr/portage/distfiles # retain usage of local distfiles directory if Portage is mounted read-only

RPMDIR=/mnt/nfs_portage/rpm

PORTAGE_TMPDIR=/var/tmp

#FEATURES="-distlocks" # possibly required, depending on type and quality of network share.  see below

```

So the relevant section on both AMD64s is the following

```
PORTDIR=/mnt/nfs_portage

PKGDIR=/mnt/nfs_portage/packages

DISTDIR=/mnt/nfs_portage/distfiles

DISTDIR=/usr/portage/distfiles

PORTAGE_TMPDIR=/var/tmp

```

From what I think I know, the amd64s now have a portage tree of /mnt/nfs_portage, the distfiles will reside on /usr/portage/distfiles since I mounted ro in /etc/fstab. But I might have a problem with the PKGDIR=/mnt/nfs_portage/packages because of the two different archs? If i understand portage (which is a big IF), the /usr/portage/packages is used if i emerge --buildpkg? If that is so then I should be ok as I don't use the --buildpkg option, I just emerge --sync every couple of days, emerge -uDNpv system and world afterwards. 

If however I do use the --buildpkg option, I will be looking for trouble.

Am I understanding you correctly?

----------

