Year: 2009

How to configure vpn client on Linux

How to configure vpn client on Linux

This has been tested under RHEL 4/5, CentOS 4.4/5 and fedora 8 (kernel version 2.6.15+)

I found and stored few required rpm packages from various places that you will download from given.

http://www.4shared.com/file/113579629/ee5e0aed/libglade-017-11i386.html
http://www.4shared.com/file/113579642/2fd674e3/libglade-devel-017-11i386.html
http://www.4shared.com/file/113579654/dfaee097/libxml-1817-8i386.html
http://www.4shared.com/file/113579677/7491d3af/libxml-devel-1817-8i386.html
http://www.4shared.com/file/113579714/ba004fa4/php4-pcntl-449-1fc5i386.html
http://www.4shared.com/file/113579747/5e7eea5b/php4-pcntl-gtk-102-4fc5i386.html
http://www.4shared.com/file/113579758/d7dac68b/pptp-172-3fc5i386.html
http://www.4shared.com/file/113579764/f541d963/pptpconfig-20060821-1fc5noarch.html

After downloading these first you will have to install lib packages and then pptp packages

rpm -ivh –nodeps libglade-0.17-11.i386.rpm libglade-devel-0.17-11.i386.rpm  libxml-1.8.17-8.i386.rpm libxml-devel-1.8.17-8.i386.rpm

rpm -ivh pptp-1.7.2-3.fc5.i386.rpm pptpconfig-20060821-1.fc5.noarch.rpm php4-pcntl-gtk-1.0.2-4.fc5.i386.rpm php4-pcntl-4.4.9-1.fc5.i386.rpm

now go to the given image that I would like to show how I added vpn connection

1) open vpnclient configuration launchpad with “pptpconfig”

2)  Now create your profile with all the details and add

Now you have to set you external route or tunnel IP range into it for that click on “Routing” and set  “All to Tunnel” and update your profile.

Now start your vpn client.

–Ravi

Automate script for hp_ltt with read option

Automate script for hp_ltt with read option

Hello Friends,

Many days back, I have configured this storageworks devices of HP and nowadays one of my friend is having like the same issue’s with the os’s to configuring HP storageworks, he has been doing manual driver scan with hp_ltt tool every time when system has been rebooted. Actually there some thing missing with os’s but still this scripts work for him now.

#!/usr/bin/expect  —
# This expect script is useful and working with driver Diagnostic automated tool
# I have tested this over “HP StorageWorks Library and Tape Tools”
# Please change the option number 10 for rescan as per mention in your hp_ltt script.
# Some older hp_ltt script it has option number 9, so please check once this option.
# If you have any queries about this script please send email on ravi <at> indiangnu <dot> org
set timeout -1
spawn ./hp_ltt
match_max 100000
send — “r”
# Look for prompt
expect “ommand>”
# Send option 1 for hardware scan
send — “1r”
send — “r”
# Look for  prompt
expect “ommand>”
# Send option 3 for continue
send — “3r”
send — “r”
# Look for prompt
expect “ommand>”
# send option 10 for rescan
send — “10r”
send — “r”
# Look for prompt
expect “ommand>”
# Send 1 (exit) from L & TT
send — “1r”
send — “r”
expect eof

Suggestion : You have to run this expect script under the $HOME folder of hp_ltt script.

–Ravi

openlsm-0.99 released

openlsm-0.99 released

Dear All,

We are pleased to announce that the openslm-0.99 development platform released on 10th Jun 2009. We are sure that  all contributor’s of openlsm and IndianGNU.org community will start coding for openlsm…

* Please don’t forget to test openlsm and give your valuable feedback/suggestion!

community Blog – http://www.indiangnu.org/

Download openlsm ~

* http://openlsm.sourceforge.net/
http://sourceforge.net/project/showfiles.php?group_id=211420

What is openLSM?

openLSM is web-based control panel designed to make administration of website, GNU/Linux and Unix based operating system easy! openLSM handles all aspects of administration in its interface. It is free/open source software under GPL.

How to install openlsm ~

step 1) cd to the source directory

   ./configure --prefix=/usr/local/openlsm
    OR
    ./configure --prefix=/usr/local/openlsm --with-mysql=/usr/bin/mysql_config --enable-internal-pcre
    --with-geoip=/usr --with-ldap=/usr 	

   make
   make install
