Friday, November 22, 2013

Launching New Instance on Amazon Cloud (AWS)

Lgoin to the AWS console and go to EC2 Dashboard, click instances





Now you would get the wizard to launch the process:

1. Select the desired reinstalled environment (Windows, Linux)


2. Choose the instance type such as m1.small, m1.medium as per the hardware requirment you need for the application you going to run on it




3. Configure the Instance details as number of instances, Network, Subnet and Public IP etc.




4. Add Storage, here you can add storage to the instance as per requirments


5. Now Choose the Security Group or you can configure it later time, give it a name and you can review it


 6. Choose the key pair for authentication


 Now you are good to go and your instance is ready to use.

























Thursday, October 24, 2013

Recover/Reset MySQL root Password

Step1 : Stop mysql service

# /etc/init.d/mysqlsd stop

Step 2: Start to MySQL server without password:
# mysqld_safe --skip-grant-tables &
Output:

[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

Step 3: Connect to mysql server:
# mysql -u root
Output:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

Step 4: Setup new MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-MySQL_ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step 5: Stop MySQL Server:
# /etc/init.d/mysql stop
Output:

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended
[1]+ Done mysqld_safe --skip-grant-tables

Step 6: Start MySQL server:
# /etc/init.d/mysqld start
# mysql -u root -p

and now you can log in with your new password!

Friday, September 6, 2013

Jetty Web Server on CentOS 6



Download Jetty 7 from the website http://www.eclipse.org/jetty/. I have decided to install Jetty located at /srv rather than /opt but you can install it anywhere you like. I ran the following commands to help with the installation.

#cd /srv


wget http://download.eclipse.org/jetty/7.4.5.v20110725/dist/jetty-distribution-7.4.5.v20110725.tar.gz


#tar zxf jetty-distribution-7.4.5.v20110725.tar.gz


#ln -s jetty-distribution-7.4.5.v20110725 jetty


The last command just creates a link from the directory jetty to the directory created when you extracted the tar archive. Next I shall show you how to create a user to run Jetty with. You can also make it run on startup automatically so that when you reboot you do not need to start it.


#adduser -r -m jetty

#chown -R jetty:jetty /srv/jetty

#cd /etc/init.d

#ln -s /srv/jetty/bin/jetty.sh jetty

#chkconfig --add jetty

#chkconfig --level 345 jetty on


You will need to add some values so that Jetty can find your default java install and to set the port which you wish to add jetty to. You can add these values to either jetty.sh or /etc/default/jetty which is the preferred way of configuring applications on Linux.


You should now be able to start Jetty freely with the following command.


#service jetty start

Wednesday, July 10, 2013

Setting up the Subversion Sync between two Server (Primary-Secondary)


I assume that you have working Primary Subversion Server.  I also assume that you have new Subversion Server that would act as a Secondary Server. All the action should be done on Secondary Server.

Primary Server: https://svn.vaseem/svn/reponame/
Secondary Server: https://svn.vaseem2.com/svn/reponame/
     
1.  Create the repo (claimcolony) with the following command or by GUI
svnadmin create "C:\Repositories\reponame”
we can check the revision and other information by the following command
svn info https://svn.vaseem.com/svn/reponame/
Path: igdbatchtool
URL: https://svn.vaseem/svn/xyzrepo
Repository Root: https://svn.vaseem/svn/xyzrepo
Repository UUID: aaac7bac-4d54-a44b-87f7-7681aaadcd9b
Revision: 0
Node Kind: directory
Last Changed Rev: 0
Last Changed Date: 2012-07-06 05:55:11 -0700 (Fri, 06 Jul 2012)
   
2.  Check the UUID of created repo with
svn info https://svn.vaseem/svn/xyzrepo/

set the same UUID for the newly created repo as of Primary repo by command

svnadmin setuuid  /path/of/repo/  UUID of Primary repo
svnadmin setuuid "D:\Repositories\xyzrepo" db5423f0-d7e9-4b4a-b701-935fb5d42e4b
     
3.  Initialize the sync from Primary repository by the below command
svnsync initialize DEST_URL SOURCE_URL
this will throw errors so we need to go to the mirror (secondary) repo and need to change the pre-revporp-change hook to change so that it can accept the change



















Now initialize the sync for repository
svnsync initialize DEST_URL SOURCE_URL
svnsync initialize https://svn.vaseem.com/svn/xyzrepo/
https://svn.vaseem2.com/svn/xyzrepo/

Now start sync
svnsync sync DEST_URL SOURCE_URL

svnsync sync https://svn.vaseem.com/svn/xyzrepo/
https://svn.vaseem2.com/svn/xyzrepo/
this will start syncing…





JIRA Installation and Configuration


Step 1. Installation postgresql 

yum install postgresql postgresql-server

[root@TPAEXZSLRD01 opt]# yum install postgresql postgresql-server
Loaded plugins: fastestmirror, security
Determining fastest mirrors
 * base: mirror.us.leaseweb.net
 * extras: mirror.umd.edu
 * updates: mirror.cs.vt.edu
base                                                                                                                  | 3.7 kB     00:00
base/primary_db                                                                                                       | 4.4 MB     00:05
extras                                                                                                                | 3.5 kB     00:00
extras/primary_db                                                                                                     |  19 kB     00:00
updates                                                                                                               | 3.5 kB     00:00
updates/primary_db                                                                                                    | 2.5 MB     00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql.x86_64 0:8.4.13-1.el6_3 will be installed
--> Processing Dependency: postgresql-libs(x86-64) = 8.4.13-1.el6_3 for package: postgresql-8.4.13-1.el6_3.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql-8.4.13-1.el6_3.x86_64
---> Package postgresql-server.x86_64 0:8.4.13-1.el6_3 will be installed
--> Running transaction check
---> Package postgresql-libs.x86_64 0:8.4.13-1.el6_3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                                 Arch                         Version                               Repository                  Size
=============================================================================================================================================
Installing:
 postgresql                              x86_64                       8.4.13-1.el6_3                        base                       2.8 M
 postgresql-server                       x86_64                       8.4.13-1.el6_3                        base                       3.4 M
Installing for dependencies:
 postgresql-libs                         x86_64                       8.4.13-1.el6_3                        base                       200 k

Transaction Summary
=============================================================================================================================================
Install       3 Package(s)

Total download size: 6.4 M
Installed size: 29 M
Is this ok [y/N]: Y
Downloading Packages:
(1/3): postgresql-8.4.13-1.el6_3.x86_64.rpm                                                                           | 2.8 MB     00:02
(2/3): postgresql-libs-8.4.13-1.el6_3.x86_64.rpm                                                                      | 200 kB     00:00
(3/3): postgresql-server-8.4.13-1.el6_3.x86_64.rpm                                                                    | 3.4 MB     00:02
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        1.1 MB/s | 6.4 MB     00:05
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : postgresql-libs-8.4.13-1.el6_3.x86_64                                                                                     1/3
  Installing : postgresql-8.4.13-1.el6_3.x86_64                                                                                          2/3
  Installing : postgresql-server-8.4.13-1.el6_3.x86_64                                                                                   3/3
  Verifying  : postgresql-server-8.4.13-1.el6_3.x86_64                                                                                   1/3
  Verifying  : postgresql-libs-8.4.13-1.el6_3.x86_64                                                                                     2/3
  Verifying  : postgresql-8.4.13-1.el6_3.x86_64                                                                                          3/3

Installed:
  postgresql.x86_64 0:8.4.13-1.el6_3                                postgresql-server.x86_64 0:8.4.13-1.el6_3

Dependency Installed:
  postgresql-libs.x86_64 0:8.4.13-1.el6_3

Complete!
[root@TPAEXZSLRD01 opt]# chkconfig postgresql on
[root@TPAEXZSLRD01 opt]# service postgresql start

/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize the cluster first.
                                                           [FAILED]
[root@TPAEXZSLRD01 opt]# ^C
[root@TPAEXZSLRD01 opt]# service postgresql initdb
Initializing database:                                     [  OK  ]
[root@TPAEXZSLRD01 opt]#service postgresql start
Starting postgresql service:                               [  OK  ]
[root@TPAEXZSLRD01 opt]# vim /etc/sysconfig/iptables
[root@TPAEXZSLRD01 opt]# /etc/init.d/iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:



CREATE USER jirauser WITH PASSWORD 'password';

CREATE DATABASE jiradb;

GRANT ALL PRIVILEGES ON DATABASE jiradb to jirauser;


Error connecting to database

FATAL: Ident authentication failed for user "jirauser"

#vim /var/lib/pgsql/data/pg_hba.conf

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
host    all         all        10.10.0.2 255.255.255.0 trust
# IPv6 local connections:
#host    all         all         ::1/128               md5
host all all 0.0.0.0 0.0.0.0 trust



Step 2: Installation of JIRA

This will install JIRA 4.4.1 on your computer.
OK [o, Enter], Cancel [c]

If JIRA is already installed on this machine, please read the following information carefully.
Please choose between creating a new JIRA installation or upgrading an
existing JIRA installation.
Create a new JIRA installation. [1, Enter], Upgrade an existing JIRA installation. [2]
2
Existing JIRA installation directory:
[/opt/JIRA]

No directory found in specified location
Finishing installation ...
[root@moscow opt]# ./atlassian-jira-4.4.1-x32.bin
Unpacking JRE ...
Starting Installer ...

This will install JIRA 4.4.1 on your computer.
OK [o, Enter], Cancel [c]

If JIRA is already installed on this machine, please read the following information carefully.
Please choose between creating a new JIRA installation or upgrading an
existing JIRA installation.
Create a new JIRA installation. [1, Enter], Upgrade an existing JIRA installation. [2]
1

Where should JIRA 4.4.1 be installed?
[/opt/atlassian/jira]

Default location for JIRA data
[/var/atlassian/application-data/jira]

Configure which ports JIRA will use.
JIRA requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you will access JIRA
through your browser. The Control port is used to Startup and Shutdown JIRA.
Use default ports (HTTP: 8080, Control: 8005) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]

