Tuesday, December 18, 2012

Soft link creation in linux

We are going to create soft link for test folder in new directory under disk2

#cd /root/test
#mv -v test /disk2/
#ln -s /cvs2/test/  test

Rsync command

From local system to remote system:

# rsync -avzpe ssh modules/ root@10.10.2.42:/usr/local/jboss-as/modules/



--delete : delete files that don't exist on sender (system)
-v : Verbose (try -vv for more detailed information) 
-e "ssh options" : specify the ssh as remote shell 
-a : archive mode 
-r : recurse into directories 
-z : compress file data


                          ****************************************


Saturday, December 15, 2012

Errcode: 28 in Mysql in linux

Error :

[root@ghrmsdb dbbackup]# mysql -p DBNAME < DBNAME_14122012-0700.sql
Enter password:
ERROR 3 (HY000) at line 33: Error writing file './GHRMS/B2B_Exception_Dtls.frm'



Answer :

If you get error like this, you need to check all filesystems where MySQL installed..  
It will happen only if no space left on hard disk...


    ************************************************************************8

Friday, December 14, 2012

Jboss 7 Installation on RHEL 6.3

Check the server hostname correctly assigned:

# vim /etc/hosts
# vim /etc/sysconfig/network

Check http service running or not:

#/etc/init.d/httpd status.
It should running....

Create jboss user :

#useradd jboss

Download latest  jdk 7 to /user/local and install it:

# rpm -ivh jdk-7u7-linux-x64.rpm
 
To check java installed or not:
# java --version  

Set java variable path:

#JAVA_HOME=/usr/java/latest
#export JAVA_HOME
#PATH=$JAVA_HOME/bin:$PATH:$HOME/bin


Also add the above 3 lines  in vim /etc/bash_profile save and close it.

Download jboss7 to /usr/local/ and unzip it.

#unzip jboss-as-7.1.1.Final.zip  (It will unzip as jboss-as-7.1.1 )
#mv jboss-as-7.1.1 jboss-as

Assign the owner permission to jboss for /usr/local/jboss-as directory.
 
#chown -R jboss:jboss /usr/local/jboss-as


To create service user /etc/init.d do as follow:

#cp /usr/local/jboss-as/bin/init.d/jboss-as-standalone.sh /etc/init.d/jboss
#mkdir /etc/jboss-as
#cp /usr/local/jboss-as/bin/init.d/jboss-as.conf /etc/jboss-as/

#chmod 755 /etc/ini.d/jboss

Edit and add the below entries in /etc/init.d/jboss:

#vim /etc/init.d/jboss

# chkconfig: - 234 80 20  to run jboss in 234 run level
 

# Set defaults.

JBOSS_USER=jboss
export JBOSS_USER

if [ -z "$JBOSS_HOME" ]; then
  JBOSS_HOME=/usr/local/jboss-as

Save and close text editor...


To access jboss console through browser from remote system:

change 0.0.0.0 instead of 127.0.0.0. only in the below lines.

# vim /usr/local/jboss-as/standalone/configuration/standalone.xml 

 <interface name="management">
            <inet-address value="${jboss.bind.address.management:0.0.0.0}"/>
        </interface>
        <interface name="public">
            <inet-address value="${jboss.bind.address:0.0.0.0}"/>



save and close text editor.

#chkconfig --add jboss
#chkconfig jboss on

Now we can start the jboss as system service:

#/etc/init.d/jboss start

and 

We can access it through browser.
10.0.0.1:8080




     *************************************************************

To add jboss mnagement user:

Go to /usr/local/jboss-as/bin/
#./add-user.sh
You should see the following message on the console after executing the command:
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
We select “a”, next you should see the following message:
Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : jboss
Password :
Re-enter Password :
* hit enter for Realm to use default, then provide a username and password
We select the default value for the Realm (ManagementRealm), by hitting enter, and select “jboss” as our username and password.


 

 




Thursday, October 25, 2012

Acl in linux



1.To set acl for a folder :

# setfacl -m u:username:rwx foldername

