How to Grep Multiples Lines and using Specific Keyword on Linux

grep is a command line text search utility originally written for Unix or linux. In linux you can grep multiple lines before or after matching the keywords. This examples has been tested on linux CentOS 6.2, but it may workings on other linux version such as Redhat Enterprise Linux 5 (RHEL5) or (RHEL6).

Get grep command help :

[root@centos62 ~]# grep --help

Example :

Context control:
  -B, --before-context=NUM  print NUM lines of leading context
  -A, --after-context=NUM   print NUM lines of trailing context
  -C, --context=NUM         print NUM lines of output context
  -NUM                      same as --context=NUM

Assumed that you have exported all log for 29 March 2012 from /var/log/messages into 29032012.txt as below :

[root@centos62 ~]# more /var/log/messages | grep "Mar 29" > 29032012.txt

1. How to Grep Multiples Lines

Please grep “cubic” with -B1 and -A4 :

[root@centos62 ~]# grep -B1 -A4 "cubic" 29032012.txt

The output will return like this :

Mar 29 21:04:16 centos62 kernel: usbhid: v2.6:USB HID core driver
Mar 29 21:04:16 centos62 kernel: TCP cubic registered
Mar 29 21:04:16 centos62 kernel: Initializing XFRM netlink socket
Mar 29 21:04:16 centos62 kernel: NET: Registered protocol family 17
Mar 29 21:04:16 centos62 kernel: Using IPI No-Shortcut mode
Mar 29 21:04:16 centos62 kernel: registered taskstats version 1

2. How to Grep using Specific Keyword :
Grep only keyword “BIOS-e820” from 29032012.txt file as below :

[root@centos62 ~]# more 29032012.txt | grep "BIOS-e820"

The output will return like this :

Mar 29 21:04:16 centos62 kernel: BIOS-e820: 0000000000000000 - 000000000009f800 (usable)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 00000000000ca000 - 00000000000cc000 (reserved)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 00000000000dc000 - 00000000000e0000 (reserved)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 00000000000e4000 - 0000000000100000 (reserved)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 0000000000100000 - 000000003fef0000 (usable)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 000000003fef0000 - 000000003feff000 (ACPI data)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 000000003feff000 - 000000003ff00000 (ACPI NVS)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 000000003ff00000 - 0000000040000000 (usable)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 00000000e0000000 - 00000000f0000000 (reserved)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
Mar 29 21:04:16 centos62 kernel: BIOS-e820: 00000000fffe0000 - 0000000100000000 (reserved)

How to Configure Bind Chroot DNS Server on Linux CentOS 5.7 Server

In this post, i will guide you on how to configure Bind Chroot DNS server on Linux CentOS 5.7 Server. DNS is the Domain Name System that maintains a database that can help user’s computer to translate domain names such as www.ehowstuff.com to IP addresses such as 184.173.214.97. DNS on CentOS is based on the named daemon, which is built on the BIND package developed through the Internet Software Consortium. (More information is available from the BIND home page at www.isc.org/products/BIND.) This steps has been tested on linux CentOS 5.7 but it may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5 and CentOS 5.6.

1. Install Bind Chroot DNS Server :

[root@CentOS57 ~]# yum install bind-chroot -y

2. Create a file /var/named/chroot/var/named/bloggerbaru.local with the following configuration :

