Tuesday, April 16, 2013

Steps to Install Xampp/Lampp on CENTOS 6.x / RHEL / FEDORA

Steps to Install Xampp/Lampp on CENTOS 6.x

1. Update your CentOS

                 # yum update
2. Install glibc libraries required for XAMPP.
#yum –y install glibc.i686
3. Download the xampp 1.8.1

                 # wget http://www.apachefriends.org/download.php?xampp-linux-1.8.1.tar.gz

4. Extract the downloaded archive file to /opt:

                # tar xvfz xampp-linux-1.8.1.tar.gz -C /opt

5. XAMPP was designed to run on 32 bit operating systems. The start up script will prevent xampp from starting up if you are running on a 64 bit system which isn’t necessary since you installed 32 bit compatibility libraries in step 1. To get around this restriction, open /opt/lampp/lampp in an editor and comment out the following lines.

# XAMPP is currently 32 bit only
#case `uname -m` in
# *_64)
#   if /opt/lampp/bin/php -v > /dev/null 2>&1
#   then
#      :
#   else
#      $de && echo "XAMPP gibt es zur Zeit nur als 32-Bit Applikation.
#      Bitte verwende eine 32-Bit Kompatibilitaetsbibliothek fuer Dein
#      System."
#      $de || echo "XAMPP is currently only availably as 32 bit
#      application. Please use a 32 bit compatibility library for
#      your system."
#   exit
#   fi
#   ;;
5. Now start lampp

                # /opt/lampp/lampp start

6. Now type http://localhost in browser and hit enter. Now we will see "XAMPP" welcome page.

7.  For accessing website from outside/external network we have set port forwarding to our local server IP. For example, our Server (XAMPP) IP is listening on Port no.92. Now we have to edit our Xampp httpd.conf file configuration.

Go to line no.52 of /opt/lampp/etc/httpd.conf and change "Listen 80" to "Listen 92".

8. For opening port 92 in firewall we have to type the following commands:
                /* Open or create  file /etc/sysconfig/iptables */
                # vi /etc/sysconfig/iptables
                /* Append firewall rule  in iptable as follows */
                -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 92 -j ACCEPT
                /* Save & close the file. Restart iptables */
                # /etc/init.d/iptables restart

Now we can access XAMPP from remote PC's.

9. Edit /opt/lampp/etc/extra/httpd-xampp.conf and adding Require all granted line at bottom of  block<Directory "/opt/lampp/phpmyadmin"> to have the following code:
<Directory "/opt/lampp/phpmyadmin">
  AllowOverride AuthConfig Limit
  Order allow,deny
  Allow from all
  Require all granted

And also edit “New XAMPP security concept” <LocationMatch> block and change “Deny from all” to “Allow from all”   

10. Now we will add password to the /xampp/,Phpmyadmin,mysql and FTP for security purpose.

                # /opt/lampp/lampp security

11. Now we will move our website pages under “/opt/lampp/htdocs” directory and edit “/opt/lampp/htdocs/index.php” page.
Go to line no. 8 of /opt/lamp/htdocs/index.php and change the following
 header (‘Location:  ‘.$uri.’/YOUR WEBSITE FOLDER LOCATION/’);

12.  Add the following line in “/opt/lampp/etc/my.cnf” file for increasing maximum number of connection pool to MySQL server.  Also change the “user” parameter of [mysqld] from “nobody” to “root”.
             max_connections = 1000

13. Restart XAMPP/LAMPP server
                # /opt/lampp/lampp restart

Thursday, September 13, 2012

Windows Batch Script to Start, Stop and Restart a JAR file or JAVA Process

Windows Batch Script to Start, Stop and Restart a JAR file

To Start a JAR file using a batch script: 

echo Starting Your_JAR_File_Name!

start "
Your_JAR_File_Name" java -jar PATH_TO_Your_JAR_File_Name.jar

To Stop a running JAR file process using a batch script: 

echo Stopping Your_JAR_File_Name!

TASKKILL /f /FI "Windowtitle eq Your_JAR_File_Name"


To Restart a JAR file process using a batch script: 

@echo off
echo You are about to restart


echo Stopping

TASKKILL /f /FI "Windowtitle eq


echo Starting