JIRA can be run in the background.
You may choose to run JIRA as a service, which means it will start
automatically whenever the computer restarts.
Install JIRA as Service?
Yes [y, Enter], No [n]
y

Extracting files ...


Please wait a few moments while JIRA starts up. Depending on your system this may take a few minutes.
Launching JIRA ...

Setup has finished installing JIRA 4.4.1 on your computer.
JIRA 4.4.1 can be accessed at http://localhost:8080
Finishing installation ...

Step 3: Configuration of JIRA

Launch the browser and access the JIRA: http://localhost:8080





























Resizing the disk space on Linux VMs running on VMware ESXi 5

Step1:

Connect to your ESXi Server and switch off the machine running on ESXiEdit the disk and increased the desired size and reboot the machine.




Step 2:


Now this machine is up and running and having the unallocated disk space, we need to use this

Login to machine via ssh


List the disk partition


# fdisk -l /dev/sda


Disk /dev/sda: 171.8 GB, 171798691840 bytes

255 heads, 63 sectors/track, 20886 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b5bc9

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.

/dev/sda2              64       13055   104344576   8e  Linux LVM

so the disk have two partition /dev/sda1 and /dev/sda2

Create new partition

#fdisk /dev/sda

type n - to create a new partition
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
type p - for primary partition
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
p
We already have /dev/sda1 and /dev/sda2 Press ’3′ for this new partition which will be created as /dev/sda3
Partition number (1-4): 3
Just press enter twice above as by default the first and last cylinders of the unallocated space should be correct. After this the partition is then ready.
First cylinder (3211-4456, default 2611): "enter"
Using default value 4456
Last cylinder, +cylinders or +size{K,M,G} (3211-4456, default 4456): "enter"
Using default value 4456
Command (m for help): t
Partition number (1-5): 3
type 8e - for the "Linux LVM" type
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)
type w - to write changes and exit
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