[root@CentOS57 ~]# vi /var/named/chroot/var/named/bloggerbaru.local
;
;       Addresses and other host information.
;
@       IN      SOA     bloggerbaru.local. hostmaster.bloggerbaru.local. (
                               2011030801      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

;       Define the nameservers and the mail servers

               IN      NS      ns.bloggerbaru.local.
               IN      A       192.168.1.45
               IN      MX      10 mail.bloggerbaru.local.

mail            IN      A       192.168.1.45
ns              IN      A       192.168.1.45

3. Generate an RNDC key :
The rndc tool is used to managed the named daemon. We need to generate a keyfile called /etc/rndc.key which is referenced both by /etc/rndc.conf and /etc/named.conf. Execute the following command to generate the RNDC key :

[root@CentOS57 ~]# rndc-confgen -a -c /etc/rndc.key
wrote key file "/etc/rndc.key"

4. View the content of the RNDC key :

[root@CentOS57 ~]# cat /etc/rndc.key
key "rndckey" {
        algorithm hmac-md5;
        secret "jwsFpL7OJR+x9w+YRkGrXA==";
};

5. Edit the /var/named/chroot/etc/named.conf file for bloggerbaru.local :

[root@CentOS57 ~]# vi /var/named/chroot/etc/named.conf
options {
       directory "/var/named";
       dump-file "/var/named/data/cache_dump.db";
       statistics-file "/var/named/data/named_stats.txt";
forwarders { 8.8.8.8; };
};
include "/etc/rndc.key";
// We are the master server for bloggerbaru.local

zone "bloggerbaru.local" {
    type master;
    file "bloggerbaru.local";
};

6. Start the DNS service using the following command :

[root@CentOS57 ~]# /etc/init.d/named start
Starting named:                                            [  OK  ]

or

[root@CentOS57 ~]# service named start
Starting named:                                            [  OK  ]

7. To ensure the named daemon will start at boot, execute the following chkconfig :

[root@CentOS57 ~]# chkconfig named on

8. Before testing, make sure your pc or server pointing to the DNS Server that has been set up. In this case, i want to ensure that CentOS 5.7 poiting to itself :

[root@CentOS57 ~]# cat /etc/resolv.conf
nameserver 127.0.0.1

9. Test your DNS service :

[root@CentOS57 ~]# host -t mx bloggerbaru.local
bloggerbaru.local mail is handled by 10 mail.bloggerbaru.local.
[root@CentOS57 ~]# host -t mx bloggerbaru.local
bloggerbaru.local mail is handled by 10 mail.bloggerbaru.local.

How to Fix “Port conflict detected: 80 (zimbra-store)” During Zimbra 7.1.3 Mail Server Installation on Linux CentOS 5.7

Question :

I am facing same problem during Zimbra 7.1.3 Mail Server Installation on Linux CentOS 5.7. What should ido to fix this ?

Error message :

Checking for port conflicts
Port conflict detected: 80 (zimbra-store)
Port conflicts detected! - Any key to continue

Answer :
What you should do is these :
1. Cancel current zimbra installation.
2. Stop httpd or any service that running on port 80. Then proceed to uninstall that service.
3. run the command :

[root@mail ~]# yum remove httpd -y
[root@mail zcs-7.1.3_GA_3346.RHEL5.20110928134520]# ./install.sh -u
[root@mail ~]# rm -rf /opt/zimbra

4. Restart the zimbra installation as normal

How to Install Bind Chroot DNS Server on Linux CentOS 5.7 Server

DNS is the Domain Name System that maintains a database that can help user’s computer to translate domain names such as www.ehowstuff.com to IP addresses such as 184.173.214.97. DNS on CentOS is based on the named daemon, which is built on the BIND package developed through the Internet Software Consortium. (More information is available from the BIND home page at www.isc.org/products/BIND.) In this post, i will guide you on how to install Bind Chroot DNS server on linux CentOS 5.7 server. This steps may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5 and CentOS 5.6.

1. Install Bind Chroot DNS Server on Linux CentOS 5.7 Server

[root@CentOS57 ~]# yum install bind-chroot -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.oscc.org.my
 * extras: mirror.oscc.org.my
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.oscc.org.my
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-chroot.i386 30:9.3.6-20.P1.el5 set to be updated
--> Processing Dependency: bind = 30:9.3.6-20.P1.el5 for package: bind-chroot
--> Running transaction check
---> Package bind.i386 30:9.3.6-20.P1.el5 set to be updated
--> Processing Dependency: bind-libs = 30:9.3.6-20.P1.el5 for package: bind
--> Running transaction check
--> Processing Dependency: bind-libs = 30:9.3.6-16.P1.el5_7.1 for package: bind-utils
---> Package bind-libs.i386 30:9.3.6-20.P1.el5 set to be updated
--> Running transaction check
---> Package bind-utils.i386 30:9.3.6-20.P1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                  Arch              Version                         Repository         Size
====================================================================================================
Installing:
 bind-chroot              i386              30:9.3.6-20.P1.el5              base               47 k
Installing for dependencies:
 bind                     i386              30:9.3.6-20.P1.el5              base              981 k
Updating for dependencies:
 bind-libs                i386              30:9.3.6-20.P1.el5              base              863 k
 bind-utils               i386              30:9.3.6-20.P1.el5              base              174 k

Transaction Summary
====================================================================================================
Install       2 Package(s)
Upgrade       2 Package(s)

Total download size: 2.0 M
Downloading Packages:
(1/4): bind-chroot-9.3.6-20.P1.el5.i386.rpm                                  |  47 kB     00:00
(2/4): bind-utils-9.3.6-20.P1.el5.i386.rpm                                   | 174 kB     00:01
(3/4): bind-libs-9.3.6-20.P1.el5.i386.rpm                                    | 863 kB     00:07
(4/4): bind-9.3.6-20.P1.el5.i386.rpm                                         | 981 kB     00:08
----------------------------------------------------------------------------------------------------
Total                                                               111 kB/s | 2.0 MB     00:18
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : bind-libs                                                                    1/6
  Installing     : bind                                                                         2/6
  Installing     : bind-chroot                                                                  3/6
  Updating       : bind-utils                                                                   4/6
  Cleanup        : bind-libs                                                                    5/6
  Cleanup        : bind-utils                                                                   6/6

Installed:
  bind-chroot.i386 30:9.3.6-20.P1.el5

Dependency Installed:
  bind.i386 30:9.3.6-20.P1.el5

Dependency Updated:
  bind-libs.i386 30:9.3.6-20.P1.el5                bind-utils.i386 30:9.3.6-20.P1.el5

Complete!

2. Check the DNS named service :

[root@CentOS57 ~]# service named status
rndc: connect failed: 127.0.0.1#953: connection refused
named is stopped

named daemon service is stop, You must configure the bind chroot before you start it.

How to Open the File in Read Only Mode on Linux

Question :
How to open a file on read only mode on linux?

Answer :
This command has been tested on Redhat Enterprise linux 6 (RHEL6) server. To open the file with vim in read only mode on linux, you need to run “vim -R” as below. Vim is enhanced version of vi editor that viewing the text file with coloring. “vim -R” is good command if you want to avoid accidentally deleted any important line as in read only.

Example :

[root@rhel6 ~]# vim -R /etc/passwd

read only mode

How Display Logged in User Information and Terminal number on Linux Server

In this post i will show on how to display logged in user information and terminal number on Linux server. This post provides practical examples for future references. This steps has been tested on Redhat Linux Enterprise server 6 and may working CentOS server as well.

1. “who am i” command is use to display the username of currently logged.

[root@rhel6 ~]# who am i
root     pts/1        2012-04-17 06:14 (192.168.1.52)

2. who command will display all the user currently logged in all terminals.

[root@rhel6 ~]# who
root     tty1         2012-04-17 04:29
root     pts/0        2012-04-17 04:29 (192.168.1.52)
root     pts/1        2012-04-17 06:14 (192.168.1.52)
root     pts/2        2012-04-17 06:01 (192.168.1.52)

3. tty command is used to display the terminal number of currently logged in terminals.

[root@rhel6 ~]# tty
/dev/pts/1

4. The w command shows who is logged in to the system and what they are doing.

[root@rhel6 ~]# w
 06:18:39 up  1:50,  4 users,  load average: 0.02, 0.02, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     -                04:29    1:48m  4.80s  4.78s ping www.google.com
root     pts/0    192.168.1.52     04:29    1:49m  0.02s  0.02s -bash
root     pts/1    192.168.1.52     06:14    0.00s  0.05s  0.01s w
root     pts/2    192.168.1.52     06:01   26.00s  0.11s  0.03s -bash

How to Install Zimbra Collaboration Suite 7.1.3 Mail Server on Linux CentOS 5.7

In this post, i will share with you on how to install zimbra open source mail server on linux CentOS 5.7. According to wikipedia, Zimbra Collaboration Suite (ZCS) is a groupware product created by Zimbra, Inc. It was located in Palo Alto, California, USA. In September 2007, The company was purchased by Yahoo! and subsequently purchased by VMware on January 12, 2010. Two current available version of the zimbra are zimbra open-source version and zimbra network version. Zimbra Network is commercial edition of Zimbra Collaboration Suite.

Before we start to install the zimbra mail server, there are a few prerequisites that must be installed and must be configured properly :

Package nc-1.84-10.fc6.i386 already installed and latest version
Package sudo-1.7.2p1-13.el5.i386 already installed and latest version
Package libidn-0.6.5-1.1.i386 already installed and latest version
Package gmp-4.1.4-10.el5.i386 already installed and latest version
Package 4:perl-5.8.8-38.el5.i386 already installed and latest version
Package sysstat-7.0.2-11.el5.i386 already installed and latest version
Package sqlite-3.3.6-5.i386 already installed and latest version
Package libstdc++-4.1.2-52.el5.i386 already installed and latest version
Package libstdc++44-devel-4.4.6-3.el5.1.i386 already installed and latest version
Package libstdc++-devel-4.1.2-52.el5.i386 already installed and latest version

Extract the ZCS package as below :

[root@CentOS57 ~]# tar -xzvf zcs-7.1.3_GA_3346.RHEL5.20110928134520.tgz
[root@CentOS57 ~]# cd zcs-7.1.3_GA_3346.RHEL5.20110928134520

Run ./install.sh should work for RHEL server. Since this is CentOS server, please run ./install.sh –platform-override instead :

[root@mail zcs-7.1.3_GA_3346.RHEL5.20110928134520]# ./install.sh --platform-override

Operations logged to /tmp/install.log.2551
Checking for existing installation...
    zimbra-ldap...NOT FOUND
    zimbra-logger...NOT FOUND
    zimbra-mta...NOT FOUND
    zimbra-snmp...NOT FOUND
    zimbra-store...NOT FOUND
    zimbra-apache...NOT FOUND
    zimbra-spell...NOT FOUND
    zimbra-convertd...NOT FOUND
    zimbra-memcached...NOT FOUND
    zimbra-proxy...NOT FOUND
    zimbra-archiving...NOT FOUND
    zimbra-cluster...NOT FOUND
    zimbra-core...NOT FOUND

PLEASE READ THIS AGREEMENT CAREFULLY BEFORE USING THE SOFTWARE.
ZIMBRA, INC. ("ZIMBRA") WILL ONLY LICENSE THIS SOFTWARE TO YOU IF YOU
FIRST ACCEPT THE TERMS OF THIS AGREEMENT. BY DOWNLOADING OR INSTALLING
THE SOFTWARE, OR USING THE PRODUCT, YOU ARE CONSENTING TO BE BOUND BY
THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS
AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL OR USE THE PRODUCT.

License Terms for the Zimbra Collaboration Suite:
  http://www.zimbra.com/license/zimbra_public_eula_2.1.html

Do you agree with the terms of the software license agreement? [N] y

Checking for prerequisites...
     FOUND: NPTL
     FOUND: nc-1.84-10
     FOUND: sudo-1.7.2p1-13
     FOUND: libidn-0.6.5-1.1
     FOUND: gmp-4.1.4-10
     FOUND: /usr/lib/libstdc++.so.6
Checking for suggested prerequisites...
     FOUND: perl-5.8.8
     FOUND: sysstat
     FOUND: sqlite
Prerequisite check complete.

Checking for installable packages

Found zimbra-core
Found zimbra-ldap
Found zimbra-logger
Found zimbra-mta
Found zimbra-snmp
Found zimbra-store
Found zimbra-apache
Found zimbra-spell
Found zimbra-memcached
Found zimbra-proxy

Select the packages to install

Install zimbra-ldap [Y]

Install zimbra-logger [Y]

Install zimbra-mta [Y]

Install zimbra-snmp [Y]

Install zimbra-store [Y]

Install zimbra-apache [Y]

Install zimbra-spell [Y]

Install zimbra-memcached [N]

Install zimbra-proxy [N]
Checking required space for zimbra-core
checking space for zimbra-store

Installing:
    zimbra-core
    zimbra-ldap
    zimbra-logger
    zimbra-mta
    zimbra-snmp
    zimbra-store
    zimbra-apache
    zimbra-spell

You appear to be installing packages on a platform different
than the platform for which they were built.

This platform is CentOS5
Packages found: RHEL5
This may or may not work.

Using packages for a platform in which they were not designed for
may result in an installation that is NOT usable. Your support
options may be limited if you choose to continue.

Install anyway? [N]

The system will be modified.  Continue? [N] y

Removing /opt/zimbra
Removing zimbra crontab entry...done.
done.
Cleaning up zimbra init scripts...done.
Cleaning up /etc/ld.so.conf...done.
Cleaning up /etc/prelink.conf...done.
Cleaning up /etc/security/limits.conf...done.

Finished removing Zimbra Collaboration Suite.

Installing packages

    zimbra-core......zimbra-core-7.1.3_GA_3346.RHEL5-20110928134520.i386.rpm...done
    zimbra-ldap......zimbra-ldap-7.1.3_GA_3346.RHEL5-20110928134520.i386.rpm...done
    zimbra-logger......zimbra-logger-7.1.3_GA_3346.RHEL5-20110928134520.i386.rpm...done
    zimbra-mta......zimbra-mta-7.1.3_GA_3346.RHEL5-20110928134520.i386.rpm...done
    zimbra-snmp......zimbra-snmp-7.1.3_GA_3346.RHEL5-20110928134520.i386.rpm...done
    zimbra-store......zimbra-store-7.1.3_GA_3346.RHEL5-20110928134520.i386.rpm...done
    zimbra-apache......zimbra-apache-7.1.3_GA_3346.RHEL5-20110928134520.i386.rpm...done
    zimbra-spell......zimbra-spell-7.1.3_GA_3346.RHEL5-20110928134520.i386.rpm...done
Operations logged to /tmp/zmsetup.03162012-064031.log
Installing LDAP configuration database...done.
Setting defaults...

DNS ERROR resolving MX for mail.bloggerbaru.local
It is suggested that the domain name have an MX record configured in DNS
Change domain name? [Yes] yes
Create domain: [mail.bloggerbaru.local] bloggerbaru.local
        MX: mail.bloggerbaru.local (192.168.1.45)

        Interface: 192.168.1.45
        Interface: 127.0.0.1
done.
Checking for port conflicts

Main menu

   1) Common Configuration:
   2) zimbra-ldap:                             Enabled
   3) zimbra-store:                            Enabled
        +Create Admin User:                    yes
        +Admin user to create:                 admin@bloggerbaru.local
