Monday 23 January 2017

How to configure SVN Server (Subversion Edge) on CentOS/Red Hat


Apache Subversion (often abbreviated SVN, after its command name svn) is a software versioning and revision control system distributed as open source under the Apache License. Software developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly compatible successor to the widely used Concurrent Versions System (CVS).

In this tutorial, I am using CollabNet Subversion Edge. It simplify Apache Subversion installation, automate upgrades, and manage code, instances, and users in a centralized, simple way. You can add your preferred Subversion clients and pick from a range of integrations to further extend your Subversion platform.

You can download free CollabNet Subversion Edge from following link.


Use the following steps to install svn server in your linux system,

1. Install and configure jdk.



    Download jdk-version.tar.gz from


                 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


   Extract the downloaded jdk. 


                   # tar -xzf jdk-version.tar.gz


   Set environmental variable. 


                    Edit vim .bash_profile  --->  export PATH=(path of jdk bin):$PATH  (in centos,redhat....) 
           Edit vim .profile           --->  export PATH=(path of jdk bin):$PATH  (in ubuntu,mint....)



2. Create user svn.


[root@centos ~]# useradd svn

[root@centos ~]# passwd svn





3. Copy CollabNetSubversionEdge-5.1.5_linux-x86_64 to svn users home directory.


[root@centos ~]# cp CollabNetSubversionEdge-5.1.5_linux-x86_64.tar.gz  /home/svn/


4. Switch to svn user and add java environmental variable.


[root@centos ~]# su - svn


5. Open ".bash_profile" and add jdk path in it.


[svn@centos ~]$ vim .bash_profile

export PATH=/root/jdk1.8.0_112/bin/:$PATH







6. Extract package 


tar -xvf CollabNetSubversionEdge-5.1.5_linux-x86_64.tar.gz 




7. go to configuration folder and change csvn.conf.dist to csvn.conf


[svn@centos conf]$ cp -rp csvn.conf.dist  csvn.conf







8. Edit csvn.conf


Search for "JAVA_HOME" and uncomment this line and add jdk path. Change RUN_AS_USER=root

[svn@centos conf]$ vim csvn.conf














9. Go to bin directory and start svn.


[root@centos ~]# cd /home/svn/csvn/bin/
[root@centos bin]# ./csvn start









10. Install the application. 


[root@centos csvn]# sudo -E bin/csvn install



This installs the application so that it will run at startup. The script will swap to the user specified before it starts the console. Please note the JAVA_HOME requirement - you must have set the environment variable for your profile (or the entire system) so that it will be visible when the process starts.
When you install csvn as a service, you can control it with these commands:


    $ sudo service csvn status
    $ sudo service csvn start
    $ sudo service csvn stop


11. There are also scripts for Apache server, but you should visit the console first and go the Admin page to set the port and other options before you try to start it. It can also be started from the web UI.


[root@centos csvn]# bin/csvn-httpd start
[root@centos csvn]# sudo bin/csvn-httpd install







12.Test SVN Server.


The default username and password will be "admin"


















Tuesday 6 December 2016

How to schedule postgresql auto vacuum in linux



Step 1: Create a .pgpass file under your home directory.


                   [root@centos6 ~]# vim .pgpass

                                localhost:5432:DB-Name:Username:Password


Step 2: Install Crond packages.  http://www.admincool.in/2016/09/how-to-scheduling-crontab-for-     backup.html

Step 3: Edit crontab


                  [root@centos6 ~]# crontab -e

                  30      10      *      *      *      /opt/PostgreSQL/9.4/bin/psql dbname=bayaTRADETest --username=dbuser -c 'VACUUM FULL VERBOSE'


Step 4: Restart crontab


                 # service crond restart


Step 5: Add crontab on startup


                # chkconfig crond on





Description


Vacuum reclaims storage occupied by dead tuples. In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table; they remain present until a Vacuum is done. Therefore it's necessary to do Vacuum periodically, especially on frequently-updated tables.


With no parameter, Vacuum processes every table in the current database that the current user has permission to vacuum. With a parameter, Vacuum processes only that table.

Plain Vacuum (without FULL) simply reclaims space and makes it available for re-use. This form of the command can operate in parallel with normal reading and writing of the table, as an exclusive lock is not obtained. However, extra space is not returned to the operating system (in most cases); it's just kept available for re-use within the same table. Vacuum FULL rewrites the entire contents of the table into a new disk file with no extra space, allowing unused space to be returned to the operating system. This form is much slower and requires an exclusive lock on each table while it is being processed.

Parameters 


FULL

Selects "full" vacuum, which can reclaim more space, but takes much longer and exclusively locks the table. This method also requires extra disk space, since it writes a new copy of the table and doesn't release the old copy until the operation is complete. Usually this should only be used when a significant amount of space needs to be reclaimed from within the table.

FREEZE

Selects aggressive "freezing" of tuples. Specifying FREEZE is equivalent to performing Vacuum with the vacuum_freeze_min_age parameter set to zero.

VERBOSE

Prints a detailed vacuum activity report for each table.

ANALYZE

Updates statistics used by the planner to determine the most efficient way to execute a query.

table

The name (optionally schema-qualified) of a specific table to vacuum. Defaults to all tables in the current database.

column

The name of a specific column to analyze. Defaults to all columns. If a column list is specified, ANALYZE is implied.


PostgreSQL Vacuum graphically 

Step 1: Right click on database and select maintenance. It will open a pop up window.

Step 2: Select maintenance operation as VACUUM.

Step 3: Select VACUUM option as FULL

Step 4: Click OK