Now Reboot the machine
Increasing the logical volume

We use the pvcreate command which creates a physical volume for later use by the logical volume manager (LVM). In this case the physical volume will be our new /dev/sda3 partition.
# pvcreate /dev/sda3
let's now create the physical volume in that partition:

# pvcreate /dev/sda3
Now let's extend the server's Volume Group to that physical volume.

# vgdisplay

Note down the entry next to "VG Name". That's your Volume Group name.


# vgextend EnterVolumeGroupNameHere /dev/sda3


#####

If you get a message saying /dev/sda3 could not be added to your Volume Group, you need to remove the physical volume and recreate it. Metadata might have gotten corrupt and thus the volume cannot be added to your Volume Group. So just do:

# pvremove /dev/sda3

And then again:

# pvcreate /dev/sda3

#####


Since we're (essentially) extending the main logical volume, let's get the name of that:

# lvdisplay

and note down the entry next to "LV Name". This is your logical volume's name (e.g. /dev/srv/root), which you'll now extend to the newly added partition/physical volume.


- Extend the logical volume by X GBs:

# lvextend -L +XG yourLogicalVolumeName
Make sure you replace X above with the actual number of GBs you've added in your VM's settings. So if you increased your VM by 20GBs, the command becomes:

# lvextend -L +20G yourLogicalVolumeName