******* +Admin Password                        UNSET
        +Anti-virus quarantine user:           virus-quarantine.lxgi9noyl@bloggerbaru.local
        +Enable automated spam training:       yes
        +Spam training user:                   spam.opy4zybk@bloggerbaru.local
        +Non-spam(Ham) training user:          ham.igvo2fflur@bloggerbaru.local
        +SMTP host:                            mail.bloggerbaru.local
        +Web server HTTP port:                 80
        +Web server HTTPS port:                443
        +Web server mode:                      http
        +IMAP server port:                     143
        +IMAP server SSL port:                 993
        +POP server port:                      110
        +POP server SSL port:                  995
        +Use spell check server:               yes
        +Spell server URL:                     http://mail.bloggerbaru.local:7780/aspell.php
        +Configure for use with mail proxy:    FALSE
        +Configure for use with web proxy:     FALSE
        +Enable version update checks:         TRUE
        +Enable version update notifications:  TRUE
        +Version update notification email:    admin@bloggerbaru.local
        +Version update source email:          admin@bloggerbaru.local

   4) zimbra-mta:                              Enabled
   5) zimbra-snmp:                             Enabled
   6) zimbra-logger:                           Enabled
   7) zimbra-spell:                            Enabled
   8) Default Class of Service Configuration:
   r) Start servers after configuration        yes
   s) Save config to file
   x) Expand menu
   q) Quit