2.To set acl for solder and their sub folder.

.#setfacl -R -m u:username:rwx foldername 

3.To view acl for a folder :
#getfacl foldername

4.To remove acl for a folder :
setfacl -b u:username:rwx foldername

 
 
 

Tuesday, October 23, 2012

How to import store proceedure in mysql

To fix this.

Export store procedure from existing database with below command;

#mysqldump -p --no-create-db --no-create-info --no-data --routines DBNAME > DBNAME_23Oct2012.sql
 
And imoprt .sql file to running db.
 
#mysql -u root -p DBNAME < DBNAME_23Oct2012.sql  
 
 
Restart Mysql DB
 
To check Store procedure in Mysql
 
#Login into mysql DB and type the below command
 
SHOW PROCEDURE STATUS;
SHOW FUNCTION STATUS;
 
Thats it!!!!

Thursday, October 18, 2012

Starting MySQL.Manager of pid-file quit without updating fi[FAILED]

Am getting below eror on of my mysql server while starting mysql service"Starting MySQL.Manager of pid-file quit without updating fi[FAILED] "


 To resolve this issue i tried the below
# ps -ef | grep -i mysql
kill the all running process 

Try to start mysql
#services mysqld start

It worked for me..



Wednesday, October 10, 2012

How to import and Export Mysql db

To export mysqlDB:


1.Type the below command to export mysql db:

# mysqldump -u root -p dbname> dbname11092012.sql

To import mysql DB:

1.Go to file location where you saved  backup db and type following command.

 2.login into mysql and create new database.

> create databases newdb

3.exit from sql and type as following

# mysql -u root -p  newdb < db_04102012-0700.sql

[where newdb is newly created db and db_04102012-0700.sql is going to restore newly created db.]

Friday, October 5, 2012

How to Allow MySQL Client to Connect to Remote MySQL server

If you try to connect to a remote MySQL database from your client system, you will get “ERROR 1130: Host is not allowed to connect to this MySQL server” message as shown below.

# mysql -h 10.10.28.8 -u root -p
Enter password:
ERROR 1130: Host '10.10.28.8' is not allowed to connect to this MySQL server


1.Try to telnet server from client machie

# telnet 192.168.1.8 3306
host 10.10.28.8 is not allowed to connect to this mysql server



 2.To allow a specific client ip-address (10.10.28.8) to access the mysql database running on a server,

# mysql -u root -p
Enter password:

mysql> use mysql

mysql> GRANT ALL ON *.* to root@'10.10.28.8' IDENTIFIED BY '$dfg!23'; 

mysql> FLUSH PRIVILEGES;
 

That's it.....It should work!!!!


  

To resolve!! Starting jboss-as: chown: missing operand after `/var/run/jboss-as' Try `chown --help' for more information.in Jboss 7

While starting Jboss service i am getting following error meesage in jboss7.

 "Starting jboss-as: chown: missing operand after `/var/run/jboss-as'Try `chown --help' for more information."


To over come this ,

#vim /usr/local/jboss-as/standalone/configuration/standalone.xml

 and add the below line into standalone.xml file

# Set defaults.
JBOSS_USER=jboss
export JBOSS_USER









Now we can start the jboss server as usual without any error message.
#/etc/init.d/jboss start

Enjoy!!!!...


Wednesday, September 26, 2012

Enabling php-imap module in php(Cent OS)

1.Install php-imap with following command.

#yum --enablerepo=webtatic install php54w-imap* 


2.Restart HTTP service
#. service httpd restart 

3.Check imap module install in php
# php -i | grep -i imap

Friday, August 17, 2012

How to determine given OS in 32 bit or 64 bit in Linux

Type the following simple command in your linux boxes:

# uname-m

If it 32 bit os the output would  be  follow:

i686   ==> 32-bit kernel
 

If it 64 bit os the output would be follow:

 
x86_64 ==> 64-bit kernel
 
Or
 
 can use following command to check the OS versions:
 
# uname -a
 
# getconf LONG_BIT
 
# cat /proc/cpuinfo

