Monday, 15 April 2013

To Adduser on ec2- instance and login it by without ppk/ To set Password Authentication for User



To Adduser on ec2- instance and login it by without ppk / To set  Password Authentication for User :-
Steps:-
          1)        First login to server.
)               2)     Command :-  sudo  adduser  username
          3)       Command for password set :-  sudo  passwd  username

            To set root permission for created user:-

         4)      Sudo   visudo
         5)      Set permission same as root like…

           Under below line
root            ALL=(ALL) ALL
 
      Manohar   ALL= (ALL) ALL
 
6)   Now need to enable PasswordAuthentication 
7)      Edit the file name:- vi /etc/ssh/ssh_config
8)      Uncomment the PasswordAuthentication and set PasswordAuthentication=yes
9)      After setting the password authentication reload the sshd service or restart the ssh service. 
10)   Sudo  /etc/init.d/sshd reload
 
11)  Please verify it by using login to ec2-instance through username and password. 
 
 

Friday, 12 April 2013

Sendmail error m4:/etc/mail/sendmail.mc:10: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

To Resolve m4:/etc/mail/sendmail.mc:10: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

If  you getting following error message then.......

 [root@localhost html]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
m4:/etc/mail/sendmail.mc:10: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory


Just fire only one command........
[root@localhost ~]# yum install sendmail* -y


It will show the file name :-

====================================================================================================
 Package                      Arch                Version                   Repository         Size
====================================================================================================
Installing:
 sendmail-cf                  noarch              8.14.4-8.el6              base              184 k
 sendmail-devel               i686                8.14.4-8.el6              base              135 k
 sendmail-doc                 noarch              8.14.4-8.el6              base              533 k
 sendmail-milter              i686                8.14.4-8.el6              base               57 k

Transaction Summary
====================================================================================================


To Verify it by.....
[root@localhost ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf



















Sunday, 3 February 2013

http://apt.sw.be/redhat/el5/en/i386/rpmforge/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403"


Error Message:-
http://apt.sw.be/redhat/el5/en/i386/rpmforge/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403"

About RPMForge:-
    RPMforge (now called Repoforge) is a repository of software packages for Redhat Enterprise Linux and its derivatives like CentOS and Scientific Linux. It provides many packages in the rpm package format to these distributions.
    RPMforge also had many  RPM packages available for old products like Red  Hat 8 after these products were no longer supported by their vendors. You can still use them with package Management products like apt-get, yum as up2date does not work anymore due to expired SSL keys.

Solution:-
 To resolve above error message please refer the following steps.
  We need to modify in two main file.
  1)/etc/yum.repose.d/rpmforge.
     Before modify file details are as follows:-
     ### Name: RPMforge RPM Repository for RHEL 5 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-extras]
name = RHEL $releasever - RPMforge.net - extras
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/extras
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-testing]
name = RHEL $releasever - RPMforge.net - testing
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/testing
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

After Modify in same file:-
### Name: RPMforge RPM Repository for RHEL 5 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge
#mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-extras]
name = RHEL $releasever - RPMforge.net - extras
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/extras
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-testing]
name = RHEL $releasever - RPMforge.net - testing
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/testing
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

2) /etc/yum.repos.d/mirrors-rpmforge
    Add following lines:-
  
pt.sw.be/redhat/el5/en/$ARCH/rpmforge
#outdated#http://archive.cs.uu.nl/mirror/dag.wieers/redhat/el5/en/$ARCH/rpmforge

#outdated#http://ftp2.lcpe.uni-sofia.bg/freshrpms/pub/dag/redhat/el5/en/$ARCH/rpmforge
#identical#http://ftp.heanet.ie/pub/freshrpms/pub/dag/redhat/el5/en/$ARCH/rpmforge

http://ftpstud.fhtesslingen.de/dag/redhat/el5/en/$ARCH/rpmforge
#outdated#http://mirror.cpsc.ucalgary.ca/mirror/dag/redhat/el5/en/$ARCH/rpmforge
#outdated#http://mirrors.ircam.fr/pub/dag/redhat/el5/en/$ARCH/rpmforge
#outdated#http://rh-mirror.linux.iastate.edu/pub/dag/redhat/el5/en/$ARCH/rpmforge
http://fr2.rpmfind.net/linux/dag/redhat/el5/en/$ARCH/rpmforge
#outdated#http://wftp.tu-chemnitz.de/pub/linux/dag/redhat/el5/en/$ARCH/rpmforge
#outofsync#http://www.mirrorservice.org/sites/apt.sw.be/redhat/el5/en/$ARCH/rpmforge
****After   modification in above two file, you can try to install any type packages by using yum.****






Saturday, 19 January 2013