Address unconfigured (**) items  (? - help) 3

Store configuration

   1) Status:                                  Enabled
   2) Create Admin User:                       yes
   3) Admin user to create:                    admin@bloggerbaru.local
** 4) Admin Password                           UNSET
   5) Anti-virus quarantine user:              virus-quarantine.lxgi9noyl@bloggerbaru.local
   6) Enable automated spam training:          yes
   7) Spam training user:                      spam.opy4zybk@bloggerbaru.local
   8) Non-spam(Ham) training user:             ham.igvo2fflur@bloggerbaru.local
   9) SMTP host:                               mail.bloggerbaru.local
  10) Web server HTTP port:                    80
  11) Web server HTTPS port:                   443
  12) Web server mode:                         http
  13) IMAP server port:                        143
  14) IMAP server SSL port:                    993
  15) POP server port:                         110
  16) POP server SSL port:                     995
  17) Use spell check server:                  yes
  18) Spell server URL:                        http://mail.bloggerbaru.local:7780/aspell.php
  19) Configure for use with mail proxy:       FALSE
  20) Configure for use with web proxy:        FALSE
  21) Enable version update checks:            TRUE
  22) Enable version update notifications:     TRUE
  23) Version update notification email:       admin@bloggerbaru.local
  24) Version update source email:             admin@bloggerbaru.local

