Team Development with WebSphere Studio Application Developer 4.0: Part 3 -- Installing and Configuring CVS on RedHat Linux 7 as an SCM Repository

This article, the third one in a series on team development in IBM WebSphere Studio Application Developer, focuses on installing and configuring CVS on RedHat Linux 7 as an SCM Repository.

Share:

Colin Yu (coliny@ca.ibm.com), Software Engineer, IBM Toronto Lab

Photo: Colin Yu Colin Yu is currently working as a software developer on WebSphere Studio Application Developer at the IBM Software Solutions Toronto Lab. Colin received a Bachelor of Engineering degree in 1995 and a Master of Applied Science degree from the University of Waterloo, Ontario in 2000. Colin is an IBM Certified Enterprise Developer and Systems Expert on WebSphere Application Server, and an IBM Certified Solution Developer on WebSphere Studio Application Developer and VisualAge for Java. You can reach Colin at coliny@ca.ibm.com .



30 May 2002

Introduction

This article, the third one in a series on team development in IBM ® WebSphere® Studio Application Developer, focuses on installing and configuring CVS on RedHat Linux 7 as an SCM Repository. WebSphere Studio Application Developer (hereafter called Application Developer) works seamlessly with CVS, the dominant open-source, network-transparent version control system. CVS runs on most platforms, including Windows®, Linux, AIX®, and UNIX®. Installing it with Application Developer on RedHat Linux has several advantages:

  • Linux is now the dominant open-source operating system.
  • RedHat is one of the major distributors of Linux.
  • CVS is included in the RedHat Linux 7 distribution.
  • CVS for Linux is stable, reliable, and scalable, and is useful for individual developers and small teams as well as large, distributed teams.
  • Application Developer runs on RedHat Linux 7.
  • When using Application Developer, you can use CVS as a local repository or as a shared repository for the entire team.

    However, installing and configuring CVS for Linux is not trivial and there is little good documentation available. The step-by-step instructions below should help system administrators configure CVS for Linux for developers using Application Developer.


Install CVS on RedHat Linux 7

CVS Version 1.11.1.3 may be already installed in your RedHat Linux 7 by default. To check, enter the command rpm -qa|grep 'cvs'. If the return is cvs-1.11.1-3, it means that CVS is already installed.

If the command returns nothing, you need to install CVS. The CVS rpm is normally on Installation CD #2 of the RedHat Linux 7 distribution in the directory RedHat/RPMS. After you mount the CD to /mnt/cdrom, use the rpm command to install CVS: rpm -i /mnt/cdrom/RedHat/RPMS/cvs-1.11.1p1-3.i386rpm


Set up the CVS user accounts and groups

  1. Log in as root.
  2. Create a user named cvs, with a primary group cvs.
  3. Create users who will use cvs in Application Developer. This article uses cvsdev1 and cvsdev2.
  4. Developers who use cvs can use their private groups as their primary groups. For example, cvsdev1's primary group is cvsdev1, but make sure that they also belong to the cvs group.

Set up the folder and repository

  1. Log in as user cvs.
  2. Create a directory named repository under its own home directory, which is /home/cvs.
  3. Set the access level and access mode of directory /home/cvs/repository: chmod 770 /home/cvs/repository
  4. Set setgid bit on directory /home/cvs/repository: chmod g+s /home/cvs/repository

    Explanation: when a file is created in a directory, it belongs by default to the primary group of the owner. With the setgid bit set on the directory, new files will belong to the same group as the directory instead of to the owner's primary group. For example, if user cvsdev1 creates files in the directory /home/cvs/repository, those files will belong to the cvs group instead of to its primary group cvsdev1.

    This step is crucial because it lets CVS users check out files created by other users. If this step is not completed, then when you check out a file created by another user, the operation will fail with this message:

    Failed to create lock directory for /home/cvs/repository/...: Permission denied.
    Failed to obtain dir lock in repository /home/cvs/repository/...

  5. Initialize the repository:
    cvs -d /home/cvs/repository init
  6. Log out user cvs.

Modify xinetd service to enable pserver protocol

  1. Log in as root.
  2. Create a file named cvspserver in directory /etc/xinetd.d with this content:
    # default: off 
    # description: An cvs server. 
    service cvspserver 
    { 
       disable = no 
       socket_type = stream 
       protocol = tcp 
       user = root 
       wait = no 
       server = /usr/bin/cvs 
       server_args = -f --allow-root=/home/cvs/repository pserver 
       log_on_success +=USERID 
       log_on_failure += USERID 
    }
  3. Open /etc/services and verify that these two lines are present. If they are not, add them:
    cvspserver 2401/tcp     # CVS client/server operations 
    cvspserver 2401/udp     # CVS client/server operations
  4. Restart xinetd service:
    service xinetd restart