step 2) openLSM is using 'openlsm' user and group. please create system user and group and set homedir
    /usr/local/openlsm or 'prefix' value. Confirm ownership/permission of '/usr/local/openlsm'
     directory after installation.

  addgroup --system openlsm
  adduser --system  --home /usr/local/openlsm --shell /bin/false --gid <gid_of_openlsm_group>  openlsm

step 3) How to create a self signed certificate for SSL/TLS

 dd if=/dev/random  of=/tmp/random.dat bs=1024 count=1

 $ openssl genrsa   -out  /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.key
    -rand /tmp/random.dat 2048
 $ openssl req -new -key /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.key
   -out /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.csr

 #generate certificate
 $ openssl x509 -req -days 365 -set_serial 1 -in
  /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.csr
   -signkey /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.key
   -out /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.crt

step 4) please check permission, ownership of /usr/local/openlsm directory and file
        path in openlsm.conf  configuration file...

start openlsm with script in  contrib directory…

./contrib/openlsm start

URL ~ http://<server_name_or_ip>:4050/ or

http://<server_name_or_ip>:4060/

enjoy !!

Regards,
IndianGNU & openlsm

openLSM + Cherokee

openLSM + Cherokee

Dear All,

We are pleased to announce that tomorrow we are launching openslm-0.99 development platform. We are sure that  all contributor’s of openlsm and IndianGNU.org community will start coding for openlsm…

* Please don’t forget to test openlsm and give your valuable feedback/suggestion!

openlsm + Cherokee –

After all ups and  down finally openLSM community has decided to use Cherokee for openlsm admin server. We have customized Cherokee as per your requirement.

Thank you,
openLSM and IndianGNU.org

Partitioning in MySQL

Partitioning in MySQL

Introduction –

Partitioning is available in Oracle since 8i (few feature or type) version but in MySQL it is available after 5.1 version. Partitioning allows you to distribute portions of table across a file system (physically at different location). User can define the partitioning of table so that some portion of table can stored at different physical location….

Table is structure which has columns and rows. Partitioning can be applied to rows or volumes.

* Horizontal partitioning ~ Storing different rows of table to different physical location is called as horizontal partitioning of table.
* Vertical partitioning ~ Storing different columns of table to different physical location is called as vertical partitioning of table.

MySQL supports only support “Horizontal partitioning” !!

** Advantages of using partitions ~

a) Smaller and more manageable pieces of data
b) Faster access of data
c) Import / export at the partition Level
d) Each partitions is independent of other
e) Easy to use
f) Reduced recovery time
g) Failure impact is less

1] How to check whether MySQL installed on your system supports ‘partitioning’ ?

* Check MySQL version as…

root@laptop:~# mysqladmin version -u root -p

* Check ‘partition’ plugin is installed or not… ?

mysql> SHOW PLUGINS;
+————+———-+—————-+———+———+
| Name | Status | Type | Library | License |
+————+———-+—————-+———+———+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL | **

…..

+————+———-+—————-+———+———+
10 rows in set (0.00 sec)

mysql>

* Check above output. If you don’t see ‘partition’ entry in above query. Then MySQL version does not support partitioning. If it entry exist then check “have_partitioning” system variable is set to ‘YES’ or not….

mysql> SHOW VARIABLES LIKE ‘%partition%’;
+——————-+——-+
| Variable_name | Value |
+——————-+——-+
| have_partitioning | YES |
+——————-+——-+
1 row in set (0.00 sec)
Partitioning
mysql>

2] Which storage engines (table type) supports partitioning?

MySQL partitioning engine runs in a separate layer and can interact with any of storage engine. So we can use most of the storage engine as backend/table type to store data. Note we must use same storage engine for all partitions of table.

3] Types of Partitions ~

There are 4 types of partitioning in MySQL or Oracle

a) Range Partitioning
b) List Partitioning
c) Hash Partitioning
d) Key Partitioning

NOTE ~ In any type of partitioning – partitions are always numbered automatically and in sequence starting with 0. When a new row is inserted into a partitioned table, these partition numbers that are used in identifying the correct partition. Also partition names are not case-sensitive. Number of partitions for the table, this must be expressed as a positive, non-zero integer literal with no leading zeroes, and may not be an expression.