Select, or 'r' for previous menu [r] 4

Password for admin@bloggerbaru.local (min 6 characters): [sHYnsQzr] password

Store configuration

   1) Status:                                  Enabled
   2) Create Admin User:                       yes
   3) Admin user to create:                    admin@bloggerbaru.local
   4) Admin Password                           set
   5) Anti-virus quarantine user:              virus-quarantine.lxgi9noyl@bloggerbaru.local
   6) Enable automated spam training:          yes
   7) Spam training user:                      spam.opy4zybk@bloggerbaru.local
   8) Non-spam(Ham) training user:             ham.igvo2fflur@bloggerbaru.local
   9) SMTP host:                               mail.bloggerbaru.local
  10) Web server HTTP port:                    80
  11) Web server HTTPS port:                   443
  12) Web server mode:                         http
  13) IMAP server port:                        143
  14) IMAP server SSL port:                    993
  15) POP server port:                         110
  16) POP server SSL port:                     995
  17) Use spell check server:                  yes
  18) Spell server URL:                        http://mail.bloggerbaru.local:7780/aspell.php
  19) Configure for use with mail proxy:       FALSE
  20) Configure for use with web proxy:        FALSE
  21) Enable version update checks:            TRUE
  22) Enable version update notifications:     TRUE
  23) Version update notification email:       admin@bloggerbaru.local
  24) Version update source email:             admin@bloggerbaru.local

Select, or 'r' for previous menu [r] r

Main menu

   1) Common Configuration:
   2) zimbra-ldap:                             Enabled
   3) zimbra-store:                            Enabled
   4) zimbra-mta:                              Enabled
   5) zimbra-snmp:                             Enabled
   6) zimbra-logger:                           Enabled
   7) zimbra-spell:                            Enabled
   8) Default Class of Service Configuration:
   r) Start servers after configuration        yes
   s) Save config to file
   x) Expand menu
   q) Quit

*** CONFIGURATION COMPLETE - press 'a' to apply
Select from menu, or press 'a' to apply config (? - help) a
Save configuration data to a file? [Yes] yes
Save config in file: [/opt/zimbra/config.10126]
Saving config in /opt/zimbra/config.10126...done.
The system will be modified - continue? [No] yes
Operations logged to /tmp/zmsetup.03162012-064031.log
Setting local config values...done.
Setting up CA...done.
Deploying CA to /opt/zimbra/conf/ca ...done.
Creating SSL certificate...done.
Installing mailboxd SSL certificates...done.
Initializing ldap...done.
Setting replication password...done.
Setting Postfix password...done.
Setting amavis password...done.
Setting nginx password...done.
Setting BES searcher  password...done.
Creating server entry for mail.bloggerbaru.local...done.
Saving CA in ldap ...done.
Saving SSL Certificate in ldap ...done.
Setting spell check URL...done.
Setting service ports on mail.bloggerbaru.local...done.
Adding mail.bloggerbaru.local to zimbraMailHostPool in default COS...done.
Installing webclient skins...
        hotrod...done.
        lake...done.
        carbon...done.
        bones...done.
        waves...done.
        steel...done.
        tree...done.
        lemongrass...done.
        pebble...done.
        oasis...done.
        bare...done.
        lavender...done.
        smoke...done.
        sand...done.
        beach...done.
        twilight...done.
        sky...done.
