Category Archives: Apps

Installing and Configuring SVN

Introduction

This document focuses on installing and configuring SVN on RedHat Linux as an SCM Repository. Subversion is the popular standard for version control and Software Configuration Management (SCM) for globally distributed organizations. CollabNet Subversion is an enterprise-ready distribution of Subversion that includes certified binaries, platform-specific installers, and certified plugins for Eclipse, HP Quality Center, and IBM Rational ClearCase.
SVN runs on most platforms, including Windows, Linux, AIX, and UNIX. However the most stable platform and the most used platform are Linux and Unix.
There are many variants of subversion available in market, below document is written based on CollabNet Subversion. Thousands of documents, tutorials are available over SVN but I tried to make this post as simple as possible which will help those who are going to use SVN for the first time for any small team size. Various securities, configuration can be set in SVN, which is not in scope of this article.
Follow below steps, user must have root privilege – Please check the latest version available
TortoiseSVN-1.6.8.19260-win32-svn-1.6.11.msi (windows client for SVN operation – download from http://tortoisesvn.net/downloads)

CollabNetSubversion-client-1.6.11-1.i386.rpm (command line client)
i. Import CollabNet GPG key

CollabNet Subversion RPMs are signed using our GPG key. As a one-time task,
import the CollabNet GPG key using the command:

sudo rpm –import /path/to/RPM-GPG-KEY-csvn.asc

The CollabNet GPG key is available for download at:
http://www.collab.net/nonav/downloads/subversion/gpg-key/RPM-GPG-KEY-csvn.asc

ii. First installation

The command to install the CollabNet Subversion RPM, if a previous version
has not already been installed, is:

sudo rpm -ivh /path/to/client.rpm

iii. Updating an existing installation

If you have a previous version of the CollabNet Subversion client RPM installed,
update to the new version by running this command:

sudo rpm -Uvh /path/to/client.rpm

If you also have a previous version of the CollabNet Subversion server RPM
installed, add the –force option to the command:

sudo rpm -Uvh –force /path/to/client.rpm

iv. Post-installation instructions

A. CollabNet Subversion installs into /opt/CollabNet_Subversion, which is
probably not on the executable search path for your system. Add the directory
/opt/CollabNet_Subversion/bin to your $PATH environment variable. In order to
make this change affect all users of your system and persists across reboots,
add the following line to /etc/profile:

PATH=/opt/CollabNet_Subversion/bin:$PATH

B. CollabNet Subversion provides man pages and localizations for several
languages. To take advantage of these features, update your MANPATH and/or
LOCPATH environment variables to include the CollabNet Subversion directories.
For example:

export MANPATH=/opt/CollabNet_Subversion/share/man:$MANPATH
export LOCPATH=/opt/CollabNet_Subversion/share/locale:$LOCPATH

 CollabNetSubversion-server-1.6.11-1.i386.rpm (subversion server)
i. First-time installation

Install the client RPM first. The client RPM includes all of the
Subversion libraries. (Refer to the readme for the client RPM before
continuing.) Once the client is installed, install the server RPM using
this command:

sudo rpm -ivh /path/to/server.rpm

ii. Updating an existing installation

Before updating an existing CollabNet Subversion server installation to the
latest version, follow these steps:

A. Stop the existing server if it is running:

sudo /etc/rc.d/init.d/collabnet_subversion stop

B. Back up local configuration files. The update process does not touch your
repositories at all, but it is possible for you to lose your local
configuration files, such as your Apache configuration or your list of
usernames/passwords. To be safe, copy the contents of this folder to a
safe location:

/etc/opt/CollabNet_Subversion/conf

C. Install the updates. You must update the client RPM first. Follow the
instructions in the readme for the client. Then install the server RPM
using this command:

sudo rpm -Uvh /path/to/server.rpm

D. Run the Configure-CollabNet-Subversion script. Just follow the
Post-installation instructions in the next section. When you run the
Configure script, select No when you are asked if you want to create
new repositories, users, and so on (unless you want to redo those steps).
At the end, the script restarts the server and, if you followed these
instructions, your previous configuration should still be in tact.

If you have problems, you can copy the files you saved in step B back to
their original location.

iii. Post-installation instructions

A. CollabNet Subversion installs into /opt/CollabNet_Subversion, which is
probably not on the executable search path for your system. Add the
directory /opt/CollabNet_Subversion/bin to your $PATH environment
variable. To make this change so it affects all users of your system
and persists across reboots, add the following line to /etc/profile:

PATH=/opt/CollabNet_Subversion/bin:$PATH

B. CollabNet Subversion provides an interactive script which allows you to
choose which Subversion server process you want to run (either Apache or
the custom svnserve daemon) and configure it. The script also walks you
through creating Subversion repositories and setting up of basic
Subversion authentication and authorization. Once you add CollabNet
Subversion to your system’s $PATH environment variable, run the following
script as superuser:

$ sudo Configure-CollabNet-Subversion

C. CollabNet Subversion provides man pages and localizations for several
languages. To take advantage of these features, update your MANPATH and/or
LOCPATH environment variables to include the CollabNet Subversion directories.
For example:

export MANPATH=/opt/CollabNet_Subversion/share/man:$MANPATH
export LOCPATH=/opt/CollabNet_Subversion/share/locale:$LOCPATH

CollabNetSubversion-extras-1.6.11-1.i386.rpm (subversion  extras – viewVC and python bindings)
i. First-time installation

Install the client and server RPM first. The client RPM includes all of the
Subversion libraries. (Refer to the readmes for the client and server RPM
before continuing.) Once the client and server are installed, you install
the extras RPM using this command:

sudo rpm -ivh /path/to/extras.rpm

ii. Updating an existing installation

You must update the client and server RPM first. Follow the instructions
in the readme for the client and server respectively. Then install the extras
RPM using this command:

sudo rpm -Uvh /path/to/extras.rpm

iii. Post-installation instructions

A. CollabNet Subversion installs into /opt/CollabNet_Subversion, which is
probably not on the executable search path for your system.  Add the directory
/opt/CollabNet_Subversion/bin to your $PATH environment variable. To make this
change affect all users of your system and persists across reboots, add the
following line to /etc/profile:

PATH=/opt/CollabNet_Subversion/bin:$PATH

B. CollabNet Subversion provides an interactive script which allows you to
choose which Subversion server process you want to run (either Apache or
the custom svnserve daemon) and configure it. The script also walks you
through creating Subversion repositories and setting up basic
Subversion authentication and authorization. Once you add CollabNet
Subversion to your system’s $PATH environment variable, run the following
script as superuser:

$ sudo Configure-CollabNet-Subversion

C. CollabNet Subversion provides man pages and localizations for several
languages. To take advantage of these features, update your MANPATH and/or
LOCPATH environment variables to include the CollabNet Subversion directories.
For example:

export MANPATH=/opt/CollabNet_Subversion/share/man:$MANPATH
export LOCPATH=/opt/CollabNet_Subversion/share/locale:$LOCPATH

iv. ViewVC configuration
(optional-this will give you browser based control of SVN to user)
ViewVC support currently requires that you use the Apache server option.
When you run the Configure-CollabNet-Subversion script, if you choose the
option to configure an Apache server and the extras RPM has been installed,
then you are asked if you want to configure ViewVC. Answer Yes and the script
adds ViewVC to the Apache configuration.

Start  SVN – /etc/rc.d/init.d/collabnet_subversion start
Stop SVN – /etc/rc.d/init.d/collabnet_subversion stop
SVN Status – /etc/rc.d/init.d/collabnet_subversion status
Default location for installation – /opt/CollabNet_Subversion/
Sample files for SVN Configuration (by default /etc/opt/CollabNet_Subversion/conf) –
The below configuration is required if you don’t use ViewVC and want users will do operations from SVN windows client (e.g. Tortoise). From browser you can only get read only (http download possible) view of all files in svn repositories.
httpd_csvn.conf
<IfDefine csvn_installed>
# CollabNet Subversion DAV settings
Include /etc/opt/CollabNet_Subversion/conf/collabnet_subversion_httpd.conf
</IfDefine>

<IfDefine viewvc_installed>
# CollabNet Subversion VIEWVC settings
Include /etc/opt/CollabNet_Subversion/conf/viewvc_httpd.conf
</ifDefine>

collabnet_subversion_httpd.conf (main configuration file SVN with user level access control – means when users will do check in or delete files it will ask for user name password, this helps for user tracking and their day to day operation on SVN)

ServerName 119.43.8.37:80
Listen 80

User csvn

Group csvn

<Location /svn>
DAV svn
SVNParentPath /admin/svn/repositories
AuthzSVNAccessFile /etc/opt/CollabNet_Subversion/conf/svn_access_file
Satisfy Any
Require valid-user
AuthType Basic
AuthName “Subversion repository”
AuthUserFile /etc/opt/CollabNet_Subversion/conf/svn_auth_file
</Location>

svn_auth_file (file stores the user name and password for authentication)
This file need to be created as administrator –
Steps –

i. touch svn_auth_file (this file must be present in conf directory, in this scenario – /etc/opt/CollabNet_Subversion/conf)

ii. htpasswd -b svn_auth_file username 123@svn (user ‘username’ will be added in svn_auth_file with encrypted password 123@svn)

svn_access_file (this file is used for configuring the folder level access to users by creating groups, users must be present svn_auth_file)

[groups]
servicepower = usera, userb,userc,userc
Admins = Keshab, Satya, Mike

[/KP]
Keshab= rw
Mike = rw
[/TI]
Keshab = rw
Satya = rw
[/DMPM]
Mike = rw
Satya = rw

[/]
keshab = rw
* = r

[KP:/EI]
keshab = rw
Mike= rw

[KP:/Power]
@servicepower = rw
[KP:/Power/Business_Req_Spec]
@power = rw
[KP:/Power/Database]
@power = rw

Add a user for SVN

Administrator can change the password by the following command after deleting the existing entry from svn_auth_file.

# htpasswd -b svn_auth_file username 123@svn_0

In this SVN server, users will be added to the linux system (they won’t be able to ssh login to the server) only for SVN authentication as valid user.
# useradd -d /home/cduser -s /sbin/nologin ohrid
To delete the user just delete the line (having entry of that user id) from the file svn_auth_file. Also remove that user’s id from svn_access_file (where ever it exists). Also delete that user from the linux system too by using command – deluser ohrid

Create Repository

# svnadmin create /admin/svn/repositories/repositoryname

Steps to configure the jconsole

jconsole, a very popularly used JMX-compliant monitoring tool, provides information on performance and resource consumption of applications running on the Java platform.
This can be used to monitor both local applications (those running on the same system as jconsole) and remote applications (those running on other systems).
Local monitoring with jconsole is useful for development and prototyping. Using jconsole locally is not recommended for production environments, because jconsole itself consumes significant system resources. Rather, use jconsole on a remote system to isolate it from the platform being monitored.

There may be lots of document found after googling, but I’ve tried to make this a compact one helpful for users.
There are two ways to configure the jconsole:
1) Configure using the command line properties
2) Using the jmxserverapp.war

