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. ;)

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'


---------------------------------------------------

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

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.

Tuesday, July 21, 2009

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

Sunday, July 19, 2009

How to login in a remote server using SSH and no password ?

Just use Two commands.
=====================================
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.0
=====================================


Simplest Way for Backup, Samba server, rsync and many more if you use.

Wednesday, July 15, 2009

Perlbal Configure Example.

--------------------------------------------------------------------
LOAD vhosts
LOAD vpaths
LOAD AccessControl
Load palimg
Load AccessControl

#SERVER aio_mode = ioaio

CREATE POOL poolserver1
POOL poolserver1 ADD 0.0.0.0:7200
POOL poolserver1 ADD 0.0.0.0:7201
POOL poolserver1 ADD 0.0.0.0:7202
POOL poolserver1 ADD 0.0.0.0:7203

CREATE SERVICE site
# NOTE: SSL mode only works for reverse_proxy, not for webserver.
# http://lists.danga.com/pipermail/perlbal/2008-April/000916.html
SET role = reverse_proxy
SET pool = poolserver1
SET listen = 0.0.0.0:443
SET persist_client = on
SET max_backend_uses = 10
SET backend_persist_cache = 2
SET persist_backend = on
SET verify_backend = on
SET balance_method = random
SET enable_ssl = on
SET ssl_key_file = /etc/perlbal/certs/server-key.pem
SET ssl_cert_file = /etc/perlbal/certs/server-cert.pem

# optionally set the cipher list. the default is "ALL:!LOW:!EXP"
SET ssl_cipher_list = ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

ENABLE site

CREATE SERVICE web_stat
SET role = web_server
SET docroot = /mnt/app/current/public
SET dirindexing = on
ENABLE web_stat


CREATE SERVICE pub1
SET listen = 0.0.0.0:80
SET role = selector
SET plugins = vhosts
SET persist_client = on
VHOST example.com = server1
VHOST *.example.com = site
ENABLE pub1
#------------------------------
#CREATE POOL my_apache
#POOL my_apache ADD 127.0.0.1:

#CREATE SERVICE apps
# SET role = web_server
# SET docroot = /var/www/html/apps
# SET dirindexing = on
#ENABLE apps
--------------------------------------------------------------------------