Login as root, and execute the following. I assume you are the user "mark", but it can be any user on your system.
mkdir /usr/local/cvs
chown mark /usr/local/cvs
Now login as "mark" and do the following.
Edit your .bashrc file using vi or emacs or even pico, and enter these commands.
CVSROOT=/usr/local/cvs
export CVSROOT
Save it and then execute "source .bashrc". Now when you log in, it will setup your environment to use this directory by default if you don't specify a directory to use.
Make a directory, which is need for cvs.
mkdir /usr/local/cvs/CVSROOT
In your home directory for "mark", make a directory called "Temp_Source" and put a few files in it. Such as,
mkdir Temp_Source
ls > Temp_Source/File1.txt
ls Temp_Source/* > Temp_Source/File2.txt
Now we want to put the files in Temp_Source into CVS. Do this, enter the directory Temp_Source.
cd Temp_Source
then issue this command
cvs import -m "Test Import" My_Files Revision1 start
Now we are ready to make a working directory. We will forget about the directory Temp_Source and pretend it never existed. By the way, take a look at /usr/local/cvs and see what cvs has done to it. You can add more packages to the cvs repository if you wish.
When we checkout a package from cvs, it will create a directory for us. The parameter "My_Files" that we specified when we uploaded the files into cvs will be the name of the directory created for us when cvs downloads the package for us.
Now we need to get the cvs package.
cvs checkout My_Files
If we look, we now have a directory named "My_Files". Enter into the directory,
cd My_Files
and execute the the "ls" command.
ls
"cvs commit" will bring you into your default editor, vi or emacs or something else. Save the file, and when you quit the editor, cvs will ask you to continue, and select the option to continue. Now you have uploaded a file to the cvs repository "My_Files".
Also, execute the "ls" command, and you will notice that you have a directory called "CVS". cvs creates a directory "CVS" in every directory that you download files from a repository and it keeps the changes up to date.
The first step actually deletes the file in your directory. The second step removes it from the configuration of the current directory you are in. The third step commits this change to the cvs repository"My_Files". If you do not execute "cvs remove File3.txt", you will find it hard to execute "cvs commit" in the future and it won't update the repository correctly, at least that has been from my experience.
ls /var >> File2.txt
cvs commit
cvs update -dP
The "d" creates any directories that are or are missing.
The "P" removes any directories that were deleted from the repository.
CVS is the best source control program I have used. It is the best because it comes by default on major Linux distributions, and it is relatively easy to use, unlike some other source control software I have seen. Major free software websites use CVS, which is another plus, because if they use it, then it will be an ongoing project. Also, you can download documents using cvs over the internet. I downloaded all the sgml howtos from the Linux Documentation Project using cvs using their anonymous CVS server. This is very useful if you want to keep yourself up to date on various versions of documentation.
Mark works as a computer guy at The Computer Underground and also at ZING and also at GNUJobs.com (soon).