MAXVALUE ~ It is an integer value that is always greater than the largest possible integer value (least upper limit).

** Let’s create database ‘mydata’ and create table with each partition type –

mysql> create database mydata;
Query OK, 1 row affected (0.33 sec)

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mydata |
| mysql |
+——————–+
3 rows in set (0.00 sec)

mysql>

A] Range Partitioning ~ table is partitioned by range of values. Each partition contains row which lies within a given range. The ranges should be
contiguous but not overlapping…

mysql> use mydata;
Database changed

mysql> CREATE TABLE cricket (
-> player_name VARCHAR(30),
-> country_name VARCHAR(30),
-> match_count INT,
-> run_scored INT NOT NULL
-> )
-> PARTITION BY RANGE (run_scored)
-> (
-> PARTITION p0 VALUES LESS THAN (26),
-> PARTITION p1 VALUES LESS THAN (51),
-> PARTITION p2 VALUES LESS THAN (76),
-> PARTITION p3 VALUES LESS THAN (101),
-> PARTITION p4 VALUES LESS THAN MAXVALUE
->
-> );
Query OK, 0 rows affected (0.01 sec)

mysql> show tables from mydata;
+——————+
| Tables_in_mydata |
+——————+
| cricket |
+——————+
1 row in set (0.00 sec)

mysql> desc cricket;
+————–+————-+——+—–+———+——-+
| Field | Type | Null | Key | Default | Extra |
+————–+————-+——+—–+———+——-+
| player_name | varchar(30) | YES | | NULL | |
| country_name | varchar(30) | YES | | NULL | |
| match_count | int(11) | YES | | NULL | |
| run_scored | int(11) | NO | | NULL | |
+————–+————-+——+—–+———+——-+
4 rows in set (0.00 sec)

mysql>

*** If cricketer’s score is…
<= 25 then row will go to p0 partition
<= 50 then row will go to p1 partition and so on ..
If score is more than 100 then row will go to p4 partition

* inserting few records to test behavior…

mysql> SELECT * FROM cricket;
+————-+————–+————-+————+
| player_name | country_name | match_count | run_scored |
+————-+————–+————-+————+
| Rahul | India | 2 | 16 |
| Sachin | India | 2 | 56 |
| Saurav | India | 2 | 80 |
| Sachin | India | 1 | 122 |
| Rahul | India | 1 | 153 |
| Saurav | India | 1 | 183 |
+————-+————–+————-+————+
6 rows in set (0.00 sec)

mysql>

** Let’s us check the physical location of database….

root@laptop:~# ls /var/lib/mysql/mydata/
cricket.frm cricket#P#p0.MYD cricket#P#p1.MYD cricket#P#p2.MYD cricket#P#p3.MYD cricket#P#p4.MYD db.opt
cricket.par cricket#P#p0.MYI cricket#P#p1.MYI cricket#P#p2.MYI cricket#P#p3.MYI cricket#P#p4.MYI
root@laptop:~#

B] LIST Partitioning ~ It is similar to range partitioning. But each partition is defined based on the columns value which is one of value in lists,
rather than in one of a set of contiguous ranges of values…

mysql> CREATE TABLE world (
-> country_name VARCHAR(25) NOT NULL,
-> country_id INT NOT NULL
-> )
-> PARTITION BY LIST (country_id)
-> (
-> PARTITION asia VALUES IN (91,95,35,20),
-> PARTITION europe VALUES IN (10,16,82,84),
-> PARTITION america VALUES IN (12,25),
-> PARTITION australia VALUES IN (60,65)
-> );
Query OK, 0 rows affected (0.02 sec)

mysql> show tables;
+——————+
| Tables_in_mydata |
+——————+
| cricket |
| world |
+——————+
2 rows in set (0.00 sec)

mysql>

* inserting few records to test behavior…

mysql> SELECT * FROM world;
+————–+————+
| country_name | country_id |
+————–+————+
| India | 91 |
| Sri Lanka | 95 |
| France | 10 |
| U.K. | 16 |
| Canada | 12 |
| Brazil | 60 |
+————–+————+
6 rows in set (0.00 sec)

mysql>

** What if ‘country_id’ value NOT matching with lists values ?

=> use IGNORE keyword while inserting records… let’s try