Difference between Hard Link and Soft Link


Difference Between Hard Link and Soft Link:-


HARD LINK:-
 Hard link is acts like a mirror copy of the original file. These links share the same inodes.
Changes made to the original or hard linked file will reflect the other. When you delete hard link nothing will happen to the other. Hard links can’t cross file systems.

Features:-
1)      Have same inodes number.
2)      Ls –l command shows all the links with the link column shows  number of links.
3)      Links have actual file contents.
4)      Removing any link, just reduces the link count, but doesn’t affect other links.
5)      You cannot create a hard link for a directory.
6)      If original file is removed then the link will still show the content of the file.

Example:-
HardLink:-
[root@localhost ]# mkdir test
[root@localhost ]# cd test/
[root@localhost test]# ls
[root@localhost test]# touch test1
[root@localhost test]# ln test1  test2
[root@localhost test]# ls -il  test1  test2
1335106 -rw-r--r--. 2 root root 0 Jan 19 16:29 test1
1335106 -rw-r--r--. 2 root root 0 Jan 19 16:29 test2
[root@localhost test]#
From the output you can noticed that both file has same inode number and Size also same.
Now remove test1 and check the content of test2 file.
[root@localhost test]# rm  test 1
rm: remove regular empty file `test1'? y
[root@localhost test]# cat test2
You will still be able to same content in test2.
………………………………………………………………………………………………………………………………………………………………
Soft Link:-
Soft Link is actual link to the original file. These Links will have a different inodes Value.
Softlink points to the original file so if original file is deleted the soft link fails. If you delete
The soft link, nothing will happen to file. The reason for this is, the actual file or directory’s
Inode is different from the “Soft Link” created file’s inode,Hard links can cross file System.

Features:-
1)      Soft links have different inodes number.
2)      Ls –l command shows all link with second column value 1 and the link points to original file.
3)      Soft Link contains the path for original file and not the contents.
4)      Removing soft link doesn’t affect anything but removing but removing original file, the link points to the nonexistent file.
5)      A soft link can link to a directory.

Example:-
[root@localhost test]# ln -s  test2  test3
[root@localhost test]# ls -li  test2   test3
1335106 -rw-r--r--. 1 root root 0 Jan 19 16:29  test2
1336783 lrwxrwxrwx. 1 root root 7 Jan 19 16:39 test3 -> test2
[root@localhost test]#
From the output you can notice that the both file have different inode number and Permissions.
[root@localhost test]# cat  test2
[root@localhost test]# cat test3
Now remove the original file:
[root@localhost test]# rm  test2
rm: remove regular empty file `test2'? y
[root@localhost test]# ls
test3
It will display Symbolic link  test3 but if you try to list the contents  it will tell you that there is no such file getting error message.
[root@localhost test]# cat  test3
cat: test3: No such file or directory
[root@localhost test]# ls

Saturday, 5 January 2013

Simple Steps to install wordpress on Centos


Wordpress Installation steps:-

1) [root@linuxnotes~] # wget http://wordpress.org/latest.tar.gz
2) [root@linuxnotes~] #  tar -xvzf latest.tar.gz
3) [root@linuxnotes~] # cd wordpress/
4) [root@linuxnotes~] # rpm –qa mysqld*

Note:- If showing mysql package then no need to install otherwise refer the step no 5.

5) [root@linuxnotes~] # yum install mysqld* -y
6) [root@linuxnotes~] # /etc/init.d/mysqld status

Note:-  If mysql status showing stopped  then first start the service and then refer the step no 7.

7) [root@linuxnotes~] # mysql –u root –p
8) Enter password:  ******
9) Mysql> show databases;
10) Mysql > mysql> show databases;   // To check whether  existing database-name  is  worpress.
                +--------------------+
                | Database           |
               +--------------------+
                | information_schema |
                | collage               |
                | Employee           |
                | Alfresco           |
                | Asterisk           |
                | MySQL              |
                | Test               |
                |  Account               |
                +--------------------+
                8 rows in set (0.12 sec)

11) mysql> CREATE DATABASE wordpress;
12) mysql> CREATE USER wordpressuser@localhost;
Note :- To verify  created  wordpressuser by using following  steps no 13,14 and 15.
13) mysql> use mysql;
14) mysql> show tables;
15) mysql> select * from user;
16) mysql> set password for wordpressuser@localhost=password('*******');
17) mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY '******';
18) mysql> flush privileges;
19) mysql> show databases;
               +--------------------+
                | Database           |
               +--------------------+
                | information_schema |
                | collage              |
                | Employee           |
                | Alfresco           |
                | Asterisk           |
                | MySQL              |
                | Test               |
                | Wordpress          |
                | Account               |
                +--------------------+
                9 rows in set (0.12 sec)

         
