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

Sunday, 11 November 2012



To check  any type of process status and to count the no of process are currently running :-
#!/bin/bash
echo "To  check any type of processe status"
ps aux | grep $1 | grep -v "\(root\|grep\)" | wc -l

Run it by following command :-
sh cntproc.sh "process name"
examaple:- [root@localhost scriptexamples.sh]# sh cntproc.sh  sendmail
To count the currently how many apache processes are  running
1



All Service Status


To check all Service Status:-
#!/bin/bash
echo "To check status of all services are running or not "
service --status-all|grep "\(run\)"
service --status-all|grep "\(not run\)"
sh allservstatus.sh |awk '{ print $1 }'

Monday, 5 November 2012


To  check   user account is lock or not:-
First create user account by using following command:-
Useradd username
Passwd  “password”

Example:-

 [root@linuxnotes~]# useradd swapnil

[root@linuxnotes~]# passwd swapnil

 Changing password for user swapnil.
 New password:*******
 BAD PASSWORD: it is based on a dictionary word
 BAD PASSWORD: is too simple
 Retype new password:********
 passwd: all authentication tokens updated successfully.

 [root@linuxnotes~]#

 Command to lock user account :-

[root@linuxnotes~]# passwd -l swapnil
Locking password for user swapnil.
passwd: Success

To test useraccount is lock or not :-
login as: swapnil
swapnil@linuxnotes.co.in password:
Access denied
swapnil@linuxnotes.co.in password:

To unlock the useraccount:-
[root@linuxnotes~]# passwd -u swapnil
Unlocking password for user swapnil.
passwd: Success
[root@linuxnotes~]#

**Note:- Any type of changes in linux you should login by useraccount root.

 .  

Wednesday, 28 March 2012

To delete mail queue from sendmail server


To delete mail queue from sendmail server:- 

Steps are as follows :-

First Login to your mail server 

[root@linuxnotes~]# cd /var/spool/mqueue/

[root@linuxnotes~]# ls -l 

[root@linuxnotes~]# rm -rf *