mysql> INSERT IGNORE INTO world VALUES (‘South Africa’,50);
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM world;
+————–+————+
| country_name | country_id |
+————–+————+
| India | 91 |
| Sri Lanka | 95 |
| France | 10 |
| U.K. | 16 |
| Canada | 12 |
| Brazil | 60 |
+————–+————+
6 rows in set (0.00 sec)

mysql>

C] HASH Partitioning ~ HASH is used primarily to ensure an even distribution of data among a all number of partitions. If you do not include a
PARTITIONS clause while creating table with HASH partitioning, the number of partitions by defaults is one(1). The partition in
which the record is stored is determined by which_partition = MOD(expression, total_no_partition)

mysql> CREATE TABLE africa (
-> country_name VARCHAR(50),
-> population INT,
-> census_date DATE NOT NULL DEFAULT ‘2000-01-01’
-> )
-> PARTITION BY HASH (YEAR(census_date))
-> PARTITIONS 5;
Query OK, 0 rows affected (0.01 sec)

mysql> show tables;
+——————+
| Tables_in_mydata |
+——————+
| africa |
| cricket |
| world |
+——————+
3 rows in set (0.01 sec)

mysql>

mysql> SELECT * FROM africa;
+————–+————+————-+
| country_name | population | census_date |
+————–+————+————-+
| Nigeria | 2278032 | 2008-09-18 |
| Egypt | 21278032 | 2008-05-28 |
| South Africa | 1678032 | 2009-04-20 |
+————–+————+————-+
3 rows in set (0.00 sec)

mysql>

D] KEY Partitioning ~ It is similar to partitioning by hash, except that where hash partitioning employs a user-defined expression.

4] Subpartitioning ~

It is also known as composite partitioning in which partition is divided in to sub partition. Use SUBPARTITION clauses while creating table.

**Few useful command to know more about tables –

mysql> SHOW CREATE TABLE cricket \G
*************************** 1. row ***************************
Table: cricket
Create Table: CREATE TABLE `cricket` (
`player_name` varchar(30) DEFAULT NULL,
`country_name` varchar(30) DEFAULT NULL,
`match_count` int(11) DEFAULT NULL,
`run_scored` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (run_scored)
(PARTITION p0 VALUES LESS THAN (26) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (51) ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (76) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (101) ENGINE = MyISAM,
PARTITION p4 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
1 row in set (0.00 sec)

mysql>

** Below statement will give information about all tables in given DB…

mysql> SHOW TABLE STATUS FROM mydata;

Thank you,
Arun Bagul

WebSVN 2.2 best tool to browse your svn repository

WebSVN 2.2 best tool to browse your svn repository

Introduction

Recently we started development work on  openSLM. As per our plan we will complete  openLSM web server  customization within two months from now…

So I installed Subversion and WebSVN latest version to serve by purpose. WebSVN 2.2 is one of the best tool to view or browse your subversion repository on web  by using  WebSVN and apache or any other web server. you can  download WebSVN from here http://websvn.tigris.org/

Requirement – webserver (apache) + PHP + subversion repository

1] How to configure –


Download the WebSVN as mentioned above then place the downloaded source in apache htdocs where you want.
Go to include directory where you will see one file like config.php.dist something like that rename that file
“config.php” and just modify few parameter as listed below ….

//////////////////  arun ////////////////////

$config->setSVNCommandPath(‘/usr/bin’);
$config->setDiffPath(‘/usr/bin’);
$config->setEnscriptPath(‘/usr/bin’);
$config->setSedPath(‘/bin’);
$config->setTarPath(‘/bin’);
$config->setGZipPath(‘/bin’);

$config->addRepository(‘openlsm_webserver’,’/home/subversion/openlsm_webserver_apr2009′);

* above “openlsm_webserver” is my repository name and “/home/subversion/openlsm_webserver_apr2009” is physical path of
svn repository

2] How to enable  authentication ~

In old version fo WebSVN (I guess 1.6 ) authenication per repository  was not possible (as I remember). Now WebSVN 2.2 version  you can configure WebSVN to use the Subversion authentication or access file to control access via WebSVN + Apache based authentication

$config->useAuthenticationFile(‘/path/to/accessfile’); // Global access file
$config->useAuthenticationFile(‘/path/to/accessfile’, ‘myrep’); // Access file per repository

* That’s it all you need to use this wounderful tool to browse your svn repositories….

