Download Source from http://httpd.apache.org/download.cgi
gunzip httpd-2.2.14.tar.gz
tar -xvf httpd-2.2.14.tar
---------------------------------------------------
./configure --prefix=/usr/local/apache2 --with-mpm=worker --disable-cgid --enable-info --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-balancer --enable-rewrite --enable-headers --enable-cache --enable-mem-cache --enable-disk-cache --enable-expires --enable-mods-shared=all --enable-ssl=shared --with-ssl=/usr/local/ssl
make
make install
------------------------------------------------------
/usr/local/apache2/bin/apachectl restart
Cool,Please let me know, if anything i forgot.;)
Thursday, December 3, 2009
Monday, November 16, 2009
WebSite Monitoring Simple .!
First of all create one /opt/monitoring.rb and /home/sites.txt
-------------------------------------------------------------
#!/usr/bin/ruby
require 'net/http'
require 'net/smtp'
File.open("/home/sites.txt").each { |line|
# get rid of CRLF
line.chomp!
next if(line[0..0] == '#' || line.empty?)
# url, emails = line.split(' ')
# emails = emails.split(",")
url= line.split(' ')
# check if http:// was in the url if not add it in there
# url.insert(0, "http://") unless(url.match(/^http\:\/\//))
# Get the HTTP_RESPONSE from the site we are checking
res = Net::HTTP.get_response(URI.parse(url.to_s))
# Check the response code and send an email if the code is bad
unless(res.code =~ /2|3\d{2}/ ) then
from = "shrikant.lokhande@gmail.com"
message = "From: shrikant.lokhande@gmail.com\nSubject: #{url} Unavailable\n\n#{url} - #{res.code} - #{res.message}\nHTTP Version - #{res.http_version}\n\n"
begin
Net::SMTP.start("smtp server",25,"domain name","username","passwd","login") do |smtp|
smtp.send_message(message, from, 'youremail@gmail.com')
end
rescue Exception => e
print "Exception occured: " + e
end
end
}
-------------------------------------------
vi /home/sites.txt
http://www.website.com
-------------------------------------------
Add script in cron like :
* * * * * ruby /opt/monitoring.rb
from another server or same server. but prefer from another server. configure SMTP and add your email id in the script for alert.
Thats it.!
-------------------------------------------------------------
#!/usr/bin/ruby
require 'net/http'
require 'net/smtp'
File.open("/home/sites.txt").each { |line|
# get rid of CRLF
line.chomp!
next if(line[0..0] == '#' || line.empty?)
# url, emails = line.split(' ')
# emails = emails.split(",")
url= line.split(' ')
# check if http:// was in the url if not add it in there
# url.insert(0, "http://") unless(url.match(/^http\:\/\//))
# Get the HTTP_RESPONSE from the site we are checking
res = Net::HTTP.get_response(URI.parse(url.to_s))
# Check the response code and send an email if the code is bad
unless(res.code =~ /2|3\d{2}/ ) then
from = "shrikant.lokhande@gmail.com"
message = "From: shrikant.lokhande@gmail.com\nSubject: #{url} Unavailable\n\n#{url} - #{res.code} - #{res.message}\nHTTP Version - #{res.http_version}\n\n"
begin
Net::SMTP.start("smtp server",25,"domain name","username","passwd","login") do |smtp|
smtp.send_message(message, from, 'youremail@gmail.com')
end
rescue Exception => e
print "Exception occured: " + e
end
end
}
-------------------------------------------
vi /home/sites.txt
http://www.website.com
-------------------------------------------
Add script in cron like :
* * * * * ruby /opt/monitoring.rb
from another server or same server. but prefer from another server. configure SMTP and add your email id in the script for alert.
Thats it.!
Monday, November 9, 2009
Script for Mysql Backup on Linux.
#!/bin/bash
# USER VARIABLES
TIMESTAMP=$(date +%Y-%m-%d)
MYSQLUSER=root
MYSQLPWD=passwd
MYSQLHOST=localhost
# PATH VARIABLES
MK=/bin/mkdir
GREP=/bin/grep
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump
# CREATE MYSQL BACKUP
# Create new backup dir
$MK /backup/mysqlbackup/mysqlback_$TIMESTAMP
#Dump new files
for i in $(echo 'SHOW DATABASES;' | $MYSQL -u$MYSQLUSER -p$MYSQLPWD -h$MYSQLHOST|$GREP -v '^Database$'); do
run $MYSQLDUMP -u$MYSQLUSER -p$MYSQLPWD -h$MYSQLHOST $i >/backup/mysqlbackup/mysqlback_$TIMESTAMP/$i.sql
echo "$i"
done
------------------------------
run this script in cron like
* 1 * * * /usr/bin/mysqlbackup
# USER VARIABLES
TIMESTAMP=$(date +%Y-%m-%d)
MYSQLUSER=root
MYSQLPWD=passwd
MYSQLHOST=localhost
# PATH VARIABLES
MK=/bin/mkdir
GREP=/bin/grep
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump
# CREATE MYSQL BACKUP
# Create new backup dir
$MK /backup/mysqlbackup/mysqlback_$TIMESTAMP
#Dump new files
for i in $(echo 'SHOW DATABASES;' | $MYSQL -u$MYSQLUSER -p$MYSQLPWD -h$MYSQLHOST|$GREP -v '^Database$'); do
run $MYSQLDUMP -u$MYSQLUSER -p$MYSQLPWD -h$MYSQLHOST $i >/backup/mysqlbackup/mysqlback_$TIMESTAMP/$i.sql
echo "$i"
done
------------------------------
run this script in cron like
* 1 * * * /usr/bin/mysqlbackup
Tuesday, October 20, 2009
Mysql Master-Slave Replication
Master server ip: 10.0.0.1
Slave server ip: 10.0.0.2
Slave username: repl
Slave pw: replpasswd
Your data directory is: /usr/local/mysql/data
-----------------------Master Server-----------------------
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
# changes made to do slave
server-id = 1
relay-log = /usr/local/mysql/data/mysql-relay-bin
relay-log-index = /usr/local/mysql/data/mysql-relay-bin.index
log-error = /usr/local/mysql/data/mysql.err
master-info-file = /usr/local/mysql/data/mysql-master.info
relay-log-info-file = /usr/local/mysql/data/mysql-relay-log.info
datadir = /usr/local/mysql/data
log-bin = /usr/local/mysql/data/mysql-bin
#binlog_do_db =f4pforalpha
# end master
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
--------------------------------------------------------------------------------
***********Slave server*******************
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
slave-net-timeout = 30
master-connect-retry = 30
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
# changes made to do slave
server-id = 2
relay-log = /usr/local/mysql/data/mysql-relay-bin
relay-log-index = /usr/local/mysql/data/mysql-relay-bin.index
log-error = /usr/local/mysql/data/mysql.err
master-info-file = /usr/local/mysql/data/mysql-master.info
relay-log-info-file = /usr/local/mysql/data/mysql-relay-log.info
datadir = /usr/local/mysql/data
# end slave setup
# end slave
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
---------------------------------------------------------------------------
Create user on master:
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'10.0.0.2' IDENTIFIED BY 'replpass';
FLUSH TABLES WITH READ LOCK;
mysqldump -u root --all-databases --single-transaction --master-data=1 > masterdump.sql
rsync -avz -e ssh /opt/dbdump123.db root@10.0.0.2:/opt
mysql < masterdump.sql
Login to Slave Server.
CHANGE MASTER TO MASTER_HOST='10.0.0.1', MASTER_USER='repl', MASTER_PASSWORD='replpass';
mysql> start slave;
mysql> show slave status\G
Its Looks Like.
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.0.0.1
Master_User: repl
Master_Port: 3306
Connect_Retry: 30
Master_Log_File: mysql-bin.000014
Read_Master_Log_Pos: 199
Relay_Log_File: mysql-relay-bin.000242
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.000014
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 199
Relay_Log_Space: 551
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
---------------------------------------------------
SHOW MASTER STATUS;
mysql> SHOW MASTER STATUS\G;
*************************** 1. row ***************************
File: mysql-bin.000014
Position: 199
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
ERROR:
No query specified
---------------------------------------------------------
Slave server ip: 10.0.0.2
Slave username: repl
Slave pw: replpasswd
Your data directory is: /usr/local/mysql/data
-----------------------Master Server-----------------------
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
# changes made to do slave
server-id = 1
relay-log = /usr/local/mysql/data/mysql-relay-bin
relay-log-index = /usr/local/mysql/data/mysql-relay-bin.index
log-error = /usr/local/mysql/data/mysql.err
master-info-file = /usr/local/mysql/data/mysql-master.info
relay-log-info-file = /usr/local/mysql/data/mysql-relay-log.info
datadir = /usr/local/mysql/data
log-bin = /usr/local/mysql/data/mysql-bin
#binlog_do_db =f4pforalpha
# end master
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
--------------------------------------------------------------------------------
***********Slave server*******************
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
slave-net-timeout = 30
master-connect-retry = 30
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
# changes made to do slave
server-id = 2
relay-log = /usr/local/mysql/data/mysql-relay-bin
relay-log-index = /usr/local/mysql/data/mysql-relay-bin.index
log-error = /usr/local/mysql/data/mysql.err
master-info-file = /usr/local/mysql/data/mysql-master.info
relay-log-info-file = /usr/local/mysql/data/mysql-relay-log.info
datadir = /usr/local/mysql/data
# end slave setup
# end slave
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
---------------------------------------------------------------------------
Create user on master:
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'10.0.0.2' IDENTIFIED BY 'replpass';
FLUSH TABLES WITH READ LOCK;
mysqldump -u root --all-databases --single-transaction --master-data=1 > masterdump.sql
rsync -avz -e ssh /opt/dbdump123.db root@10.0.0.2:/opt
mysql < masterdump.sql
Login to Slave Server.
CHANGE MASTER TO MASTER_HOST='10.0.0.1', MASTER_USER='repl', MASTER_PASSWORD='replpass';
mysql> start slave;
mysql> show slave status\G
Its Looks Like.
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.0.0.1
Master_User: repl
Master_Port: 3306
Connect_Retry: 30
Master_Log_File: mysql-bin.000014
Read_Master_Log_Pos: 199
Relay_Log_File: mysql-relay-bin.000242
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.000014
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 199
Relay_Log_Space: 551
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
---------------------------------------------------
SHOW MASTER STATUS;
mysql> SHOW MASTER STATUS\G;
*************************** 1. row ***************************
File: mysql-bin.000014
Position: 199
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
ERROR:
No query specified
---------------------------------------------------------
Friday, October 16, 2009
Cpanel/WHM Documentation
Hi All,
You may find good documentation of cPanel/WHM installation and configuration.
http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/WebHome
Enjoy- ;)
You may find good documentation of cPanel/WHM installation and configuration.
http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/WebHome
Enjoy- ;)
Monday, September 21, 2009
Shrikant Lokhande's blog | Found on IndiBlogger.in
I want you to take a look at: Shrikant Lokhande's blog
It's on IndiBlogger.in, the largest, coolest and most active community of Indian bloggers!
Sunday, September 6, 2009
How to change MTA on Centos5.3(RHEL based server)
Here you can see, how to change MTA qmail to any other you can set as simple sendmail or postfix, exim or qmail.
[root@hostshot ~]#ll /etc/alternatives/mta
lrwxrwxrwx 1 root root 23 Aug 31 03:39 /etc/alternatives/mta -> /var/qmail/bin/sendmail
[root@hotshot ~]# alternatives --config mta
There are 4 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /var/qmail/bin/sendmail
2 /usr/sbin/sendmail.exim
3 /usr/sbin/sendmail.postfix
4 /usr/sbin/sendmail.sendmail
Enter to keep the current selection[+], or type selection number: 2
[root@vh115sj ~]# /etc/init.d/qmail stop
Stopping : [root@hotshot ~]# /etc/init.d/exim restart
Shutting down exim: [ OK ]
Starting exim: [ OK ]
[root@hotshot ~]# echo " for shrikant " | mail -s " for shrikant " shrikant.lokhande@betterlabs.net
;) Its done. Please comment if any issue.
[root@hostshot ~]#ll /etc/alternatives/mta
lrwxrwxrwx 1 root root 23 Aug 31 03:39 /etc/alternatives/mta -> /var/qmail/bin/sendmail
[root@hotshot ~]# alternatives --config mta
There are 4 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /var/qmail/bin/sendmail
2 /usr/sbin/sendmail.exim
3 /usr/sbin/sendmail.postfix
4 /usr/sbin/sendmail.sendmail
Enter to keep the current selection[+], or type selection number: 2
[root@vh115sj ~]# /etc/init.d/qmail stop
Stopping : [root@hotshot ~]# /etc/init.d/exim restart
Shutting down exim: [ OK ]
Starting exim: [ OK ]
[root@hotshot ~]# echo " for shrikant " | mail -s " for shrikant " shrikant.lokhande@betterlabs.net
;) Its done. Please comment if any issue.
Thursday, August 20, 2009
Problem with installation of gem mechanize nokogiri rfeedparser
If the issue is with installtion of :
gem install mechanize
Following package needs:
yum install expat
yum install libexpat
yum install libxml2-devel
yum install libxml
yum install libxml-devel
yum install libxslt libxslt-dev
yum install libxslt-devel
cd /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.3.3
ruby ext/nokogiri/extconf.rb
make
make install
Or just do "gem install mechanize"
----------------------------------------------------------------------
gem install rfeedparser
Building native extensions. This could take a while...
ERROR: Error installing rfeedparser:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile
make
gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -D_FILE_OFFSET_BITS=64 -fPIC -O2 -g -Wall -Wno-parentheses -o hpricot_scan.o -c hpricot_scan.c
ext/hpricot_scan/hpricot_scan.rl: In function ‘hpricot_scan’:
ext/hpricot_scan/hpricot_scan.rl:172: error: ‘struct RString’ has no member named ‘ptr’
ext/hpricot_scan/hpricot_scan.rl:185: error: ‘struct RString’ has no member named ‘ptr’
ext/hpricot_scan/hpricot_scan.rl:185: error: ‘struct RString’ has no member named ‘len’
ext/hpricot_scan/hpricot_scan.rl:186: error: ‘struct RString’ has no member named ‘len’
ext/hpricot_scan/hpricot_scan.rl:202: error: ‘struct RString’ has no member named ‘ptr’
make: *** [hpricot_scan.o] Error 1
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.6 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.6/ext/hpricot_scan/gem_make.out
Resolution:
Need Above all yum packages installed.
http://www.yoshidam.net/xmlparser-0.6.8.tar.gz
cd xmlparser/
ruby extconf.rb
checking for expat.h... yes
checking for XML_ParserCreate() in -lexpat... yes
checking for XML_SetNotStandaloneHandler()... yes
checking for XML_SetParamEntityParsing()... yes
checking for XML_SetDoctypeDeclHandler()... yes
checking for XML_ParserReset()... yes
checking for XML_SetSkippedEntityHandler()... yes
checking for XML_GetFeatureList()... yes
checking for XML_UseForeignDTD()... yes
checking for XML_GetIdAttributeIndex()... yes
checking for ntohl() in -lsocket... no
creating Makefile
make && make install
root@localhost xmlparser]# gem install rfeedparser
Successfully installed rfeedparser-0.9.951
1 gem installed
[root@localhost xmlparser]#
rock na.! if any issue, write to lokahnde.shrikant@gmail.com
gem install mechanize
Following package needs:
yum install expat
yum install libexpat
yum install libxml2-devel
yum install libxml
yum install libxml-devel
yum install libxslt libxslt-dev
yum install libxslt-devel
cd /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.3.3
ruby ext/nokogiri/extconf.rb
make
make install
Or just do "gem install mechanize"
----------------------------------------------------------------------
gem install rfeedparser
Building native extensions. This could take a while...
ERROR: Error installing rfeedparser:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile
make
gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -D_FILE_OFFSET_BITS=64 -fPIC -O2 -g -Wall -Wno-parentheses -o hpricot_scan.o -c hpricot_scan.c
ext/hpricot_scan/hpricot_scan.rl: In function ‘hpricot_scan’:
ext/hpricot_scan/hpricot_scan.rl:172: error: ‘struct RString’ has no member named ‘ptr’
ext/hpricot_scan/hpricot_scan.rl:185: error: ‘struct RString’ has no member named ‘ptr’
ext/hpricot_scan/hpricot_scan.rl:185: error: ‘struct RString’ has no member named ‘len’
ext/hpricot_scan/hpricot_scan.rl:186: error: ‘struct RString’ has no member named ‘len’
ext/hpricot_scan/hpricot_scan.rl:202: error: ‘struct RString’ has no member named ‘ptr’
make: *** [hpricot_scan.o] Error 1
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.6 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.6/ext/hpricot_scan/gem_make.out
Resolution:
Need Above all yum packages installed.
http://www.yoshidam.net/xmlparser-0.6.8.tar.gz
cd xmlparser/
ruby extconf.rb
checking for expat.h... yes
checking for XML_ParserCreate() in -lexpat... yes
checking for XML_SetNotStandaloneHandler()... yes
checking for XML_SetParamEntityParsing()... yes
checking for XML_SetDoctypeDeclHandler()... yes
checking for XML_ParserReset()... yes
checking for XML_SetSkippedEntityHandler()... yes
checking for XML_GetFeatureList()... yes
checking for XML_UseForeignDTD()... yes
checking for XML_GetIdAttributeIndex()... yes
checking for ntohl() in -lsocket... no
creating Makefile
make && make install
root@localhost xmlparser]# gem install rfeedparser
Successfully installed rfeedparser-0.9.951
1 gem installed
[root@localhost xmlparser]#
rock na.! if any issue, write to lokahnde.shrikant@gmail.com
How to "gem install mysql" ?
If you trying to install mysql gem, and you are not able to install.
-----------------------------------------------------
gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
-----------------------------------------------------
Resolution :
cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/ && ruby extconf.rb --with-mysql-config --with-mysql-include
o/p:
checking for mysql_ssl_set()... yes
checking for mysql.h... yes
creating Makefile
[root@localhost:/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7] make
gcc -I. -I. -I/usr/local/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -g -O2 -c mysql.c
gcc -shared -o mysql.so mysql.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto -ldl -lcrypt -lm -lc
make install
o/p:/usr/bin/install -c -m 0755 mysql.so /usr/local/lib/ruby/site_ruby/1.8/x86_64-linux
[root@localhost rails]# irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'mysql'
=> true
irb(main):003:0> quit
Cool Done.! It may possible that mysql gem is not in gem list.
-----------------------------------------------------
gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
-----------------------------------------------------
Resolution :
cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/ && ruby extconf.rb --with-mysql-config --with-mysql-include
o/p:
checking for mysql_ssl_set()... yes
checking for mysql.h... yes
creating Makefile
[root@localhost:/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7] make
gcc -I. -I. -I/usr/local/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -g -O2 -c mysql.c
gcc -shared -o mysql.so mysql.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto -ldl -lcrypt -lm -lc
make install
o/p:/usr/bin/install -c -m 0755 mysql.so /usr/local/lib/ruby/site_ruby/1.8/x86_64-linux
[root@localhost rails]# irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'mysql'
=> true
irb(main):003:0> quit
Cool Done.! It may possible that mysql gem is not in gem list.
Friday, August 14, 2009
How to set sphinx.yml for Thinking-Sphinx (full text indexer)?
----------------------------------------------------------------------
vi config/sphinx.yml
production:
port: 3312
address: 127.0.0.1
mem_limit: 512M
max_children: 300
max_matches: 100000
seamless_rotate: 1
preopen_indexes: 1
query_log_file: /mnt/app/rails/releases/code/log/searchd.query.log
searchd_log_file: /mnt/app/rails/releases/code/log/searchd.log
pid_file: /mnt/app/crawler/rails/code/log/searchd.production.pid
searchd_file_path: /mnt/app/rails/current/db/sphinx/production/
-----------------------------------------------------------------------
It is for Production mode, you can set same for development or staging mode just to change environment.
vi config/sphinx.yml
production:
port: 3312
address: 127.0.0.1
mem_limit: 512M
max_children: 300
max_matches: 100000
seamless_rotate: 1
preopen_indexes: 1
query_log_file: /mnt/app/rails/releases/code/log/searchd.query.log
searchd_log_file: /mnt/app/rails/releases/code/log/searchd.log
pid_file: /mnt/app/crawler/rails/code/log/searchd.production.pid
searchd_file_path: /mnt/app/rails/current/db/sphinx/production/
-----------------------------------------------------------------------
It is for Production mode, you can set same for development or staging mode just to change environment.
Access remote mysql database.
Grant all databases remotely to given IP address:
GRANT ALL ON *.* TO root@'164.19.212.15' IDENTIFIED BY 'passwd';
If you want to Particular IP address :
GRANT ALL ON india.* TO root@'164.19.212.15' IDENTIFIED BY 'passwd';
GRANT ALL ON *.* TO root@'164.19.212.15' IDENTIFIED BY 'passwd';
If you want to Particular IP address :
GRANT ALL ON india.* TO root@'164.19.212.15' IDENTIFIED BY 'passwd';
Monday, August 10, 2009
Create Session table in (RoR) Ruby on Rails .!
CREATE TABLE `sessions` (
`id` int(11) NOT NULL auto_increment,
`session_id` varchar(255) default NULL,
`data` varchar(255) default NULL,
`updated_at` datetime default NULL,
`created_at` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
To change Session cookie to Active records do following setting:
cat config/initializers/session_store.rb
* un-comment line
ActionController::Base.session_store = :active_record_store
`id` int(11) NOT NULL auto_increment,
`session_id` varchar(255) default NULL,
`data` varchar(255) default NULL,
`updated_at` datetime default NULL,
`created_at` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
To change Session cookie to Active records do following setting:
cat config/initializers/session_store.rb
* un-comment line
ActionController::Base.session_store = :active_record_store
Tuesday, August 4, 2009
MySQL Backups using LVM snapshots
lvcreate -L40G -s -n dbbackup /dev/VolGroup00/LogVol03
lvm> lvremove /dev/VolGroup00/dbbackup
Do you really want to remove active logical volume "dbbackup"? [y/n]:
----------------------------------------------------------------------------
Stapes to Install and configure LVM.
fdisk -l
fdisk /dev/hdb
:p to print partition
:n to Extend partition
:e
Last cylender _______ enter
:n to new partition
Last cylender : +10G
Again create +10G partition
:n
choose: e
Last cylender :+10G
Command:l for list.
---------------------------
Command: t
partition number : 5
hexadecimal number: 8e
again create:
command: t
partition number: 6
hexadecimal number: 8e
command: w to save.
-------------------------
# partprobe
take hdb drive and make two partition if you want 1 is ok.
pvcreate /dev/hdb1 /dev/hdb2
vgcreate test1 /dev/hdb1
mkdir /mnt/Backup_disk/snap0 or
mkdir /snap0
lvcreate -L1000M -s -n /mnt/Backup_disk/snap0 /dev/test1/data
mount /dev/test1/data /mnt/Backup_disk/snap0
or
mount /dev/test1/snap0 /snap0 dependupmon path you can mount any where in disk just
mysql -uroot -p passwd > FLUSH TABLES WITH READ LOCK
create TAR
tar -cvf /mnt/Backup_disk/snap0/mysql`date +%Y%m%d%H`.tar /var/lib/mysql/
login to you mysql
and
mysql > UNLOCK TABLES;
cd /snap0
ls mysql2009080419.tar
tar -xvf mysql2009080419.tar
this is your hot backup.
Now you can umount LVM
root@localhost ~]# umount /mnt/Backup_disk/snap0
Check with command: lvdisplay
--- Logical volume ---
LV Name /dev/test1/snap0
VG Name test1
LV UUID ZCYdo5-RinV-EJ4L-03Tq-Snk1-i1Qt-pkQG1X
LV Write Access read/write
LV snapshot status active destination for /dev/test1/data
LV Status available
# open 0
LV Size 1.00 GB
Current LE 256
COW-table size 1000.00 MB
COW-table LE 250
Allocated to snapshot 0.01%
Snapshot chunk size 8.00 KB
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:3
[root@localhost ~]# lvremove /dev/test1/snap0
Do you really want to remove active logical volume "snap0"? [y/n]: y
Logical volume "snap0" successfully removed
Whenerver you want just crete LVM useing this command:
lvcreate -L1000M -s -n /mnt/Backup_disk/snap0 /dev/test1/data
and mount same process.
lvm> lvremove /dev/VolGroup00/dbbackup
Do you really want to remove active logical volume "dbbackup"? [y/n]:
----------------------------------------------------------------------------
Stapes to Install and configure LVM.
fdisk -l
fdisk /dev/hdb
:p to print partition
:n to Extend partition
:e
Last cylender _______ enter
:n to new partition
Last cylender : +10G
Again create +10G partition
:n
choose: e
Last cylender :+10G
Command:l for list.
---------------------------
Command: t
partition number : 5
hexadecimal number: 8e
again create:
command: t
partition number: 6
hexadecimal number: 8e
command: w to save.
-------------------------
# partprobe
take hdb drive and make two partition if you want 1 is ok.
pvcreate /dev/hdb1 /dev/hdb2
vgcreate test1 /dev/hdb1
mkdir /mnt/Backup_disk/snap0 or
mkdir /snap0
lvcreate -L1000M -s -n /mnt/Backup_disk/snap0 /dev/test1/data
mount /dev/test1/data /mnt/Backup_disk/snap0
or
mount /dev/test1/snap0 /snap0 dependupmon path you can mount any where in disk just
mysql -uroot -p passwd > FLUSH TABLES WITH READ LOCK
create TAR
tar -cvf /mnt/Backup_disk/snap0/mysql`date +%Y%m%d%H`.tar /var/lib/mysql/
login to you mysql
and
mysql > UNLOCK TABLES;
cd /snap0
ls mysql2009080419.tar
tar -xvf mysql2009080419.tar
this is your hot backup.
Now you can umount LVM
root@localhost ~]# umount /mnt/Backup_disk/snap0
Check with command: lvdisplay
--- Logical volume ---
LV Name /dev/test1/snap0
VG Name test1
LV UUID ZCYdo5-RinV-EJ4L-03Tq-Snk1-i1Qt-pkQG1X
LV Write Access read/write
LV snapshot status active destination for /dev/test1/data
LV Status available
# open 0
LV Size 1.00 GB
Current LE 256
COW-table size 1000.00 MB
COW-table LE 250
Allocated to snapshot 0.01%
Snapshot chunk size 8.00 KB
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:3
[root@localhost ~]# lvremove /dev/test1/snap0
Do you really want to remove active logical volume "snap0"? [y/n]: y
Logical volume "snap0" successfully removed
Whenerver you want just crete LVM useing this command:
lvcreate -L1000M -s -n /mnt/Backup_disk/snap0 /dev/test1/data
and mount same process.
Saturday, August 1, 2009
Ruby On Rails : "God Monitoring With backgroundrb".
vi config/backgroundrb.god
#--------------------------------------------------------------
#run on command line with 'god -c backgroundrb.god -D'
RAILS_ROOT = '/mnt/app/application/current'
#load required rails and backgroundrb files
require File.dirname(__FILE__) + '/boot'
require File.dirname(__FILE__) + '/environment'
require 'erb'
$LOAD_PATH << "#{RAILS_ROOT}/vendor/plugins/backgroundrb/lib"
require "#{RAILS_ROOT}/vendor/plugins/backgroundrb/lib/backgroundrb.rb"
#create custom condition for checking that QueryProcessingWorker is running
# MiddleMan = BackgrounDRb::ClusterConnection.new
module God
module Conditions
class Backgroundrb < PollCondition
def initialize; super; end
def valid?; true; end
def test
begin
queue_worker = MiddleMan.all_worker_info.values.flatten.select { |w| :queue_processing_worker == w[:worker] }
queue_worker.empty?
rescue #if all_worker_info raises exception, then bdrb isn't running and we were unable to connect
true
end
end
end
end
end
God::Contacts::Email.message_settings ={
:from => 'shrii@gmail.com'
}
God::Contacts::Email.server_settings = {
:address => "Ipaddress_of mail server",
:port => 25,
:domain => "Ipaddress_of mail server",
:user_name => "user",
:password => "passwd",
:authentication => :login
}
God.contact(:email) do |c|
c.name = 'Username'
c.email = 'shrikant@gmail.com'
end
God.watch do |w|
w.name = 'backgroundrb'
w.interval = 1.minute
w.restart = "cd #{RAILS_ROOT} && /usr/local/bin/ruby script/backgroundrb stop && /usr/local/bin/ruby script/backgroundrb -e production start"
w.stop = "cd #{RAILS_ROOT} && /usr/local/bin/ruby script/backgroundrb stop"
w.start = "cd #{RAILS_ROOT} && /usr/local/bin/ruby script/backgroundrb -e production start"
w.grace = 1.minute
w.pid_file = "#{RAILS_ROOT}/tmp/pids/backgroundrb_11006.pid"
w.start_if do |start|
start.condition(:process_running) do |c|
c.running = false
c.notify = "username"
end
end
w.restart_if do |restart|
restart.condition(:cpu_usage) do |c|
c.above = 70.percent
c.times = [3,5]
c.notify = "username"
end
end
end
#----------------------------------------------------------
* To Start God. in RAILS_ROOT
god -c config/backgroundrb.god
* To Check Prosess id of GOD:
ps -aufx| grep god
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 11219 0.0 0.0 60260 732 ttyp1 S+ 07:48 0:00 \_ grep god
root 26944 0.2 0.3 163240 61476 ttyp0 S 07:14 0:05 /usr/local/bin/ruby /usr/local/bin/god -c config/backgroundrb.god
Thats It.. Please let me know if there is any issue.
#--------------------------------------------------------------
#run on command line with 'god -c backgroundrb.god -D'
RAILS_ROOT = '/mnt/app/application/current'
#load required rails and backgroundrb files
require File.dirname(__FILE__) + '/boot'
require File.dirname(__FILE__) + '/environment'
require 'erb'
$LOAD_PATH << "#{RAILS_ROOT}/vendor/plugins/backgroundrb/lib"
require "#{RAILS_ROOT}/vendor/plugins/backgroundrb/lib/backgroundrb.rb"
#create custom condition for checking that QueryProcessingWorker is running
# MiddleMan = BackgrounDRb::ClusterConnection.new
module God
module Conditions
class Backgroundrb < PollCondition
def initialize; super; end
def valid?; true; end
def test
begin
queue_worker = MiddleMan.all_worker_info.values.flatten.select { |w| :queue_processing_worker == w[:worker] }
queue_worker.empty?
rescue #if all_worker_info raises exception, then bdrb isn't running and we were unable to connect
true
end
end
end
end
end
God::Contacts::Email.message_settings ={
:from => 'shrii@gmail.com'
}
God::Contacts::Email.server_settings = {
:address => "Ipaddress_of mail server",
:port => 25,
:domain => "Ipaddress_of mail server",
:user_name => "user",
:password => "passwd",
:authentication => :login
}
God.contact(:email) do |c|
c.name = 'Username'
c.email = 'shrikant@gmail.com'
end
God.watch do |w|
w.name = 'backgroundrb'
w.interval = 1.minute
w.restart = "cd #{RAILS_ROOT} && /usr/local/bin/ruby script/backgroundrb stop && /usr/local/bin/ruby script/backgroundrb -e production start"
w.stop = "cd #{RAILS_ROOT} && /usr/local/bin/ruby script/backgroundrb stop"
w.start = "cd #{RAILS_ROOT} && /usr/local/bin/ruby script/backgroundrb -e production start"
w.grace = 1.minute
w.pid_file = "#{RAILS_ROOT}/tmp/pids/backgroundrb_11006.pid"
w.start_if do |start|
start.condition(:process_running) do |c|
c.running = false
c.notify = "username"
end
end
w.restart_if do |restart|
restart.condition(:cpu_usage) do |c|
c.above = 70.percent
c.times = [3,5]
c.notify = "username"
end
end
end
#----------------------------------------------------------
* To Start God. in RAILS_ROOT
god -c config/backgroundrb.god
* To Check Prosess id of GOD:
ps -aufx| grep god
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 11219 0.0 0.0 60260 732 ttyp1 S+ 07:48 0:00 \_ grep god
root 26944 0.2 0.3 163240 61476 ttyp0 S 07:14 0:05 /usr/local/bin/ruby /usr/local/bin/god -c config/backgroundrb.god
Thats It.. Please let me know if there is any issue.
Friday, July 31, 2009
(98)Address already in use: make_sock: could not bind to address [::]:8000 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
If You facing Problem:
(98)Address already in use: make_sock: could not bind to address [::]:8000
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8000
no listening sockets available, shutting down
Fix as follows :
netstat -tulpn| grep :80
tcp 0 0 0.0.0.0:8028 0.0.0.0:* LISTEN 5476/(squid)
tcp 0 0 :::80 :::* LISTEN 5474/squid
It means 80 port running for Squid service. Solution is Stop squid service.
killall -9 squid
and restart Apache/httpd
/etc/init.d/httpd restart
Cool Enjoy... if issue ping to me. ;)
(98)Address already in use: make_sock: could not bind to address [::]:8000
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8000
no listening sockets available, shutting down
Fix as follows :
netstat -tulpn| grep :80
tcp 0 0 0.0.0.0:8028 0.0.0.0:* LISTEN 5476/(squid)
tcp 0 0 :::80 :::* LISTEN 5474/squid
It means 80 port running for Squid service. Solution is Stop squid service.
killall -9 squid
and restart Apache/httpd
/etc/init.d/httpd restart
Cool Enjoy... if issue ping to me. ;)
Wednesday, July 29, 2009
How To Read File In .gz Format.
Just Use This commands:
---------------------------------------------------
zcat maillog.1.gz | less
zcat maillog.1.gz | grep '@yahoo.co'
---------------------------------------------------
---------------------------------------------------
zcat maillog.1.gz | less
zcat maillog.1.gz | grep '@yahoo.co'
---------------------------------------------------
Tuesday, July 28, 2009
Postfix SMTP installation on CentOs/Linux
This is Postfix configuration on CentOs/Linux with relay, Usually people want to send bulk mail with mail server, so it will really help this post
----------------------------------------------------------------------------------------------------
yum install postfix
* then change default main.cnf to main.cnf.Bak, your config file as follows: /etc/postfix/main.cf
---------------------------------------------------------------------------
myhostname = mail.example.com
mydomain = mail.example.com
myorigin = $mydomain
smtpd_banner = $myhostname ESMTP $mail_name
biff = no
append_dot_mydomain = yes
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localdomain, localhost, localhost.localdomain, localhost.$mydomain, $mydomain
mynetworks = 202.78.56.89, 127.0.0.1, 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
# SECURITY NOTE: Listening on all interfaces. Make sure your firewall is
# configured correctly
inet_interfaces = all
smtp_sasl_auth_enable = yes
smtpd_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
#Following three lines Very imp set as it is or see maillog for error
permit_sasl_authenticated,
permit_mynetworks,
check_relay_domains
default_destination_concurrency_limit = 4
smtpd_enforce_tls = no
smtpd_tls_loglevel = 1
smtpd_use_tls = no
soft_bounce = yes
bounce_template_file = /etc/postfix/bounce.cf
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
html_directory = no
setgid_group = postdrop
command_directory = /usr/sbin
manpage_directory = /usr/local/man
daemon_directory = /usr/libexec/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
queue_directory = /var/spool/postfix
mail_owner = postfix
----------------------------------------------------------------------
* Create file /etc/postfix/sasl_passwd host username:passwd
cat /etc/postfix/sasl_passwd
202.78.56.89 shrii:shrii
* Very Imp: Make sure user "shrii" is available on your server. if not you have to create it
with useradd do add same password which you have given to sasl file.
then
chmod 600 /etc/postfix/sasl_passwd
[root@localhost postfix]# ll /etc/postfix/sasl_passwd
-rw------- 1 root root 38 Jul 28 12:54 /etc/postfix/sasl_passwd
Imp stapes:
postmap hash:/etc/postfix/sasl_passwd
restart services :
[root@localhost postfix]# /etc/init.d/saslauthd restart
Stopping saslauthd: [ OK ]
Starting saslauthd: [ OK ]
[root@localhost postfix]# /etc/init.d/postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
* If issue is :
[root@d]# testsaslauthd -u gimpif -p fbetter
0: NO "authentication failed"
* Do
[root@d] yum install imapd imap dovecot cyrus-imapd cyrus-imapd-perl cyrus-imapd-utils db4-utils libsysfs lm_sensors net-snmp-libs perl cyrus-sasl-plain
yum install courier-imap
Fixed.
testsaslauthd -umail -ppasswd
0: OK "Success."
Let us check mails.
Test Mail from server:
echo "hi" | mail -s " test from local" youremail@domain.com
----------------------------------------------------------------------------------------------------
yum install postfix
* then change default main.cnf to main.cnf.Bak, your config file as follows: /etc/postfix/main.cf
---------------------------------------------------------------------------
myhostname = mail.example.com
mydomain = mail.example.com
myorigin = $mydomain
smtpd_banner = $myhostname ESMTP $mail_name
biff = no
append_dot_mydomain = yes
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localdomain, localhost, localhost.localdomain, localhost.$mydomain, $mydomain
mynetworks = 202.78.56.89, 127.0.0.1, 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
# SECURITY NOTE: Listening on all interfaces. Make sure your firewall is
# configured correctly
inet_interfaces = all
smtp_sasl_auth_enable = yes
smtpd_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
#Following three lines Very imp set as it is or see maillog for error
permit_sasl_authenticated,
permit_mynetworks,
check_relay_domains
default_destination_concurrency_limit = 4
smtpd_enforce_tls = no
smtpd_tls_loglevel = 1
smtpd_use_tls = no
soft_bounce = yes
bounce_template_file = /etc/postfix/bounce.cf
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
html_directory = no
setgid_group = postdrop
command_directory = /usr/sbin
manpage_directory = /usr/local/man
daemon_directory = /usr/libexec/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
queue_directory = /var/spool/postfix
mail_owner = postfix
----------------------------------------------------------------------
* Create file /etc/postfix/sasl_passwd host username:passwd
cat /etc/postfix/sasl_passwd
202.78.56.89 shrii:shrii
* Very Imp: Make sure user "shrii" is available on your server. if not you have to create it
with useradd do add same password which you have given to sasl file.
then
chmod 600 /etc/postfix/sasl_passwd
[root@localhost postfix]# ll /etc/postfix/sasl_passwd
-rw------- 1 root root 38 Jul 28 12:54 /etc/postfix/sasl_passwd
Imp stapes:
postmap hash:/etc/postfix/sasl_passwd
restart services :
[root@localhost postfix]# /etc/init.d/saslauthd restart
Stopping saslauthd: [ OK ]
Starting saslauthd: [ OK ]
[root@localhost postfix]# /etc/init.d/postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
* If issue is :
[root@d]# testsaslauthd -u gimpif -p fbetter
0: NO "authentication failed"
* Do
[root@d] yum install imapd imap dovecot cyrus-imapd cyrus-imapd-perl cyrus-imapd-utils db4-utils libsysfs lm_sensors net-snmp-libs perl cyrus-sasl-plain
yum install courier-imap
Fixed.
testsaslauthd -umail -ppasswd
0: OK "Success."
Let us check mails.
Test Mail from server:
echo "hi" | mail -s " test from local" youremail@domain.com
ezcrypto segmentation fault error (Rails 2.3.2)
There is dependency of openssl version for ezcrypto gem, fix as follows.
=======================
gem install ezcrypto
gem list
==>
*** LOCAL GEMS ***
ezcrypto (0.7.2)
*Check openssh Version.!
rpm -q openssl-devel openssl
openssl-devel-0.9.8b-10.el5
openssl-devel-0.9.8e-7.el5
openssl-0.9.8b-10.el5
openssl-0.9.8e-7.el5
* if found openssl-devel-0.9.8b-10.el5 and openssl-0.9.8b-10.el5. Please remove from repository.
Using this command.
rpm -e openssl-devel-0.9.8b-10.el5 openssl-0.9.8b-10.el5
*If not present install this package.
rpm -ivh --force /var/cache/yum/base/packages/openssl-0.9.8e-7.el5.i386.rpm
rpm -ivh --force /var/cache/yum/base/packages/openssl-devel-0.9.8e-7.el5.i386.rpm
* if not found in package in /var/cache/yum/base/packages/ then download from
http://mirror.centos.org/centos-5/5.3/os/i386/CentOS/ and copy in /var/cache/yum/base/packages/
and install again.
* check the package and version.
rpm -q openssl-devel openssl
openssl-devel-0.9.8e-7.el5
openssl-0.9.8e-7.el5
Thanks- Now Its Fixed.
=======================
gem install ezcrypto
gem list
==>
*** LOCAL GEMS ***
ezcrypto (0.7.2)
*Check openssh Version.!
rpm -q openssl-devel openssl
openssl-devel-0.9.8b-10.el5
openssl-devel-0.9.8e-7.el5
openssl-0.9.8b-10.el5
openssl-0.9.8e-7.el5
* if found openssl-devel-0.9.8b-10.el5 and openssl-0.9.8b-10.el5. Please remove from repository.
Using this command.
rpm -e openssl-devel-0.9.8b-10.el5 openssl-0.9.8b-10.el5
*If not present install this package.
rpm -ivh --force /var/cache/yum/base/packages/openssl-0.9.8e-7.el5.i386.rpm
rpm -ivh --force /var/cache/yum/base/packages/openssl-devel-0.9.8e-7.el5.i386.rpm
* if not found in package in /var/cache/yum/base/packages/ then download from
http://mirror.centos.org/centos-5/5.3/os/i386/CentOS/ and copy in /var/cache/yum/base/packages/
and install again.
* check the package and version.
rpm -q openssl-devel openssl
openssl-devel-0.9.8e-7.el5
openssl-0.9.8e-7.el5
Thanks- Now Its Fixed.
Tuesday, July 21, 2009
To View Only Directory Listing In Current Path.
Just do.
================
ls -ld */
================
================
ls -ld */
================
Monday, July 20, 2009
When PHP code showing on your Site (mod_php).
If you compile apache but php is not Support, Here are the relevant lines from my httpd.conf file
AddType application/x-httpd-php .php .php4 .php3
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php4 .php3 .phtml .php
AddType application/x-httpd-php-source .phps
The following is for PHP3:
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
The following is for PHP/FI (PHP2):
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php .php4 .php3
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php4 .php3 .phtml .php
AddType application/x-httpd-php-source .phps
The following is for PHP3:
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
The following is for PHP/FI (PHP2):
AddType application/x-httpd-php .phtml
Subscribe to:
Posts (Atom)