start "
Your_JAR_File_Name" java -jar PATH_TO_Your_JAR_File_Name.jar

Tuesday, September 11, 2012

Configure NTP to synchronize the system clock in CENTOS/RHEL/FEDORA

CENTOS/RHEL/FEDORA: Configure NTP to synchronize the system clock

/* First install NTP on your system */
# yum install ntp

/* Now turn on NTP service */
# chkconfig ntpd on

/* synchronize your system clock with in.pool.ntp.org server */
# ntpdate  in.pool.ntp.org       //NTP server for India

/* Now start the NTP  Service*/
# /etc/init.d/ntpd start

/* Setting up a cronjob to sync automatically with NTP server every hour */
# crontab –e    // This will open a crontab file

/* Write the following line in the crontab file */
0 */1 * * * ntpdate  in.pool.ntp.org

/* Now save and close crontab file */

Saturday, September 8, 2012

How to access MySQL Server from outside

MySQL Server Remote Access

For accessing MySQL Server remotely from external network you to do port forwarding of SSH port 22 i.e. default port for SSH.

Step1: Edit /etc/my.cnf  
            # vi /etc/my.cnf
# vi /opt/lamp/lamp/etc/my.cnf 
            Now locate file that read as :
            Make sure line skip-networking is commented and add the following line.
            bind-address= your-MySQlServer-IP (i.e. your system’s IP )

Step2: Save and close my.cnf file and restart mysql services.
            #service mysqld restart
#/opt/lamp/lamp restart

Step3: Grant access to remote IP address:
            # mysql –u root –p “password for mysql”
            mysql> GRANT ALL ON *.* TO root@’Your network public IP’ IDENTIFIED BY  ‘PASSWORD’;        

Note: In the above mysql query “*.*’”, first * is indicates all databases and second * indicates all tables. So, if you want give access to a particular database all tables then write this query.
mysql> GRANT ALL ON <Database 1>.* TO root@’Your network public IP’ IDENTIFIED BY  ‘PASSWORD’;
Similarly for giving access to a particular table write the below query.
mysql> GRANT ALL ON <Database 1>.<table1> TO root@’Your network public IP’ IDENTIFIED BY  ‘PASSWORD’; 
mysql> exit

From your remote system or your desktop type the following command:

$ mysql -u root –h –p

§  -u is MySQL username
§  -h IP or hostname is MySQL server IP address or hostname
§  -p : Prompt for password


  You can use SQLYog software to connect from remote location.

How to change default MySQL port in linux

How To Change Mysql Port In Linux

Open and Edit /etc/my.cnf  OR  /opt/lamp/lamp/etc/my.cnf  using your favourite editor.

# vi /etc/my.cnf
# vi /opt/lamp/lamp/etc/my.cnf 

Now find the line Port=3306 (default MySQL port) and change it to :
Port= new port no.   // make sure this port is not used for other     services. (/etc/services)

The below is my system’s my.cnf  file:
user       = root
port       = 3307
socket     = /opt/lampp/var/mysql/mysql.sock
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

Now save and close my.cnf file and restart MySQL services:
#service mysqld restart
#/opt/lamp/lamp restart

How To Reset A Root Password


If you forget or lose your system’s root password, then do the following to reset it.

Entering recovery mode

While is system is starting up, hold down the ctrl key to see the boot loader menu. After you see the menu do the following:
 Ø  Use the arrow keys to select the boot entry you want to modify.
 Ø  Press ‘e’ to edit the menu.
 Ø  Use the arrow keys to go to kernel line.
 Ø  Press ‘a’ or ‘e’ to append this entry.
 Ø  At the end of the line add word ‘single’ or the number ‘1’.
 Ø  Press Enter to accept the changes.
 Ø  Press ‘b’ to boot this kernel.
Now you will be seeing a root prompt.
Now you can change your system’s root password.  As root, changing password doesn’t ask for your old password.
Run this command:
 root@localhost# passwd

Resetting password when boot loader is password protected

 Ø  Boot form the installed OS CD/DVD.
 Ø  Select “Rescue Installed System”
 Ø  Answer the prompt for language & keyboard.
 Ø  Let the rescue mode mount your file systems in the read/write mode.
 Ø  Press Enter to get the shell prompt.
 Ø  At the prompt, enter the following commands.
