Thursday 10 September 2009

Find Time Since last reboot in Linux

$ uptime
$ cat /proc/uptime
$ last -1 reboot - gives a better result

SendMail Configuration

SendMail Configuration:
MUA (Mail User Agent) --> A client Program to read and compose a mail
MTA (Mail Transfer Agent) --> To send and receive mail
SMTP (Simple Mail Transfer Protocol) -->Mail transferring protocol (post 25)
MDA (Mail Delivery Agent) --> To deliver in users mail box
MAA (Mail Access Agent) --> To take from the mail box and give it to the client
Imap (Internet Mail Access Protocol) --> copy & paste method(port 143)
POP (Post Office Protocol) --> Cut & paste method (port 110)
MTA :--> sendmail, postfix, qmail, exchange(in windows)
MDA :--> procmail, cyrus
MAA :--> Imap & pop
MUA :--> Evolution, kmail
Packages to install:
#rpm -ivh sendmail-8.13.1-2.i386.rpm --aid
#rpm -ivh sendmail-cf-8.13.1-2.i386.rpm --aid
#rpm -ivh procmail-3.22-14.i386.rpm --aid
#rpm -ivh dovecot-0.99.11-2.EL4.1.i386.rpm --aid
Configuration Files:
# vi /etc/mail/sendmail.cf --> written in macro languages
#vi /etc/mail/sendmail.mc --> written in english
#vi /etc/dovecot.conf
Deamon:
sendmail &
dovecot
Configure these files:
#vi /etc/mail/sendmail.mc
edit line 105
dnl DEAMON_OPTIONS ('port=smtp, Addr=127.0.0.1, Name=MTA') dnl
#m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
#vi /etc/dovecot.conf
edit line 14
protocol=imap imaps pop3
#service dovecot start
#service sendmail restart
To send a test mail:
#mail -v -s "testmail" user1@urdomain.com
enter the message and then press ctr+d to send the message
To check the mail:
#mail
Postfix
Packages to Install:
#rpm -ivh postfix-2.1.5-4.2.RHEL4.i386.rpm --aid
#rpm -ivh dovecot-0.99.11-2.EL4.1.i386.rpm --aid
Configuration files
#vi /etc/postfix/main.cf
#vi /etc/dovecot.conf

Deamon:
postfix
dovecot
Edit the configuration line
#vi /etc/postfix/main.cf
Line
69 myhostname=urdomain.com
76 mydomain=book.com
92 myorigin=$mydomain
109 #inet_interfaces=localhost
106 inet_interfaces=all
154 mydestination=$myhostname,localhost.$mydomain
#rpm -ivh system-switch-mail-0.5.25-3.noarch.rpm --> this is to switch MTA (by default relaying is enabled in postfix)

DNS Settings -Linux

Packages to install:
#rpm -ivh bind-9.2.4-2.i386.rpm --aid
#rpm -ivh cashing-nameserver-7.3-3.noarch.rpm --aid
#rpm -ivh bind-utils-9.2.4-2.i386.rpm --aid

Configuration files:
#vi /etc/named.conf
Client side configuration files:
#vi /etc/resolv.conf
Edit the server config file
eg: do not delete anything from this file, edit only the particular area.
#vi /etc/named.conf
options { directory "/var/named";
};
zone "note.book.com." IN {
type master;
file "localdomain.zone";
};
zone "1.10.10.in-addr.arpa" IN{
type master;
file "named.local";
};
:wq - save the file and exit
To check error in the configured file
#named-checkconf /etc/named.conf
Now edit the localdomain.zone file and named.local file
#vi /var/named/localdomain.zone
replace the "localhost" with note.book.com.
and change the ip address to 10.10.1.1
#vi /var/named/named.local
here also replace the "localhost" with note.book.com.
and enter the last no. of the ipaddress. here its 1
#service named restart -> to restart the named configuration files
# nslookup 10.10.1.1
#nslookup note.book.com

in both the case you should get the name to address and back