Tuesday, September 8, 2009

SSL for Apache on Ubuntu

1. Install curl:

sudo apt-get install curl

2. Enable SSL module:

sudo a2enmod ssl

3. Restart Apache server:

sudo /etc/init.d/apache2 restart

4. Enable site default-ssl:

sudo a2ensite default-ssl

5. Activate new configuration:

sudo /etc/init.d/apache2 reload

6. Test both http and https output with curl:

curl -k http://localhost
curl -k https://localhost

Both commands will have the same output like this:

<html><body><h1>It works!</h1></body></html>

Subversion and Eclipse

It needs to install subclipse plugin before Eclipse can use Subversion. Please make sure Subversion has been installed on the server and is functional.

1. Start up Eclipse,from Help->Install New Software. Click Add button, type in http://subclipse.tigris.org/update in Location, click OK button. Select subclipse plugin then click Next button twice. Accept license agreement then click Finish button.

2. Restart Eclipse. From Windows->Open Perspective->Other. Highlight the new item SVN Repository Exploring then click OK button. Enter URL with the path of SVN repository, like http://localhost/svn/myproject, then click OK button. The URL just entered will be displayed under SVN Repository. The SVN exploring is ready to use. Multiple Repository can be added through Add SVN Repository button.

Monday, September 7, 2009

Setup Subversion with Apache on Ubuntu

1. Install subversion and libapache2-svn:

sudo apt-get install subversion libapache2-svn

2. Add new group as subversion, and add www-data and subversion users to this group.

3. Logout and login again to become the member of subversion group.

4. Update/etc/apache2/mods-enabled/dav_svn.conf to something like this for the repository at /var/lib/svn/myporject:

DAV svn
SVNP ath /var/lib/svn

AuthType Basic
AuthName "myproject Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user

5. Create directory for repository and setup the ownership and permission:

sudo mkdir /var/lib/svn
cd /var/lib/svn
sudo mkdir myproject
sudo chown www-data:subversion myproject
sudo chmod -R g+rws myproject

6. Create the repository:

sudo svnadmin create /var/lib/svn/myproject

7. Restart Apache server:

sudo /etc/init.d/apache2 restart

8. Create user password:

sudo htpasswd -c /etc/subversion/passwd user

9. Test local svn server setup:

svn co http://localhost/svn/myproject --username username

Note: An empty myproject is checkout.

10. Create a project structure named mywork at the current directory then import the directory to the repository:

svn import -m "New import" mywork http://localhost/svn/myproject

To check the repository, and mywork should be shown up:

svn ls http://localhost/svn/myproject

11. To checkout myproject:

svn co http://localhost/svn/myproject/mywork mywork-new

Sunday, September 6, 2009

Setup CVS server on Ubuntu

1. Install CVS client and server:

apt-get install cvs cvsd

With the default installation, the root for cvsd is at /var/lib/cvsd, and the bin, dev, etc, lib, tmp, and usr directories should be created during the install. The default repositories demo and myrepos are defined in the configuration file /etc/cvsd/cvsd.conf.

2. Start the CVS server:

sudo /etc/init.d/cvsd start

It looks like that the command /etc/init.d/cvsd status has problem to display the correct status of the CVS server, run following command to make sure if the server is running:

ps -def | grep cvsd

If the server is not running, modify the line with the word Listen in the configuration file /etc/cvsd/cvsd.conf:

from "Listen * 2401" to "Listen 2401".

Restart the server and check again.

3. Create myrepos and CVSROOT directories with following command (Note: the absolute path is needed to initialize the repose):

sudo cvs -d /var/lib/cvsd/myrepos init
sudo chown -R cvsd:cvsd /var/lib/cvsd/myrepos

The basic structures of cvsd and the repository $CVSROOT are ready.

4. Add user to the group cvsd and create the password for users.

From System->Administration->Users and Groups. Click Unlock button and enter the password, then click Manage Groups button. Highlight cvsd then click Properties and select the username from the Group Members list.

Create the user password for CVS login as shown below:

cvsd-passwd /var/lib/cvsd/myrepos username

5. The syntax to login to the local CVS server is shown below:

cvs -d :pserver:username@localhost:/myrepos login

However, if the $CVSROOT is defined just simply enter "cvs login" instead. Add following line in ~/.bashrc is the easiest way to add it to the environment.

export CVSROOT=:pserver:username@localhost:/myrepos

If log in has no problem, CVS should be working fine.

6. Following is the syntax to import an example tools project in the current directory to the repository. Please note that the CVS import function requires $CVSROOT defined.

cd tools
cvs import -m "Initial import into CVS" tools initial start

A new directory, tools, is created at /var/lib/cvsd/myrepos.

7. For any reason to completely uninstall cvsd, enter following command:

apt-get --purge remove cvsd

8. In Eclipse environment, the CVS repository location should be defined as /myrepos instead the full path.