1) Configure using the command line properties

In this approach, set the following system properties when you start the Java virtual machine (JVM).

This usually be set in the run.conf located in JBOSS_HOME/bin

JAVA_OPTS=”$JAVA_OPTS -Dcom.sun.management.jmxremote.port=19001 -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false”

JMX URL: service:jmx:rmi:///jndi/rmi://:/jmxrmi

e.g.: service:jmx:rmi:///jndi/rmi://14.23.24.10:19001/jmxrmi

2) Using the jmxserverapp.war file

• Copy the war file located at the above location into the deploy folder of the JBoss instance
e.g.: /opt/jboss/jboss420/jboss-as/server/hjs-rtb1-merch-sprint.com/deploy

• Open the web.xml present in this application (e.g.:/opt/jboss/jboss420/jboss-as/server/hjs-rtb1-merch-sprint.com/deploy/jmxserverapp.war/WEB-INF/web.xml) and edit the values in bold below.

<?xml version=”1.0″ encoding=”UTF-8″?>

<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns=”http://java.sun.com/xml/ns/javaee&#8221; xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#8221; xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#8221; id=”WebApp_ID” version=”2.5″>

<display-name>JMXPortServer</display-name>

 

<context-param>

<param-name>registryport</param-name>

<param-value>19012</param-value>