Finished installing webclient skins.
Setting zimbraFeatureTasksEnabled=TRUE...done.
Setting zimbraFeatureBriefcasesEnabled=TRUE...done.
Setting MTA auth host...done.
Setting TimeZone Preference...done.
Initializing mta config...done.
Setting services on mail.bloggerbaru.local...done.
Creating domain bloggerbaru.local...done.
Setting default domain name...done.
Creating domain bloggerbaru.local...already exists.
Creating admin account admin@bloggerbaru.local...done.
Creating root alias...done.
Creating postmaster alias...done.
Creating user spam.opy4zybk@bloggerbaru.local...done.
Creating user ham.igvo2fflur@bloggerbaru.local...done.
Creating user virus-quarantine.lxgi9noyl@bloggerbaru.local...done.
Setting spam training and Anti-virus quarantine accounts...done.
Initializing store sql database...done.
Setting zimbraSmtpHostname for mail.bloggerbaru.local...done.
Configuring SNMP...done.
Checking for default IM conference room...not present.
Initializing default IM conference room...done.
Setting up syslog.conf...done.

You have the option of notifying Zimbra of your installation.
This helps us to track the uptake of the Zimbra Collaboration Suite.
The only information that will be transmitted is:
        The VERSION of zcs installed (7.1.3_GA_3346_CentOS5)
        The ADMIN EMAIL ADDRESS created (admin@bloggerbaru.local)

Notify Zimbra of your installation? [Yes] no
Notification skipped
Starting servers...done.
Installing common zimlets...
        com_zimbra_social...done.
        com_zimbra_srchhighlighter...done.
        com_zimbra_adminversioncheck...done.
        com_zimbra_url...done.
        com_zimbra_cert_manager...done.
        com_zimbra_date...done.
        com_zimbra_webex...done.
        com_zimbra_phone...done.
        com_zimbra_attachcontacts...done.
        com_zimbra_linkedin...done.
        com_zimbra_dnd...done.
        com_zimbra_attachmail...done.
        com_zimbra_bulkprovision...done.
        com_zimbra_email...done.
Finished installing common zimlets.
Restarting mailboxd...done.
Setting up zimbra crontab...done.

Moving /tmp/zmsetup.03162012-064031.log to /opt/zimbra/log

Configuration complete - press return to exit

Login as zimbra user :

[root@mail ~]# su - zimbra

Check Zimbra status :

[zimbra@mail ~]$ zmcontrol status

Start Zimbra services :

[zimbra@mail ~]$ zmcontrol start

Stop Zimbra services :

[zimbra@mail ~]$ zmcontrol stop

How to Remove iptables on Linux RHEL 5/CentOS 5 server

Iptables is used to set up, maintain, and inspect the tables of IPv4 packet filter rules in the Linux kernel. It can run as a host based firewall if properly configured. Iptables places rules into predefined chains (INPUT, OUTPUT and FORWARD) that are checked against any network traffic packets. In certain case, system administrator will need to disable and remove iptables due to some reasons. In this post, i will show the quick step to remove iptables on linux CentOS 5.7 server. This steps may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5 and CentOS 5.6.

Check installed iptables package :

[root@CentOS57 ~]# rpm -qa iptables
iptables-1.3.5-9.1.el5

To remove iptables using rpm command, simply run this :

[root@CentOS57 ~]# rpm -e iptables-1.3.5-9.1.el5

To remove iptables using yum command, simply run this :

[root@CentOS57 ~]# yum install iptables -y

How to Install iptables on Linux RHEL 5/CentOS 5 server

Iptables is used to set up, maintain, and inspect the tables of IPv4 packet filter rules in the Linux kernel. It can run as a host based firewall if properly configured. Iptables places rules into predefined chains (INPUT, OUTPUT and FORWARD) that are checked against any network traffic packets. In this post i will show the quick steps on how to install iptables on CentOS 5.7. This steps may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5, CentOS 5.6, RHEL 5.4 and RHEL 5.5.

1. To install iptables, simply run this command :

[root@CentOS57 ~]# yum install iptables -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.oscc.org.my
 * extras: mirror.oscc.org.my
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.oscc.org.my
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package iptables.i386 0:1.3.5-9.1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                 Arch                Version                      Repository           Size
====================================================================================================
Installing:
 iptables                i386                1.3.5-9.1.el5                base                238 k

Transaction Summary
====================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 238 k
Downloading Packages:
iptables-1.3.5-9.1.el5.i386.rpm                                              | 238 kB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : iptables                                                                     1/1

Installed:
  iptables.i386 0:1.3.5-9.1.el5

Complete!

2. How to check iptables status on Linux RHEL 5/CentOS 5 server :

[root@CentOS57 ~]# service iptables status
Firewall is stopped.