Thank you,
Arun Bagul

Subversion – How to configure with Apache WebDAV or svnserve

Subversion – How to configure with Apache WebDAV or svnserve

1] What is Subversion?

Subversion is a beautiful free/open source tool (software) to manage changes made to your information. Subversion manages files and directories, and the changes made to them over time. This allows you to recover older versions of your data or examine the history of how your data changed. Subversion can operate across networks, which allows it to be used by people on different computers.

2] Different methods of accessing subversion (svn) repository ?

There are three different methods of accessing subversion repository…

a) Local filesystem or Network filesystem accessed by client directly
b) Apache HTTP using WebDAV module
c) svnserve tunneled over an SSH (svn + ssh)

For more informatio, please refer the article http://www.indiangnu.org/2006/different-methods-of-accessing-subversion-svn-repository/

3] Subversion architectue –

Subversion provides two backends to store the data in svn repository

a) FSFS – Fast and Secure File Systtem –

FSFS backend provides quite a bit more flexibility in terms of its supported deployment scenarios. More flexibility means you have to work a little harder to find ways to deploy it incorrectly. FSFS is the default backend

b) Berkeley DB File system –

Berkeley DB provides real transaction support—perhaps its most powerful feature. Another great feature of Berkeley DB is hot backups—the ability to backup the database environment without taking it “offline”. But Berkeley DB environments are not portable!!

root@arun:~# ls -l  /var/repos_base/myrepository/
total 28
drwxr-xr-x 2 arunsb www-data 4096 2008-12-27 15:30 conf
drwxr-xr-x 2 arunsb www-data 4096 2008-12-26 16:34 dav
drwxr-sr-x 5 arunsb www-data 4096 2008-12-27 15:27 db
-r–r–r– 1 arunsb www-data    2 2008-12-26 16:34 format
drwxr-xr-x 2 arunsb www-data 4096 2008-12-26 16:34 hooks
drwxr-xr-x 2 arunsb www-data 4096 2008-12-26 16:34 locks
-rw-r–r– 1 arunsb www-data  229 2008-12-26 16:34 README.txt
root@arun:~#

root@arun:~# cat /var/repos_base/myrepository/db/fs-type
fsfs
root@arun:~#

4] How Install Subversion –

Ubuntu –

root@arun:~# apt-get install  subversion  subversion-tools
5] How to configure Subversion with Apache HTTP and WebDAV module –

Step (1) First of all we need to create the subversion repository….

root@arun:~# svnadmin create /var/repos_base/myrepository
root@arun:~#

* Make sure to set/change owership/permission of svn repository for Apache webserver user (www-data is apache user)

root@arun:/var/repos_base# chown arunsb:www-data -R /var/repos_base/
root@arun:~# chmod  775 -R /var/repos_base/
root@arun:~#
root@arun:~# ls -l /var/repos_base/
-rwxrwxr-x 1 arunsb www-data   63 2008-12-03 15:50 common_userdb
drwxrwxr-x 7 arunsb www-data 4096 2008-12-03 15:48 myrepository
root@arun:~#

Step (2) Authentication – common user DB for all repositories –

Let us create a file “/var/repos_base/common_userdb” which will contain users information in file and add few users…

root@arun:/var/repos_base# htpasswd  -c /var/repos_base/common_userdb   arunsb
New password:
Re-type new password:
Adding password for user arunsb

root@arun:/var/repos_base# htpasswd  /var/repos_base/common_userdb  ravi
New password:
Re-type new password:
Adding password for user ravi

root@arun:/var/repos_base# htpasswd  /var/repos_base/common_userdb  santhosh
New password:
Re-type new password:
Adding password for user santhosh

root@arun:/var/repos_base# cat /var/repos_base/common_userdb
arunsb:dXxZU5vmHxFoc
ravi:gGEX.dsWcwqzc
santhosh:Jlzed1almY.SY
root@arun:/var/repos_base#

Step (3) Now install Apache , WebDav module for apache –

Ubuntu –

root@arun:~# apt-get install apache2  apache2.2-common  libapache2-svn

you need to enable to WebDAV svn module for apache using following command on Ubuntu…

root@arun:~# a2enmod dav   dav_svn
root@arun:~#

* Make sure that Apache is running ….

Step (4) Configure svn repository with apache –