Wednesday, August 8, 2012

How to fix Could not complete SSL handshake error.in rhel5

In this case, you need to check on the /etc/xinetd.d/nrpe as following.

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream   
 port  = 5666   
        wait            = no
        user            = nagios
 group  = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable               = no
 only_from                = 10.1.2.2
}


You need to make sure the only_from ip is the IP for nagios monitoring server.
If the only_from IP is not correct, rectify it and then restart xinetd.d by using the following command.
[admin@remotehost ~]$ sudo /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]

If the nrpe setting is already correct, then you need to check in /var/log/messages in the remote host. You might see the following error.
Jul 29 13:36:56 remotehost xinetd[7336]: FAIL: nrpe address from=10.1.2.2
Jul 29 13:36:56 remotehost xinetd[6595]: START: nrpe pid=7336 from=10.1.2.2
Jul 29 13:36:56 remotehost xinetd[6595]: EXIT: nrpe status=0 pid=7336 duration=0(sec)

Try to restart xinetd daemon using the command above and then check on /var/log/messages again. If you see the following error, it might mean that xinetd had problem to start up nrpe becuase of its bug to release the address.
Jul 29 13:35:54 remotehost xinetd[6595]: bind failed (Address already in use (errno = 98)). service = nrpe
Jul 29 13:35:54 remotehost xinetd[6595]: Service nrpe failed to start and is deactivated.
Jul 29 13:35:54 remotehost xinetd[6595]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.


In this case, you cannot start nrpe as embeded service in xinetd since this is a bug in xinetd. To fix this, you can start nrpe as standalone daemon. Before you started nrpe as standalone daemon, you need to verify the configuration in /usr/local/nagios/etc/nrpe.cfg. The following are two parameters that you need to take care of. The value for allowed_hosts should be the ip of nagios monitoring host and the server_port is 5666.
allowed_hosts=10.1.8.2
server_port=5666
Besides, you need to make sure xinetd is not running or you need to remove /etc/xinetd.d/nrpe and restart xinetd daemon.
Then, you can issue the following command to start nrpe as standalone daemon.
[admin@remotehost]$ /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
You should see the following log in /var/log/messages.
Jul 29 14:18:31 remotehost nrpe[5947]: Starting up daemon
Jul 29 14:18:31 remotehost nrpe[5947]: Listening for connections on port 5666
Jul 29 14:18:31 remotehost nrpe[5947]: Allowing connections from: 10.1.2.2
In this case, you can now verify the nrpe connection by running check_nrpe from nagios monitoring host as following.
[admin@monitoringhost ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.1.2.12
NRPE v2.12
No more error 'CHECK_NRPE: Error - Could not complete SSL handshake.' now.

Thursday, August 2, 2012

Locations of Apache conf files, binary files,Apache Module files

ServerRoot              ::      /etc/httpd
Primary Config Fle      ::      /etc/httpd/conf/httpd.conf
Other Config Files      ::      /etc/httpd/conf.d
Module Locations        ::      /usr/lib/httpd/modules
DocumentRoot            ::      /var/www/html
ErrorLog                ::      /var/log/httpd/error_log
AccessLog               ::      /var/log/httpd/access_log
cgi-bin                 ::      /var/www/cgi-bin (empty and disabled by default)
binary name and path    ::      /usr/sbin/httpd
runtime directory       ::      /etc/httpd/run

Recover MySQL root password

step1: stop mysql

root@bilal# service mysqld stop
root@bilal# /usr/sbin/mysqld --skip-grant-tables &  
 

step2: Login in to your mysql shell

root@bilal:/# mysql -u root
mysql> UPDATE mysql.user SET Password=PASSWORD('Newpassword') WHERE User='root';
mysql> FLUSH PRIVILEGES; 

Wednesday, July 25, 2012

Adding banner to ssh l;ogins


Edit
# vi /etc/ssh/sshd_config and uncomment out the line

# Banner /etc/banner (you can use any path you want)
 
# root@server [/]# /etc/init.d/sshd restart
 
#  ssh localhost