Open rar file or Extract rar files under Linux or UNIX

download binary package from official rarlab site:
$ cd /tmp
$ wget http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz

Untar file
$ tar -zxvf rarlinux-3.6.0.tar.gz

Both unrar and rar commands are located in rar sub-directory. Just go to rar directory:
$ cd rar
$ ./unrar

Now copy rar and unrar to /bin directory:
# cp rar unrar /bin

How to use unrar

unrar command supports various options below are common options that you need to use everyday.

Task: To open rar (unpack) file in current directory type command:

$ unrar e file.rar

Please note that replace file.rar filename with your actual filename.

Task: List (l) file inside rar archive:

$ unrar l file.rar

Task: To extract (x) files with full path type command:

$ unrar x file.rar

(D) To test (t) integrity of archive, file type command:
$ unrar t file.rar

PHP 5.3 upgrade in Centos 5.3

I’ve finally figured out a way to install PHP 5.2.x instead of PHP 5.1 which installs on CentOS 5.3 by default. I’ve wanted to use phpMyAdmin 3.x but could not because of this. Now I can, and if you keep reading you will too. Note if you follow this how-to and do everything correctly you won’t even loose your current database. But I highly recommend you backup your database before you proceed.

 

## First lets download this following repositories:
<code>

 

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://rpms.famillecollet.com/el5.i386/remi-release-5-6.el5.remi.noarch.rpm

 

</code>

 

## Lets remove old MySQL 5, will install newer version later.
yum remove mysql

 

## Now lets install them:
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

 

## OK, Now you should be able to install PHP 5.2.9 without a problem =)
yum –enablerepo=remi update php-cli
OR
yum –enablerepo=remi update php*

 

## Now install MySQL
yum –enablerepo=remi install mysql mysql-server
chkconfig -levels 235 mysqld on
service mysqld start

 

If you get the following error when you try starting newly installed MySQL;
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

 

## Now install PHP-MySQL module
yum –enablerepo=remi install php-mysql

 

1. Try restarting your web server;
service lighttpd restart
or
service httpd restart

 

2. Type this command:
cd /

 

3. Restart your mysql server;
service mysqld restart

 

## Set root and hostname passwords
mysqladmin -u root password ‘new_pass_here’
mysqladmin -h server.yourdomain.com -u root password ‘new_pass_here’

 

When it asks you to import signature, do it. press y and hit enter. It should ask you twice.

 

I use the first one because I don’t have Apache Web Server, I use LightTPD.

 

## Now run update on your system.
yum –enablerepo=remi update

 

 

How to setup a Subversion Repository for PHP Development

Being a PHP developer and a System Administrator, Setting up the development environment and Development both are my Key Responsibilities. For years, I have been away from the Source control, but as you grow, your needs also grow to get more managed and secure.

One fine day, I went through the process of version control in PHP basically Subversion. Initially, the idea sounded very good, however, a new issue came to my mind that although, the source code will be version controlled, yet, how the actual work done by the developers will be previewed?

Suppose I have some code that is not under source control system. The project is located at
“/var/www/html/x”

I have a common svn repository location at
“/var/svn/”, so Project x svn repository will be “/var/svn/x”

For achieving this, I follow these instructions

#svnadmin create /var/svn/x
#cd /var/www/x
#svn import file:///var/svn/x -m "Initial Import"
#cd /var/svn/x/conf
#vi svnserve.conf

Write these lines in this file

[general]
anon-access = none
auth-access = write
password-db = passwd

Save and Exit the vi editor

#vi passwd

Add these lines in this file.

[users]
anil = konsal

save and exit the vi editor

#cd /var/www/html
#mkdir x
#svn checkout svn://127.0.0.1/var/svn/x x
#cd /var/svn/x/hooks
#cp post-commit.tmpl post-commit
#chmod 755 post-commit
#vi post-commit

Goto the end of file

and write

/usr/bin/svn update /var/www/html/x

Save and quit vi

#cd ..
#mkdir logs
#touch logs/post-commit.log
#chown -Rv apache.root /var/svn/x