root@arun:~# cat /etc/apache2/mods-available/dav_svn.conf
# dav_svn.conf – Subversion/Apache configuration

<Location /myrepository>

DAV svn

#You need either SVNPath and SVNParentPath, but not both.
#use SVNParentPath if you have multiple repositories under one directory

SVNPath /var/repos_base/myrepository
#SVNParentPath /var/repos_base

# Access control is done at 3 levels –
#(1) Apache authentication
#(2) Apache <Limit> and <LimitExcept>
#(3) mod_authz_svn is a svn-specific authorization module

AuthType Basic
AuthName “|| Welcome to Subversion Repository || ”
AuthUserFile /var/repos_base/common_userdb

#To enable authorization via mod_authz_svn
AuthzSVNAccessFile  /var/repos_base/myrepository/conf/authz
Require valid-user

#<LimitExcept GET PROPFIND OPTIONS REPORT>
#Require valid-user
#</LimitExcept>

</Location>

## Add entry for other svn repositories

root@arun:~#

* Once done restart the Apache server and try to access svn repository as …

root@arun:~# svn list http://server_name_or_IP/your_repository_name_mentioned_in_dav_svn.conf_file

please refer the article for more operation http://www.indiangnu.org/2006/different-methods-of-accessing-subversion-svn-repository/

6] How to configure Subversion with svnserve tunneled over an SSH (svn + ssh) –

Step (1) Make sure that subversion is installed and repository is created…

Start up script for svnserve is as shown below (ubuntu), please update this file with proper setting…

root@arun:~# cat /etc/init.d/svnserve
#!/bin/bash

# startup script for svn server!
## svnserve  –daemon  –listen-port   3690  –pid-file /var/run/svn.server

SVN_DAEMON=”/usr/bin/svnserve”
PID_FILE=”/var/run/svn-server.pid”
LOG_FILE=”/var/log/svnserve.log”
SVN_PORT=3690
SVN_ROOT=”/var/repos_base”
case “$1” in

start)
if [ -f  $PID_FILE ];then
check=$(cat $PID_FILE)
echo “Subversion service (svnserve) already running [pid = $check]”
else
echo “Starting the Subversion service (svnserve)..”
$SVN_DAEMON  –daemon –root $SVN_ROOT  –listen-port $SVN_PORT –pid-file $PID_FILE  > $LOG_FILE 2>&1
echo “log file is $LOG_FILE”
echo “…”
echo “Done.”
fi
;;

stop)
echo “killing Subversion service (svnserve)…”
if [ -f  $PID_FILE ];then
#killall svnserve
kill -9 $(cat $PID_FILE)
rm  $PID_FILE
echo “…”
echo “Done.”
else
echo “NOT running…”
fi
;;

status)
if [ -f  $PID_FILE ];then
echo “Subversion service (svnserve) -”
pid_of_svnserve=$(cat $PID_FILE)
echo -e “Running & pid is $pid_of_svnserve”
else
echo “Subversion service (svnserve) NOT running…”
fi
;;

*)
echo “Usage: $0  {start|stop|status}”
exit 1
esac
exit 0
#DONE
root@arun:~#

Step (2) svnserve  configuration –

root@arun:~# cat /var/repos_base/myrepository/conf/svnserve.conf
### This file controls the configuration of the svnserve daemon, if you

[general]
### Authenticated users.  Valid values are “write”, “read”,
### and “none”.  The sample settings below are the defaults.
### The password-db option controls the location of the password file
### The authz-db option controls the location of the authorization
### rules for path-based access control.

realm = || Welcome to Subversion Repository ||
anon-access = none
auth-access = write
authz-db = authz
password-db = passwd

root@arun:~#

Step (3) Authentication for svnserve –

root@arun:~# cat /var/repos_base/myrepository/conf/authz
# single user, to a group of users defined in a special [groups]
# section, or to anyone using the ‘*’ wildcard.  Each definition can
# grant read (‘r’) access, read-write (‘rw’) access, or no access (”)

[groups]
svn_admin = arunsb , ravi

# remember here svn name which you mentioned in “dav_svn.conf” file

[myrepository:/]
@svn_admin= rw

[myrepository:/branches]
@svn_admin = rw
santhosh = r

[myrepository:/trunk]
@svn_admin= rw
santhosh = rw