Finally, let's resize the file system to the new allocated space:

$ resize2fs yourLogicalVolumeName

(this may take some time depending on number of GBs added to the file system.


- Check the new file system sizes:

# df -hT


This is all done.

Tuesday, May 28, 2013

Reset Root Password on CentOS 5 & 6



Below are the steps to Reset the Password for Root:

Boot or Reboot your CentOS and Hold the Arrow button to bring the Grub menu, From the GRUB menu, select the appropriate kernel version and press the 'e' key.


You will now be presented with the option menu for the kernel version

From this menu, select the kernel /vmlinuz-... line and press the 'e' key.You will now be presented with the kernel boot options, add single at the end of line, Press enter to save your changes and Press 'b' to boot from this


                                       
This will boot up in single user mode, Now you will boot up to the root shell and you can use passwd to set your new password.


Issue passwd command to reset the password

Reboot and you have a new root password for your CentOS installation.

Saturday, May 25, 2013

Howto Free up used memory on a Linux operating system



Usually the kernel handles memory utilization pretty well it caches memory for dentry cache, page cache and inodes which improves IO speed and performance generally. But in some cases user applications needs lots of memory and we need to clear what’s called dirty memory which could be inodes already written to the disk, so now the kernel given us the option to manage this manually.
To Free
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
free -m
total used free shared buffers cached
Mem: 3833 2827 1005 0 31 1030
-/+ buffers/cache: 1765 2067
Swap: 10095 0 10095
~ $free -m

                     total       used          free     shared    buffers     cached
Mem:           5754       1551       4202          0        258        980
-/+ buffers/cache:          313       5441
Swap:           5215            0       5215



Here "buffers" and "cached" columns, which tell you about the amount of memory that the kernel is using for filesystem buffers, etc

So in this example, 5441MB is how much memory is technically available for allocation should an application need it. The "buffers" (258MB) and "cached" (980MB) will be released by the kernal if they are needed.

Tuesday, May 7, 2013

Reconfiguring Network Interfaces in CentOS/RHEL Systems Cloned with vCenter


While cloning CentOS VMs in our environment, I ran into a problem where eth0 wouldn’t start up. When trying to start the networking service, the following error popped up:

Bringing up interface eth0: Device eth0 does not seem to be preset, delaying initialization.      [FAILED]


The reason this error occurs is because networking adapters in cloned VMs are assigned unique MAC addresses, so they don’t conflict with the parent VM. During OS installation, the installer detects the network adapter and udev configures the mapping between the device eth0 and the MAC address. When the MAC address changes udev thinks the device is missing.

To fix this, we need to update udev’s mapping rules to point the eth0 definition to the device with the correct MAC address. Open the file /etc/udev/rules.d/70-persistent-net.rules. You should see something similar to what is below:

# PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:9c:00:16", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:9c:00:18", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

As you can see there are two PCI ethernet adapters present. The original one from the parent VM (MAC: 9c:00:16) and the new one from the current VM (MAC: 9c:00:18). To fix the issue you need to change the eth0 device definition to have the correct MAC address (9c:00:18) and remove the eth1 device. Your resulting file will look like so:

You have to update the /etc/sysconfig/network-scripts/ifcfg-eth0 file to reflect the correct MAC address. Then, after a quick system restart your eth0 adapter will be back up.

Date and Time in Linux


Set Date

Use the following syntax to set new data and time:
date --set="STRING"

set new data to 23 Jan 2012 2:12:15

date --set="Tue Jan 23 2:12:15 EDT 2012"

You can format as belwo:

date +%Y%m%d -s "20120910"


Set Time

Use the following syntax to set time:

# date +%T -s "11:10:05"

11Hour (hh)

10: Minute (mm)

05: Second (ss)

Use %p locale’s equivalent of either AM or PM, enter:

# date +%T%p -s "2:12:30AM"

# date +%T%p -s "11:12:30PM"

Thursday, April 25, 2013

Resizing (Shrinking) Guest Hard Drive Sizes With VMware Standalone Converter (vSphere 5) ESXi Server 5.1



If you want to shrink your guest hard drive size then you can use VMware Converter standalone converter

1. Installing VMware converter is pretty straightforward, run the install file and accept all the defaults. Install the converter on same machine (Virtual) that you want to resize.



2. Run the application


3. Choose Open> convert machine> choose this local machine


4. Choose the destination type (in this case choose VMware Infrastructure virtual machine) and enter the credentials for ESXi Server


5. Customize the size of disk, CPU, RAM what you want, (We are working on decreasing the size of disk)



6. Confirm the size and go for convert, it will take some time according to the machine size and configuration




7. Delete the source machine as you have now less disk size virtual machine on ESXi Server.

Friday, April 12, 2013

Configuring Network Time Protocol (NTP) on ESX/ESXi 4.1 and ESXi 5.0 hosts using the vSphere Client


To configure NTP on ESX/ESXi 4.1 and ESXi 5.0 hosts:

  1. Connect to the ESX/ESXi host using the vSphere Client.
  2. Select a host in the inventory.
  3. Click the Configuration tab.
  4. Click Time Configuration.
  5. Click Properties.
  6. Click Options.
  7. Click NTP Settings.
  8. Click Add.
  9. Enter the NTP Server name. For example, 0.pool.ntp.org and 1.pool.ntp.org.
  10. Click OK.
  11. Click the General tab.
  12. Click Start automatically under Startup Policy.
  13. Click Start and click OK.
  14. Click OK to exit.

Wednesday, April 10, 2013

Installation of VMware Tools in a Linux guest (CentOS 6.3)


To install VMware Tools in a Linux guest operating system using Compiler:
Ensure that your Linux virtual machine is powered on.
If you are running a GUI interface, open a command shell.

Note: Log in as a root user, or use the sudo command to complete each of these steps.

Click VM in the virtual machine menu, then click Guest > Install/Upgrade VMware Tools and click OK.
To create a mount point, run:

mkdir /mnt/cdrom

To mount the CDROM, run:

mount /dev/cdrom /mnt/cdrom

To copy the Compiler gzip tar file to a temporary local directory, run:

cp /mnt/cdrom/VMwareTools-<version>.tar.gz /tmp/

Where <version> is the VMware Tools package version.

To determine the version of VMware tools, run:

ls /mnt/cdrom

You see an output similar to:

# VMwareTools-5.0.0-12124.tar.gz

To change to the tmp directory and extract the contents of the tar file into a new directory called vmware-tools-distrib, run:
cd /tmp
tar -zxvf VMwareTools-<version>.tar.gz

To change directory to vmware-tools-distrib and run the vmware-install.pl PERL script to install VMware Tools, run:
cd vmware-tools-distrib
./vmware-install.pl

Notes:
Follow the screen prompts to install the VMware Tools. Options in square brackets are default choices and can be selected by pressing Enter.
To compile VMware Tools successfully, you need gcc Compiler and Linux Kernel sources provided by your Linux distribution. Consult your Linux distribution documentation for details on how to install these packages.
It is normal for the console screen to go blank for a short time during the installation when the display size changes.
Some warnings or errors are normal, like when a files does not exist.
Depending on the Linux distribution, your network service might restart after installation. VMware recommends that you invoke this command from the console and not remotely.

If you are running a GUI interface, restart your X Window session for any mouse or graphics changes to take effect.
To start VMware Tools running in the background during an X Window session, run:

/usr/bin/vmware-toolbox &

Depending on your environment you may need to unmount the CDROM. To unmount the CDROM, run:

umount /mnt/cdrom

Depending on your environment, you may need to manually end the VMware Tools installation. To end the VMware Tools install, click VM in the virtual machine menu, then click Guest > End VMware Tools Install.
To remove VMware Tools installation packages, run:
cd
rm /tmp/VMwareTools-<version>.tar.gz
rm -rf /tmp/vmware-tools-distrib

Thursday, April 4, 2013

Installing tomcat7 on CentOS 6.3


Java should be installed before installing tomcat, please read my previous blog to install java
Download apache tomcat from here
#wget http://apache.techartifact.com/mirror/tomcat/tomcat-7/v7.0.39/bin/apache-tomcat-#7.0.39.tar.gz
#tar -xvf apache-tomcat-7.0.39.tar.gz
#mv apache-tomcat-7.0.39 tomcat-7.0.39
#mv tomcat-7.0.39/ /usr/share/
cd /usr/share/tomcat-7.0.39/
Now create tomcat service and set it to start on boot
#vim /etc/init.d/tomcat and paste the below on to that
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/tomcat7
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0 
#chkconfig --add tomcat
#chkconfig --level 234 tomcat on
#chkconfig --list tomcat
Now you can start stop tomcat by executing the below command
#service tomcat stop
#service tomcat start
This should work fine now.

Installing Redis on Linux (CentOS 6.3)


Download redis from redis.io
#wget https://redis.googlecode.com/files/redis-2.4.17.tar.gz
#tar -xvf redis-2.4.17.tar.gz
#cd /opt/redis-2.4.17/src
#make install
now this copy redis-server, redis-cli and conf file to /usr/local/bin
open the port in firewall for redis
now make this service run on start up add the below line in rc.local
#vim /etc/rc.local
nohup /usr/local/bin/redis-server &
Close the editor and now the server will start at boot, check by redis-cli
#cd /usr/local/bin
#./redis-cli
redis 127.0.0.1:6379>
It is installed and working now.

Tuesday, March 26, 2013

Installation of Java Runtime Edition (JRE) 1.7 in Centos 6.2 and Uninstallation of JDK


Uninstallation of JDK (Open Java)
# yum remove java

Installing from rpm package

Go to the Oracel Download page and download the package.

# wget http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-linux-x64.rpm

Go to the downloaded location

change the package mode to executeable

# chmod 755 jdk-7u17-linux-x64.rpm

Install it

# yum install jdk-7u17-linux-x64.rpm

Now check the version

# java -version

You should get the result like below:

java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

Setting JAVA_HOME for a single user and all users:

check java by

#which java
/usr/bin/java

we can check whether this java file is located

# ls -al /usr/bin/java
lrwxrwxrwx. 1 root root 26 Mar 24 20:15 /usr/bin/java -> /usr/java/default/bin/java

#cd /usr/java
#ls -al
drwxr-xr-x.  3 root root 4096 Mar 24 20:15 .
drwxr-xr-x. 14 root root 4096 Mar 24 20:15 ..
lrwxrwxrwx.  1 root root   16 Mar 24 20:15 default -> /usr/java/latest
drwxr-xr-x.  8 root root 4096 Mar 24 20:15 jdk1.7.0_17
lrwxrwxrwx.  1 root root   21 Mar 24 20:15 latest -> /usr/java/jdk1.7.0_17

The above shoes that default softlink to /usr/java/latest and latset softlink to /usr/java/jdk1.7.0_17
The genuine directory for java is /usr/java/jdk1.7.0_17

For a single user:

# vi ~/.bash_profile
# export JAVA_HOME=/usr/java/jdk1.7.0_17
# export PATH=$PATH:/usr/java/jdk1.7.0_17/bin

For all users:

# vi /etc/profile
# export JAVA_HOME=/usr/java/jdk1.7.0_17
# export PATH=$PATH:/usr/java/jdk1.7.0_17/bin

Thursday, January 24, 2013

Datastore with NAS (Netgear ReadyNAS 2100) with ESXi 5.0

Step1: Create the NFS Share on Netgear ReadyNAS 2100 / Any NAS Drive

Very first check weather your NAS have NFS protocol enable if not then enable it.
Add Share>Share name

Click on NFS link and then change the read/write access to this folder.

Step2: Prior to map the Datastore on NAS drive we need to change the Networking configuration for the ESXi 5.0 Server.


Select the VMKernel as this handles the traffic for vSpher vMotion, iSCSI, NFS and host management



Select the existing switch or create the new, I have selected the same


Then Provide the Static or DHCP IP to this network and finish.



Step3: On ESXi Server Open vCenterServer console and go to Datastore and Datastore Clusters
Click Add Datastore


Now Select the host and click Next, Select Network File System

Provide the Server IP (NFS Server) and provide the path of that folder (NFS Folder), you can get this path by logging in to through putty on the NFS Server in my case it was /c/vmbackup

This will mount the Datastore on to ESXi and you can copy and move file to this Datastore.