</context-param>

<context-param>

<param-name>server</param-name>

<param-value>14.23.24.10</param-value>

</context-param>

<context-param>

<param-name>rmiserverport</param-name>

<param-value>19013</param-value>

</context-param>

<servlet>

<servlet-name>JMXPortServer</servlet-name>

<servlet-class>com.sprint.server.JMXPortServer</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>JMXPortServer</servlet-name>

<url-pattern>/JMXPortServer</url-pattern>

</servlet-mapping>

 

<welcome-file-list>

<welcome-file>index.html</welcome-file>

<welcome-file>index.htm</welcome-file>

<welcome-file>index.jsp</welcome-file>

<welcome-file>default.html</welcome-file>

<welcome-file>default.htm</welcome-file>

<welcome-file>default.jsp</welcome-file>

</welcome-file-list>

</web-app>

• Open the run.conf and add the below system properties

JAVA_OPTS=”$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false”

• Restart the server instance using the startup scripts

JMX URL: service:jmx:rmi://:/jndi/rmi://:< registryport>/server

e.g.: service:jmx:rmi://14.23.24.10:19013/jndi/rmi://14.23.24.10:19012/server
Run jconsole:
Start jconsole by typing jconsole in a command shell. (This will be located in JAVA_HOME/bin) When you start jconsole without any arguments, it will automatically detect all local Java applications, and display a dialog box that enables you to select the application you want to monitor. Both jconsole and the application must by executed by the same user name, since the monitoring and monitoring system uses the operating system’s file permissions.
For remote Java applications, run the jconsole in a command shell and provide the JMX URL to connect.

Select the Remote Process and provide the JMX URL, which can be constructed as described above and click connect