NFS, SAMBA and CVS

In this part of the talk you will learn how to hook various machines together in a heterogeneous network.

If you want to share drives over a linux network you can use the Network File System, which is called NFS. If you want to connect Linux machines to windows machines, you can use SAMBA.

There are various reasons to share drives between machines, but one convenient tool which really comes into its own in such an environment is CVS. The Concurrent Versions System is a version control system.

NFS

NFS is a technology that allows two UNIX boxes to share drives.

Here is the command ot start nfs:

/etc/rc.d/init.d/nfs start

You can also stop it, or check its status

/etc/rc.d/init.d/nfs stop
/etc/rc.d/init.d/nfs status

Here is how to mount a drive on remote machine:

mount 192.168.1.1:/home/ccalvert /mnt/foo

You can specify what to export from your machine in the file:

/etc/exports

For instance:

/home 

Here is how to export your home directory as read only from

/etc/exports:

/home (ro)

Here is how to export as read write from /etc/exports.

/home/ccalvert (rw)

To make the above statement work properly, you may need to be signed on as ccalvert on the client machine.

Here is a line you can add to your fstab file to make it so you an mount more easily:

192.168.1.30:/home/ccalvert /mnt/foo  nfs     noauto,user,rw     0 0

After adding this line, you can mount with this command:

mount /mnt/foo

To see what's going on on another machine:

rpcinfo -p 192.168.1.1

SAMBA

run this, or the result of cat /var/run/inetd.pid, which is a na a number:

kill -HUP `cat /var/run/inetd.pid`

Go to /etc/rc.d/init.d and run:

./smb start

You should then run:

./smb status 

to be sure it is running (two files)

To check smb.conf run testparm

Set security to either user or share

To create a public share called myshare:

[myshare]
   path = /home/ccalvert
   public = yes
   only guest = yes
   writable = yes
   printable = no



You probably want to set the security level to share, unless you have domain controller.

Set the directory and the files in it to the group users

go to /etc/samba/smb.conf

and set the following:

   encrypt passwords = yes
   smb passwd file=/etc/samba/smbpasswd

You probably have to manually start nmbd

CVS

CVS is a version control system. There are two big differences between this system and the system used by other people:

  1. It is an open source project, and thus free.

  2. It allows concurrent checkouts. Two people can checkout the same file at the same time. CVS then merges the code automatically. Unless you tell it not to, it will merge in every line of code so long as no two developers were working on the same line of code. If two people were working on the same line, then you have to perform the merge on those lines manually.

There are several ways to run CVS. It can be used by a single developer. It can be used by a group of developers who are tied together over a lan. CVS can also be used by developers who are working over a network.

A single developer might use CVS to back up a project. Why would a lone developer want such a tool? There are serveral reasons:

  1. It provides a history of a project. This will allow you to go back to a previous version if you decided you started down the wrong road. It can also let you recreate pervious versions of a product, such as Version 1.0, Version 2.0, etc.

  2. It helps developers perform reliable backups of a project.

  3. It makes it trivial to keep a project in sync across multiple machines, such as a desktop machine and your laptop machine.

In this example we will assume that multiple people are working on the project, but that everyone is on the same network.

Use NFS or SAMBA to connect to a machine that can share a drive with everyone on your network. The server should be a linux machine, but the clients can be either Windows or Linux. Each client should have a copy of CVS on it. Linux usually comes with CVS, while the Windows version of CVS consists of a single executable.

If you want to keep two machines in sync, the way to do it is a have a third machine that acts as the intermediary between the first two. That third machine is the real back up machine, but it keeps the back up in the form of a cvs repository. You can put a repository on a CD if you wish.

Using CVS

Updating cvs

tkcvs

tkcvs is a graphical front end to cvs. It requires recent versions of tcl to run, but a standard install of RedHat 7.0 contains everything you need.

tkcvs definitely makes CVS easier to use. While not a fancy app by Windows standards, it is nonetheless sophisticated enough to be useful to most developers. In particular, it can help you learn all the options CVS has available. Furthermore, it makes it easy for you to experiment with these options, so see what the can do for you.

On those occasions when tkcvs lets you down, you still have the option of dropping back to the command prompt and running your old commands. In fact, you can combine the GUI interface with a command line approach in any way you want. That way you can get the best from both worlds: The chance to write scripts at the command prompt, and the chance to browse your project and run reports inside the tkcvs GUI.

On tkcvs, in the Options menu, there is a Checkout with Options item that will allow you to checkout directories. You need to specifically check the checkout with options item, or this will not work.

tkdiff

tkDiff is an excellent diff engine that can be used to compare two files. It is really meant to be part of the tkcvs suite, but you can use it as a stand alone tool.