20) mysql> exit
21) [root@linuxnotes~] # cd  /downloads/wordpress
22) [root@linuxnotes~] # ls
23) [root@linuxnotes~] # cp  -r  wp-config-sample.php  wp-config.php
24) [root@linuxnotes~] # vi  wp-config.php

Note:- Edit wp-config.php file and  change the following lines
/** The name of the database for WordPress */  
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpressuserName');

/** MySQL database password */
define('DB_PASSWORD', '*******');

save and exit.

25) [root@linuxnotes~] # cp –r  wordpress/*  /var/www/html

Check the network config file:-

26)  [root@linuxnotes~] #  Vi /etc/hosts
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
 ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
“Your  ip address ”  localhost localhost.localdomain

27) [root@linuxnotes~] #  /et c/init.d/network  restart
28)    [root@linuxnotes~] #  /et c/init.d/mysqld  restart
29) [root@linuxnotes~] #  /etc/init.d/httpd   restart
30) Finally check  in browser :-  http://ipaddress

Saturday, 15 December 2012

Network Traffic Monitoring Tool

Network Traffic Monitoring  Tool:-
Monitoring Network Traffic:-
VNstat:-
VNstat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that VNstat won't actually be sniffing any traffic and also ensures light use of system resources. With VNstat you are able to keep a log of all incoming and outgoing traffic which will be logged by Minute,Hour,Day,Month,Year.

IPTraf:-
IPTraf is a console-based network statistics utility for Linux. It gathers a variety of figures such as TCP connection packet and byte counts, interface statistics and activity indicators, TCP/UDP traffic breakdowns, and LAN station packet and byte counts.

How to install these tools

CentOS/RHEL:-
Steps:-

 1)      Download the source and unpack the source:-
 [root@linuxnotes~] # cd

  [root@linuxnotes~] # wget http://humdi.net/vnstat/vnstat-1.11.tar.gz
2)      Extract vnstat -1.11
 [root@linuxnotes~] # tar -xvf  vnstat-1.11.tar.gz
3)      [root@linuxnotes~]  # ls
4)        [root@linuxnotes~] # cd vnstat-1.11
5)        [root@linuxnotes~] # ls
6)        [root@linuxnotes~] #  vi  INSTALL (Please  follow the all steps )
7)        [root@linuxnotes~] # make
8)        [root@linuxnotes~] # make install

**Note:- Now that the package is installed we need to make it start, and automatically restart on boot.


9)       [root@linuxnotes~] #  cp ~/vnstat-1.11/examples/init.d/redhat/vnstat /etc/init.d/vnstat
10)    [root@linuxnotes~] # chmod +x /etc/init.d/vnstat        
11)   [root@linuxnotes~] # /etc/init.d/vnstat status
12)   [root@linuxnotes~] #  /etc/init.d/vnstat start
13)    [root@linuxnotes~] # /etc/init.d/vnstat status
14)   [root@linuxnotes~]  # cd /etc/init.d/                                              
15)    [root@linuxnotes~] # chkconfig --add vnstat                                           // To add  vnstat in chkconfig
16)    [root@linuxnotes~]  # chkconfig vnstat on                                                 

Setup VNstat  monitoring  interfaces:- 

17  Public Interface
      [root@linuxnotes~] # vnstat -u -i eth0

18 # Private Interface
      [root@linuxnotes~] #  vnstat -u -i eth1

19  [root@localhost /]# yum search iptraf
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: mirrors.hns.net.in
 * extras: mirrors.hns.net.in
 * updates: mirrors.hns.net.in
========================================================================= N/S Matched: iptraf ==========================================================================
iptraf.i686 : A console-based network monitoring utility

  Name and summary matches only, use "search all" for everything.

20 [root@linuxnotes~] # yum install iptraf.i686.

21 [root@linuxnotes~] #  vnstat

22 [root@linuxnotes~]  vnstat -h   

23 [root@linuxnotes~]  vnstat -m

24 [root@linuxnotes~] #  iptraf -g

Friday, 14 December 2012

Mysql ERROR 1045 (28000) in centos


To resolve Mysql "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) in Centos"

Please Refer the following Steps:-

Solution-:

 [root@linuxnotes~]# /etc/init.d/mysqld stop
 [root@linuxnotes~]# mysqld_safe --skip-grant-tables &
 [root@linuxnotes~]# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit

Note:-

Before restarting the mysql service first kill all mysqld related process and then start mysqld service.

 [root@linuxnotes~]# /etc/init.d/mysqld stop
 [root@linuxnotes~]# /etc/init.d/mysqld start