or

[root@CentOS57 ~]# /etc/init.d/iptables status
Firewall is stopped.
[root@CentOS57 ~]#

3. How to start iptables on Linux RHEL 5/CentOS 5 server :

[root@CentOS57 ~]# service iptables start

or

[root@CentOS57 ~]# /etc/init.d/iptables start

4. How to stop iptables on Linux RHEL 5/CentOS 5 server :

[root@CentOS57 ~]# service iptables stop

or

[root@CentOS57 ~]# /etc/init.d/iptables stop

How to Disable iptables on Linux CentOS 5.7 Server

Iptables is used to set up, maintain, and inspect the tables of IPv4 packet filter rules in the Linux kernel. It can run as a host based firewall if properly configured. Iptables places rules into predefined chains (INPUT, OUTPUT and FORWARD) that are checked against any network traffic packets. In certain case, system administrator will need to disable this iptables due to some reasons. In this post, i will show the quick step to disable iptables on linux CentOS 5.7 server. This steps may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5 and CentOS 5.6.

1. How to stop iptables on Linux RHEL 5/CentOS 5 server :

[root@CentOS57 ~]# service iptables stop

or

[root@CentOS57 ~]# /etc/init.d/iptables stop

How to stop ip6tables on Linux RHEL 5/CentOS 5 server :

[root@CentOS57 ~]# service iptables stop

or

[root@CentOS57 ~]# /etc/init.d/ip6tables stop

Note : Ignore this steps if ipv6 not configured or disabled
2. To ensure that iptables will not start after rebooting, please run this chkconfig command :

[root@CentOS57 ~]# chkconfig iptables off

3. How to check iptables status on Linux RHEL 5/CentOS 5 server. Make sure that it was stop :

[root@CentOS57 ~]# service iptables status
Firewall is stopped.

or

[root@CentOS57 ~]# /etc/init.d/iptables status
Firewall is stopped.

How to Install sudo on Linux CentOS 5.7 Server

Sudo is a program or package for Unix or linux operating systems that allows users to run programs with the security privileges of another user. With sudo, linux system administrator is allow to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while logging the commands and arguments. In this post, i will show the quick steps on how to install sudo on CentOS 5.7. This steps may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5 and CentOS 5.6.

[root@CentOS57 ~]# yum install sudo -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.oscc.org.my
 * extras: mirror.oscc.org.my
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.oscc.org.my
base                                                                         | 1.1 kB     00:00
extras                                                                       | 2.1 kB     00:00
rpmforge                                                                     | 1.1 kB     00:00
updates                                                                      | 1.9 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sudo.i386 0:1.7.2p1-13.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package             Arch                Version                          Repository           Size
====================================================================================================
Installing:
 sudo                i386                1.7.2p1-13.el5                   base                351 k

Transaction Summary
====================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 351 k
Downloading Packages:
sudo-1.7.2p1-13.el5.i386.rpm                                                 | 351 kB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : sudo                                                                         1/1

Installed:
  sudo.i386 0:1.7.2p1-13.el5

Complete!

sudo help command and options can be display using “sudo -h” command :

[root@CentOS57 ~]# sudo -h
usage: sudo -h | -K | -k | -L | -V
usage: sudo -v [-AknS] [-p prompt]
usage: sudo -l[l] [-AknS] [-g groupname|#gid] [-p prompt] [-U username] [-u username|#uid] [-g
            groupname|#gid] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C fd] [-g groupname|#gid] [-p prompt] [-u
            username|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] []