# chroot /mnt/sysimage
# passwd
# exit
# exit

Thursday, March 1, 2012



1)    Java 1.6 JRE/JDK must be installed.
2)    Python 2.4 or higher version must be installed.
3)    Download CollabNetSubversionEdge-2.2.1_linux (32/64 bit)

Installation Notes:-
Note: Do not untar CollabNetSubversionEdge-2.2.1_linux package using root or sudo. 
This will cause the UID/GID on the files to carry the values from our build system instead 
of being reset.
1.      Install JAVA Runtime Environment package from Add/Remove Software 
(System>Administration>Add/Remove Software) by searching for Java/JRE.
# yum install java-1.6.0-openjdk.x86_64
2.      After Java installation is over, type the following command in Terminal window.
                   export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
And also add the above line to /etc/profile (at the bottom of the file)
#sudo gedit /etc/profile
#sudo vi /etc/profile 
      Now you can check the installed java version by the following command.
      # java –version
        Probably this would be the output:
        java version "1.6.0_22"
         OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-
         OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)  
3.      Add any normal (non-root) user to etc/sudoers file or by the following command.
# visudo
And add the following line anywhere in the file.
username  ALL=(ALL)  ALL

4.      Now migrate to non-root (normal) user and select the folder where you want to install CollabNet Subversion Edge. I would recommend you to install the Subversion in the normal user folder. It can be Downloads/ Documents/ Desktop etc.
[root@localhost ]# su – username

[username@localhost]$ mkdir opt/subversion
Note: If you are not able to create folder “subversion” in “opt” directory, then you can create it through “root” or “sudo”.

[username@localhost]$ cd opt/subversion

[username@localhost]$ sudo chmod o+wx /opt/subversion/

Now move the downloaded CollabNetSubversionEdge-2.2.1-linux-x86_64.tar.gz package to opt/subversion.

5.      Now Untar the CollabNetSubversionEdge-2.2.1-linux-x86_64.tar.gz package by the following command.

[username@localhost subversion]$ tar zxf CollabNetSubversionEdge-2.2.1_linux-x86_64.tar.gz  
Note: The above command will create a folder named “csvn”.

[username@localhost subversion]$ cd csvn

Now we will install the application so that subversion will start automatically when the server restarts. For doing this type the following command.

Note: To set up the server so that it starts automatically when rebooted, you will need to have root/sudo access and follow these steps.
Edit the configuration. When a process is started at server startup it runs as root. You do not want the CSVN console to run as root, you want it to run as a specific user -- whatever your login user is.
  1. To do this, edit the file data/conf/csvn.conf.
$ vi data/conf/csvn.conf
  1. Scroll down a little bit until you see #RUN_AS_USER= . Uncomment it out and add your username.
RUN_AS_USER= username
  1. Save the changes.

[username@localhost csvn]$ sudo –E bin/csvn install

Now we will start the server. Be sure that you are not logged in as root.

[username@localhost csvn]$ bin/csvn start

     This will take a few minutes and the script will loop until it sees that the server is running. 
     Note: If the server does not start, then try starting the server with this command:
            [username@localhost csvn]$ bin/csvn console
6.      Add the following line to /etc/sysconfig/iptables
# iptables -A INPUT –p tcp --dport 3343 –j ACCEPT
Restart firewall to update the changes
# service iptables restart
Installation is done, now open the following link:
username: admin  
password: admin
Note: If you are not able to see your CSVN server on the browser, then just disabled the your system Firewall by entering setup command in the terminal window.
# setup
Go to System>Administration>Firewall and disable it.
Note: You can change the IP address of your subversion server with your machine IP address by editing 
 opt/subversion/csvn/data/conf/csvn.conf file (at line no. 62) by the following command. 
$ sudo vi data/conf/csvn.conf
$ sudo gedit  data/conf/csvn.conf

Subversion Edge also starts an SSL-protected version using a self-signed SSL certificate.
You can access the SSL version on this URL:

Steps to Install Xampp/Lampp on CENTOS 6.x / RHEL / FEDORA

Steps to Install Xampp/Lampp on CENTOS 6.x 1. Update your CentOS                  # yum update 2. Install glibc librarie...