Set up user environment

  1. Open the file /etc/profile. You should to see these lines in the file:
    USER='id -un' 
    LOGNAME=$USER 
    MAIL="/var/spool/mail/$USER"
  2. Add one line after the environment variable MAIL.
    CVSROOT=":pserver:$USER@localhost:/home/cvs/repository"
  3. In the file, you should also see a line like this:
    export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
  4. Modify it and add CVSROOT into the export list like this:
    export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC CVSROOT

Test the installation by local users

  1. Developer 1 log in as cvsdev1.
  2. Make sure the environment variable is correct by typing this command:
    echo $CVSROOT

    It should return a result like this related to the user name:

    :pserver:cvsdev1@localhost:/home/cvs/repository
  3. Log into CVS with the command:
    cvs login

    You will be prompted for a password. Enter your Linux password.

  4. Create a directory named project1:
     mkdir project1
  5. Create a file named Test.java in directory project1 with the following contents:
    public class Test{ 
       public String sayHello(String name){ 
          return "Hello"+name; 
       } 
    }
  6. Use these commands to import Test.java into module project1 in the CVS repository:
    cd /home/cvsdev1/project1 
    cvs  import -m "import Test.java" project1 wsadgroup release1_0

    You should see a message like this after the CVS import operation:

    N  project1/Test.java 
    No conflicts created by this import
  7. Back up your source:
    cd 
    mv project1 project1.sav
  8. Check out project1 from the CVS repository:
    cd 
    cvs checkout project1

    You should see a new directory named project1 created under /home/cvsdev1, with a file Test.java and a directory CVS.

  9. Developer 2 log in as cvsdev2
  10. cvsdev2 log into CVS:
    cvs login
  11. cvsdev2 check out project1 from CVS:
    cvs checkout project1

    You should see a message like this from CVS:

    cvs server:Updating project1 
    U project1/Test.java
  12. Add a new method to Test.java, which is in the directory project1:
    public String sayBye(String name){ 
       return "Bye, " + name; 
    }
  13. Check Test.java into the repository:
    cvs commit -m "checkin Test.java" Test.java

    You should see a message like this from CVS:

    Checking in Test.java; 
    /home/cvs/repository/project1/Test.java, v <-- Test.java 
    new revision: 1.2; previous revision: 1.1 
    done

    User cvsdev1 catches the changes by cvsdev2 with these commands:

    cd /home/cvsdev1/project1 
    cvs update Test.java

    You should see a message like this from CVS:

    U Test.java

    You can open Test.java with an editor to see the update by cvsdev2.


Test the installation with Application Developer

  1. Open Team Perspective, select the Repositories view and in the Workbench, select File => New => Other. From the CVS category, select Repository Location and click Next. Complete the repository location wizard. Here are brief descriptions of the CVS terms on this panel of the wizard:

    Connection type Protocol you wish to use to connect to the CVS server. The default is pserver, which represents the password server protocol. It is the connection type we just set up in RedHat Linux 7. User name User name you use to log on to the CVS server. For example, cvsdev1 or cvsdev2 in the cvs group that we just defined in RedHat Linux 7. Host name Machine name of the server you wish to connect to. This will be the host name or IP address of the RedHat Linux box. Repository path Fully qualified path to the location of the repository on the server. With our installation and configuration, this will be: /home/cvs/repository. CVS location Complete location used by Application Developer to connect to the repository. This is dynamically built as you complete the previous fields. Validate on finish Tests the repository connection before returning to the IDE. Keep this enabled as a first connectivity test.
    Figure 1.
  2. Click Finish. If Application Developer can connect to the CVS server, you will be prompted for a password for the user ID. See Figure 2 below.
    Figure 2.

    Once the user ID and password have been validated, you are returned to the Repositories view with a new entry for the repository to which Application Developer has connected.

  3. Expand Streams => HEAD => project1, and you can see Test.java with Release 1.2, which is consistent with our observation in Step 13 of the "Test the installation by local users" section.
    Figure 3.
  4. Right-click Test.java and select Show in Resource History. From the Resource History view, you can see when cvsdev1 made the initial revision of Test.java, and when cvsdev2 checked in Test.java to the repository after the code change.
    Figure 4.
    Figure 5.

    5. Finally, right-click project1 and select Add to Workspace. You are all set to work on project1 in Application Developer!

    Figure 6.

Conclusion

This article has described how to configure CVS in RedHat Linux. I hope you have found this article helpful and I welcome all feedback.

Top of page


Acknowledgments

The author wishes to thank David Van and Joseph Chiu, Software Development Analysts, IBM Toronto Lab, for reviewing this article.

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=13875
ArticleTitle=Team Development with WebSphere Studio Application Developer 4.0: Part 3 -- Installing and Configuring CVS on RedHat Linux 7 as an SCM Repository
publish-date=05302002