usage: sudo -e [-AknS] [-r role] [-t type] [-C fd] [-g groupname|#gid] [-p prompt] [-u
            username|#uid] file ...

The visudo command is a text editor that mimics the vi editor that is used to edit the /etc/sudoers configuration file.

[root@CentOS57 ~]# visudo

or

[root@CentOS57 ~]# vi /etc/sudoers

How to Install man Pages Command on CentOS 5.7

Man pages are a common way to learn the commands that are on your system. The man command will give you all the details of a given command, including switches used, and syntax. man formats and displays the on-line manual pages. This post will show the quick steps to install man command on linux CentOS 5.7 server.

[root@CentOS57 ~]# yum install man -y
[root@CentOS57 ~]# yum install man -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.oscc.org.my
 * extras: mirror.oscc.org.my
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.oscc.org.my
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package man.i386 0:1.6d-2.el5 set to be updated
--> Processing Dependency: groff >= 1.18 for package: man
--> Processing Dependency: bzip2 for package: man
--> Processing Dependency: nroff-i18n for package: man
--> Running transaction check
---> Package bzip2.i386 0:1.0.3-6.el5_5 set to be updated
---> Package groff.i386 0:1.18.1.1-13.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package              Arch                Version                         Repository           Size
====================================================================================================
Installing:
 man                  i386                1.6d-2.el5                      base                262 k
Installing for dependencies:
 bzip2                i386                1.0.3-6.el5_5                   base                 49 k
 groff                i386                1.18.1.1-13.el5                 base                1.9 M

Transaction Summary
====================================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 2.2 M
Downloading Packages:
(1/3): bzip2-1.0.3-6.el5_5.i386.rpm                                          |  49 kB     00:00
(2/3): man-1.6d-2.el5.i386.rpm                                               | 262 kB     00:02
(3/3): groff-1.18.1.1-13.el5.i386.rpm                                        | 1.9 MB     00:17
----------------------------------------------------------------------------------------------------
Total                                                               104 kB/s | 2.2 MB     00:21
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : bzip2                                                                        1/3
  Installing     : groff                                                                        2/3
  Installing     : man                                                                          3/3

Installed:
  man.i386 0:1.6d-2.el5

Dependency Installed:
  bzip2.i386 0:1.0.3-6.el5_5                      groff.i386 0:1.18.1.1-13.el5

Complete!

To man command manual simply run “man man” as below :

[root@CentOS57 ~]# man man
man(1)                                                                  man(1)



NAME
       man - format and display the on-line manual pages

SYNOPSIS
       man  [-acdfFhkKtwW]  [--path]  [-m system] [-p string] [-C config_file]
       [-M pathlist] [-P pager] [-B browser] [-H htmlpager] [-S  section_list]
       [section] name ...


DESCRIPTION
       man formats and displays the on-line manual pages.  If you specify sec-
       tion, man only looks in that section of the manual.  name  is  normally
       the  name of the manual page, which is typically the name of a command,
       function, or file.  However, if name contains  a  slash  (/)  then  man
       interprets  it  as a file specification, so that you can do man ./foo.5
       or even man /cd/foo/bar.1.gz.

       See below for a description of where man  looks  for  the  manual  page
       files.


OPTIONS
       -C  config_file
              Specify   the   configuration   file  to  use;  the  default  is
              /etc/man.config.  (See man.config(5).)

       -M  path
              Specify the list of directories to search for man pages.   Sepa-
              rate  the directories with colons.  An empty list is the same as
              not specifying -M at all.  See SEARCH PATH FOR MANUAL PAGES.

       -P  pager
              Specify which pager to use.  This option overrides the  MANPAGER
              environment  variable,  which  in turn overrides the PAGER vari-
              able.  By default, man uses /usr/bin/less -is.

       -B     Specify which browser to use on HTML files.  This  option  over-
              rides  the  BROWSER  environment  variable. By default, man uses
           /usr/bin/less-is,

       -H     Specify a command that renders HTML files as text.  This  option
              overrides  the  HTMLPAGER  environment variable. By default, man
              uses /bin/cat,

       -S  section_list
              List is a colon separated list of  manual  sections  to  search.
              This option overrides the MANSECT environment variable.

       -a     By default, man will exit after displaying the first manual page
              it finds.  Using this option forces man to display all the  man-
              ual pages that match name, not just the first.

       -c     Reformat  the  source man page, even when an up-to-date cat page
              exists.  This can be meaningful if the cat  page  was  formatted
              for  a screen with a different number of columns, or if the pre-
              formatted page is corrupted.

       -d     Donât actually display the man  pages,  but  do  print  gobs  of
              debugging information.

       -D     Both display and print debugging info.

       -f     Equivalent to whatis.

       -F or --preformat
              Format only - do not display.

       -h     Print a help message and exit.

       -k     Equivalent to apropos.

       -K     Search  for  the  specified  string in *all* man pages. Warning:
              this is probably very slow!  It  helps  to  specify  a  section.
              (Just  to  give  a  rough idea, on my machine this takes about a
              minute per 500 man pages.)

       -m  system
              Specify an alternate set of man pages to  search  based  on  the
              system name given.

       -p  string
              Specify  the  sequence  of  preprocessors to run before nroff or
              troff.  Not all installations will have a full set of preproces-
              sors.   Some of the preprocessors and the letters used to desig-
              nate them are: eqn (e), grap (g), pic (p), tbl (t), vgrind  (v),
              refer  (r).   This  option  overrides the MANROFFSEQ environment
              variable.

       -t     Use /usr/bin/groff -Tps -mandoc to format the manual page, pass-
              ing  the  output  to  stdout.   The  default  output  format  of
              /usr/bin/groff -Tps -mandoc is Postscript, refer to  the  manual
              page  of  /usr/bin/groff -Tps -mandoc for ways to pick an alter-
              nate format.

       Depending on the selected  format  and  the  availability  of  printing
       devices,  the  output  may  need  to  be  passed through some filter or
       another before being printed.

       -w or --path
              Donât actually display the man pages, but  do  print  the  loca-
              tion(s) of the files that would be formatted or displayed. If no
              argument is given: display (on stdout) the list  of  directories
              that  is  searched by man for man pages. If manpath is a link to
              man, then "manpath" is equivalent to "man --path".

       -W     Like -w, but print file names one per line,  without  additional
              information.   This is useful in shell commands like man -aW man
              | xargs ls -l