root@arun:~# cat /var/repos_base/myrepository/conf/passwd
### Below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]

arunsb = 1234
ravi   = 1234
santhosh = 12345
root@arun:~#

Step (4) Start svnserve with following command –

root@arun:~# /etc/init.d/svnserve
Usage: /etc/init.d/svnserve  {start|stop|status}
root@arun:~#
root@arun:~# /etc/init.d/svnserve  start
Starting the Subversion service (svnserve)..
log file is /var/log/svnserve.log

Done.
root@arun:~# /etc/init.d/svnserve  status
Subversion service (svnserve) –
Running & pid is 11346
root@arun:~#

root@arun:~# netstat -nlp |  grep svnserve
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN      11346/svnserve
root@arun:~#

** HELP ?

root@arun:~# svnserve  –help
usage: svnserve [options]

Valid options:
-d [–daemon]            : daemon mode
–listen-port arg        : listen port (for daemon mode)
–listen-host arg        : listen hostname or IP address (for daemon mode)
–foreground             : run in foreground (useful for debugging)
-h [–help]              : display this help
–version                : show program version information
-i [–inetd]             : inetd mode
-r [–root] arg          : root of directory to serve
-R [–read-only]         : force read only, overriding repository config file
-t [–tunnel]            : tunnel mode
–tunnel-user arg        : tunnel username (default is current uid’s name)
-T [–threads]           : use threads instead of fork
-X [–listen-once]       : listen once (useful for debugging)
–pid-file arg           : write server process ID to file arg

root@arun:~#

Troubleshooting –

arunsb@arun:~$ svn co svn://192.168.0.1/myrepository/trunk/  /tmp/12345
svn: Not authorized to open root of edit operation
arunsb@arun:~$

* please add “anon-access = none” to ‘svnserve.conf’ conf file of your repository…

root@arun:~# vi /var/repos_base/myrepository/conf/svnserve.conf

arunsb@arun:~$ svn co svn://192.168.0.1/myrepository/trunk/   /home/arunsb/working_svn
Authentication realm: <svn://192.168.0.1:3690> ” || Welcome to Subversion Repository ||”
Password for ‘arunsb’:
Checked out revision 2.
arunsb@arun:~$

Thank you,

Arun Bagul

Epoch or Unix timestamp and Date format

Epoch or Unix timestamp and Date format

What is Epoch time ?

Unix time, or POSIX time is also know as Epoch time. Linux/Unix operating systems maintain system time based on some starting time called the Epoch. In Linux/Unix and POSIX systems count time as seconds since midnight Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds. It is widely used not only on Unix-like operating systems but also in many other computing systems. Epoch time is in seconds!!

1] How to get Epoch time ?

* Linux / Ubuntu

root@arun:~# date
Wed Jan 28 23:52:12 IST 2009

root@arun:~# date +%s
1233166934
root@arun:~#

* FreeBSD

root@arun:~# date
Wed Jan 28 11:07:10 IST 2009

root@arun:~# date  +%s
1233169634
root@arun:~#

2] How to convert Epoch time into Date format ?

* Linux / Ubuntu

arunsb@arun:~$ date -d ‘1970-01-01 1233167307 sec’
Wed Jan 28 18:28:27 IST 2009
arunsb@arun:~$

* FreeBSD

arunsb@arun:~# date -r 1233169468
Wed Jan 28 11:04:28 IST 2009
arunsb@arun:~#

3] How to convert Date time into Epoch ?

* Linux / Ubuntu

arunsb@arun:~$ date ; date +%s
Thu Jan 29 00:26:48 IST 2009
1233169008
arunsb@arun:~$ date -d ‘Thu Jan 29 00:26:48 IST 2009’ +%s
1233169008
arunsb@arun:~$ date -d ‘Thu Jan 29 00:26:48 IST 2009’ +%s
1233169008
arunsb@arun:~$

* FreeBSD

root@arun:~#  date -j -f ‘%Y-%m-%d %H:%M:%S %Z’ ‘2009-01-29 00:50:04 PST’ +%s
1233219004

root@arun:~#  date -j -f ‘%Y-%m-%d %H:%M:%S %Z’ ‘2009-01-29 00:50:04 GMT’ +%s
1233190204
root@arun:~#

Thanks,
Arun Bagul