Monday, February 15, 2010

LVM and RAID

#############Logical Volume Manager and Raid##################
Keywords:
Physical Volume (PV) Volume Group (VG) Physical Extended (PE)
Logical Volume Manager (LVM)
Commands:
pvcreate, pvdisplay, vgcreate, vgdisplay, lvcreate, lvdisplay, vgextend. Vgreduce, lvextend, lvreduce, pvremove,vgremove, lvremove
Partitions:
Create a New FileSystem
fdisk /dev/hda
Partition type: t,8e
partprobe /dev/hda, mkfs –j /dev/hda
pvcreate /dev/hda*, pvdisplay /dev/hda*
Volume Group:
Vgcreate /dev/vg0 /dev/hda6 /dev/hda7 /dev/hda8
Vgdisplay /dev/vg0
Logical Volume Manager:
lvcreate –l 700 /dev/vg0 –n lvm0
lvcreate -L 10G  -n asm_d001p1 volgrp01
(/dev/volgrp01/asm_d001p1)
lvdisplay /dev/vg0/lvm0
Format the LVM Group:
mkfs –j /dev/vg0/lvm0
Mount:
Mount /info
Mount /dev/vg0/lvm0 /info
Infuture you want to Increase Size
pvcreate /dev/had
vgextend /dev/vg0 /dev/had*
lvextend –L +1800M /dev/vg0/lvm0
Online we can resize
Resize2fs /dev/vg0/lvm0
If you want to detach Physical voume
lvreduce –L -100M /dev/vol0/lvm0
vgreduce /dev/vg0 /dev/hda1
pvremove /dev/hda*
########## SOFTWARE RAID #################################
#mdadm –create –verbose /dev/md0 –level=5 –raid-devices=3 /dev/hda6 /dev/hda7 /dev/hda8
#cat /proc/mdstat
#mkfs –j /dev/md0
#mount /dev/md0 /share
#mdadm –manage /dev/md0 –fail /dev/hda7
#mdadm –manage /dev/md0 –remove /dev/hda7
#mdadm –manage /dev/md0 –add /dev/hda7
#vim /var/log/messages

Friday, February 12, 2010

Zimbra Mail Server Configuration

Zimbra E-mail server on ubuntu 8.04 Server/Desktop

In this guide we will look into how to configure Zimbra email server on Ubuntu Server/Desktop 8.04 or redhat 5

The Prime importance of DNS comes into picture when you want to configure E-mail server in linux. The first and foremost thing we need to do is configure the DNS and cross-check with host and dig utility.

The following are the brief steps to configure DNS in ubuntu/Debian Boxes.

sudo apt-get install bind9

sudo vi /etc/bind/named.conf.local

# This is the zone definition. replace example.com with your domain name
zone "example.com" {
type master;
file "/etc/bind/zones/example.com.db";
};

# This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse notation - e.g my network address is 192.168.0
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
};

sudo vi /etc/bind/named.conf.options
forwarders {
# Replace the address below with the address of your provider's DNS server
123.123.123.123;
};
sudo mkdir /etc/bind/zones
sudo vi /etc/bind/zones/example.com.db
// replace example.com with your domain name. do not forget the . after the domain name!
// Also, replace ns1 with the name of your DNS server
example.com. IN SOA ns1.example.com. admin.example.com. (
// Do not modify the following lines!
2006081401
28800
3600
604800
38400
)

// Replace the following line as necessary:
// ns1 = DNS Server name
// mta = mail server name
// example.com = domain name
example.com. IN NS ns1.example.com.
example.com. IN MX 10 mta.example.com.

// Replace the IP address with the right IP addresses.
www IN A 192.168.0.2
mta IN A 192.168.0.3
ns1 IN A 192.168.0.1

sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa

//replace example.com with yoour domain name, ns1 with your DNS server name.
// The number before IN PTR example.com is the machine address of the DNS server. in my case, it's 1, as my IP address is 192.168.0.1.
@ IN SOA ns1.example.com. admin.example.com. (
2006081401;
28800;
604800;
604800;
86400
)

IN NS ns1.example.com.
1 IN PTR example.com

sudo /etc/init.d/bind9 restart
sudo vi /etc/resolv.conf

// replace example.com with your domain name, and 192.168.0.1 with the address of your new DNS server.
search example.com
nameserver 192.168.0.1

dig example.com
host example.com

Note:- Once you make sure that DNS is working start installing Zimbra and follow the steps.

Zimbra Installation Procedure

tar -xzf zc*
cd /temp/zcs
./install.sh

It's not going to work the first time, but it'll give you a list of missing dependencies. Write down all the package names it says are missing. Your list may be slightly different than mine, but whatever it is, load them. Just separate each package name with a space like this:

apt-get install libpcre3 libgmp3c2 libstdc++5

Now re-run your Zimbra install

The installer will ask you a few questions. Answer them like this:

Install zimbra-ldap [Y] Y

Install zimbra-logger [Y] Y

Install zimbra-mta [Y] Y

Install zimbra-snmp [Y] Y

Install zimbra-store [Y] Y

Install zimbra-spell [Y] Y

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

After the installation process, you will be presented with the Main menu. By default, most of the options have a value that works on most systems, except for the Admin password. To set a password for the admin user, answer like this to the questions:

Address unconfigured (**) items (? - help) 6
Select, or 'r' for previous menu 4
Password for admin@mail.linux.lan (min 6 characters): enter a passwd
Select, or 'r' for previous menu press Enter

*** CONFIGURATION COMPLETE - press 'a' to apply
Select from menu, or press 'a' to apply config a
Save configuration data to a file? press Enter
The system will be modified - continue? Y press Enter

Notify Zimbra of your installation? your choice, enter Y or N
Configuration complete - press return to exit press Enter

When it asks you for your domain, it's going to have your fully-qualified domain name (hostname.mydomain.com) rather than just the domain, and probably complain about not having an MX record. Change the hostname to just mydomain.com and it'll find the names through nslookup, and it'll be happy. The rest of the install should proceed without errors, except that toward the end it's going to ask you to "Adress unconfigured items" but, if you're doing this from the console and not from an SSH connection with a buffer, the actual item that's unconfigured is off the screen and invisible. It's the admin password, which is in menu item 3.

Finally, when the install is done and it has given you the last "press Enter to finish" you are almost done.


TESTING Zimbra

# su - zimbra
$ zmcontrol status
$ exit

You should see all services running, otherwise type this command while still being logged in as user zimbra:

$ zmcontrol start
$ exit


I recommend at this point that you convert your webmail to use https rather than http. This is a security question, but it is also discretionary. If you choose to do this, then at the command prompt, type:

su - zimbra
zmtlsctl https

Now reboot the system, and when it comes back up,give it a couple minutes to start the rest of the Zimbra processes. If your installation is successful, you can go to https://xxx.xxx.xxx.xxx:7071 (your internal ip address again) to get the administrative console, or
Zimbra Web Interface
Admin Interface




*The above document has been prepared by Gyani.P(Jr System Administrator) on 25-10-09

Oracle 11G R2 Installation on the Redhat Enterprise Linux 32 & 64 Bit

Part I: Installing Enterprise Linux 5

This section describes how to install Oracle Enterprise Linux 5 (OEL5) on your hardware (but the same steps will apply for RHEL5). Please take a moment to make sure that your hardware meets or exceeds the minimum hardware requirements for Oracle Database 11g Release 1.

Minimum hardware requirements:

32-bit (x86)

  • x86 compatible CPU
  • 1 GB RAM
  • 10 GB available disk space (3.5 GB for the Oracle software + 1.5 GB for the database + 3 GB for OEL5 + 2 GB swap)

64-bit (x86_64)

  • x86_64 compatible CPU
  • 1 GB RAM
  • 10.5 GB available disk space (4 GB for the Oracle software + 1.5 GB for the database + 3 GB for OEL5 + 2 GB swap)

Note: Both Linux and Oracle must be installed for the same architecture. 32-bit Oracle will only run on 32-bit Linux and 64-bit Oracle will only run on 64-bit Linux.

Now, let's walk through the process of installing the Linux operating system on a server. The instructions assume a fresh install of Linux (as opposed to an upgrade), that the server will be dedicated to Oracle, and that no other operating systems or data are on the server.

Oracle Database 11g Release 1 is certified to run the base release of OEL5 without updates. Free copies of OEL5 are available for download.

  1. Boot the server using the first CD or DVD
    • You may need to change your BIOS settings to allow booting from the CD/DVD.
  2. The boot screen appears with the boot: prompt at the bottom of the screen.
    • Select Enter to continue with a graphical install on the console.
    • The installer scans your hardware
  3. Oracle Enterprise Linux splash screen
    • Click on Next
  4. Language Selection
    • Accept the default.
  5. Keyboard Configuration
    • Accept the default.
  6. Install or Upgrade
    • Select Install and click on Next
  7. Disk Partitioning Setup
    • A thorough treatment of disk partitioning is beyond the scope of this guide, which assumes that you are familiar with disk partitioning methods.
      WARNING: Improperly partitioning a disk is one of the surest and fastest ways to wipe out everything on your hard disk. If you are unsure how to proceed, stop and get help, or you will risk losing data!)
    • Accept the default partition layout. Note that the default layout is sufficient for an evaluation, but would not be appropriate for other purposes. The default layout may create a swap partition that is smaller than the Oracle guidelines recommend. This is also sufficient for an evaluation.
  8. Network Configuration
    • It is usually best to configure database servers with a static IP address. To do so, click on Edit .
    • A pop-up window appears. Uncheck the Configure using DHCP box, and enter the IP Address and Netmask for the server. Be sure that Activate on boot is checked, and click on OK .
    • In the Hostname box, select manually and enter the hostname.
    • In the Miscellaneous Settings box, enter the remaining network settings.
  9. Time Zone Selection
    • Choose the time settings that are appropriate for your area. Setting the system clock to UTC is usually a good practice for servers. To do so, select on System clock uses UTC.
  10. Set Root Password
    • Enter a password for root, and enter it again to confirm.
  11. Package Installation
    • This guide will follow the Oracle recommended practice of using a "default RPMs" installation. Accept the default software selection and click on Next.
    • Additional RPMs are required to run Oracle Database 11g Release 1. These will be installed later.
  12. Installing Packages
    • Software will be copied to the hard disk and installed. Change disks as prompted.
  13. After software installation is complete
    • Remove any boot CD/DVD media.
    • Click on Next.
  14. Welcome
    • Click on Forward
  15. License Agreement
    • Read the license agreement. If you agree to the terms, select Yes, I agree to the License Agreement and click on Forward.
  16. Firewall Configuration
    • For the purposes of this walk-through, no firewall is configured. Select Disabled and click on Forward.
    • Click on Yes when the "Warning - No Firewall" window appears.
  17. SELinux
    • Select Disabled from the drop down bar and click on Forward.
  18. Kdump
    • Do not enable Kdump. Accept the default and click on Forward.
  19. Date and Time
    • Set the Date and Time.
    • If you want to use an NTP server (recommended), select Enable Network Time Protocol and enter the name of the NTP server.
  20. System User
    • Create an account for yourself.
    • Do not create an account for oracle at this time. Creating the oracle account is covered later in this section.
  21. Sound Card
    • Configure the sound card, if any, and click on Forward.
  22. Additional CDs
    • Click on Finish.
  23. The system will reboot
  24. A graphical login screen appears.
  25. Congratulations! Your OEL5 software is now installed.

Installing Required Packages

Additional Linux software packages must be installed before installing the Oracle software. The package requirements differ for 32-bit and 64-bit architectures, so this section contains separate instructions for each architecture.

32-bit (x86) Installations

Required kernel version: 2.6.18 This kernel, or any of the kernels supplied in updates, works with Oracle Database 11g Release 1 .

Check your kernel version by running the following command:

uname -r


Ex:
# uname -r
2.6.18-8.el5

Required package versions (or later):

  • compat-libstdc++-33-3.2.3-61
  • elfutils-libelf-0.125-3.el5
  • elfutils-libelf-devel-0.125-3.el5
  • glibc-2.5-12
  • glibc-devel-2.5-12
  • glibc-common-2.5-12
  • gcc-4.1.1-52.el5
  • gcc-c++-4.1.1-52.el5
  • kernel-headers
  • libgcc-4.1.1-52.el5
  • libaio-0.3.106-3.2
  • libaio-devel-0.3.106-3.2
  • libstdc++-4.1.1-52.el5
  • libstdc++-devel-4.1.1-52.el5
  • unixODBC-2.2.11-7.1
  • unixODBC-devel-2.2.11-7.1
  • sysstat-7.0.0-3.el5
  • binutils-2.17.50.0.6-2.el5
  • make-3.81-1.1

If you've performed a "default RPMs" install as suggested by Oracle, there are still some required packages that must be installed:

  • compat-libstdc++-33
  • elfutils-libelf-devel
  • glibc-devel-2.5
  • gcc
  • gcc-c++
  • libaio-devel
  • libstdc++-devel
  • unixODBC
  • unixODBC-devel
  • sysstat

Part II: Configuring Linux for Oracle

Now that the Linux software is installed, you need to configure it for Oracle. This section walks through the steps required to configure Linux for Oracle Database 11g Release 1.

Create the Oracle Groups and User Account

Next, create the Linux groups and user account that will be used to install and maintain the Oracle Database 11g Release 1 software. The user account will be called oracle, and the groups will be oinstall and dba. Execute the following commands as root:

/usr/sbin/groupadd oinstall

/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
id oracle

Ex:
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
# /usr/sbin/useradd -m -g oinstall -G dba oracle
# id oracle
uid=501(oracle) gid=502(oinstall) groups=502(oinstall),503(dba)

Set the password on the oracle account:

passwd oracle


Ex:
# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Create Directories

Now create directories to store the Oracle Database 11g Release 1 software and the database files. This guide adheres to the Optimal Flexible Architecture (OFA) for the naming conventions used in creating the directory structure. For more information on OFA standards, see Appendix D of the Oracle Database Installation Guide 11g Release 1 (11.1) for Linux.

The following assumes that the directories are being created in the root filesystem. This is done for the sake of simplicity and is not recommended as a general practice. These directories would normally be created as separate filesystems.

Issue the following commands as root:

mkdir -p /u01/app/oracle

chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app

Configuring the Linux Kernel Parameters

Oracle Database 11g Release 1 requires the kernel parameter settings shown below. The values given are minimums, so if your system uses a larger value, don't change it. Linux allows modification of most kernel parameters while the system is up and running, so there's no need to reboot the system after making kernel parameter changes.

kernel.shmall = 2097152

kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=4194304
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=262144

Note that OEL 5 already has values defined for kernel.shmall and kernel.shmmax. Use the default values if they are the same or larger than the required values.

If you're following along and have just installed Linux, the kernel parameters will all be at their default values and you can just cut and paste the following commands while logged in as root.

cat >> /etc/sysctl.conf <kernel.shmmni = 4096

kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=4194304
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=262144
EOF
/sbin/sysctl -p

Ex:
# cat >> /etc/sysctl.conf <net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
> kernel.shmmni = 4096
> kernel.sem = 250 32000 100 128
> fs.file-max = 65536
> net.ipv4.ip_local_port_range = 1024 65000
> net.core.rmem_default=4194304
> net.core.wmem_default=262144
> net.core.rmem_max=4194304
> net.core.wmem_max=262144
> EOF
# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 262144

Run the following commands as root to verify your settings:

/sbin/sysctl -a | grep shm

/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range
/sbin/sysctl -a | grep rmem_default
/sbin/sysctl -a | grep rmem_max
/sbin/sysctl -a | grep wmem_default
/sbin/sysctl -a | grep wmem_max

Ex:
# /sbin/sysctl -a | grep shm
kernel.shmmni = 4096
kernel.shmall = 268435456
kernel.shmmax = 4294967295
kernel.shm-use-bigpages = 0
# /sbin/sysctl -a | grep sem
kernel.sem = 250 32000 100 128
# /sbin/sysctl -a | grep file-max
fs.file-max = 65536
# /sbin/sysctl -a | grep ip_local_port_range
net.ipv4.ip_local_port_range = 1024 65000
# /sbin/sysctl -a | grep rmem_default
net.core.rmem_default = 4194304
# /sbin/sysctl -a | grep rmem_max
net.core.rmem_max = 4194304
# /sbin/sysctl -a | grep wmem_default
net.core.wmem_default = 262144
# /sbin/sysctl -a | grep wmem_max
net.core.wmem_max = 262144

Setting shell limits for the oracle user

Oracle recommends setting limits on the number of processes and open files each Linux account may use. To make these changes, cut and paste the following commands as root:

cat >> /etc/security/limits.conf <oracle soft nproc 2047

oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF

cat >> /etc/pam.d/login <session required pam_limits.so
EOF

Change the default profile for bash and ksh as well as the default login script for cshell.

cat >> /etc/profile <if [ \$USER = "oracle" ]; then

if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF

cat >> /etc/csh.login <if ( \$USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
EOF

Part III: Installing Oracle Oracle Database 11g Release 1 can be downloaded from OTN. Oracle offers a development and testing license free of charge. However, no support is provided and the license does not permit production use. A full description of the license agreement is available on OTN.

The easiest way to make the Oracle Database 11g Release 1 distribution media available on your server is to download them directly to the server.

Use the graphical login to log in as oracle.

Create a directory to contain the Oracle Database 11g Release 1 distribution:

mkdir 11gR1_db

To download Oracle Database 11g Release 1 from OTN, point your browser to the Oracle Database Download Page. Read the OTN License agreement. If you agree with the restrictions and the license agreement, click on Accept License Agreement.

Click on the Linux x86 link (32-bit) or Linux x86-64 link (64-bit) and save the file in the directory you created for this purpose (11gR1_db)—if you have not already logged in to OTN, you may be prompted to do so at this point.

Unzip and extract the file.

cd 11gR1_db
For 32-bit

unzip linux_11gR1_database.zip
For 64-bit

unzip linux.x64_11gR1_database.zip

Install the Software and Create a Database

Log in using the oracle account.

Change directory to the directory containing the Oracle Database 11g Release 1 software.

Ex:

$ cd $HOME/11gR1_db/database

Start the Oracle Universal Installer.

$ ./runInstaller

  1. Select Installation Method
    • Select Basic Installation
    • Oracle Base Location: /u01/app/oracle
    • Oracle Home Location: /u01/app/oracle/product/11.1.0/db_1
    • Installation Type: Enterprise Edition (3.3GB)
    • UNIX DBA Group: dba
    • Make sure Create Starter Database is checked
    • Global Database Name: demo1
    • Enter the Database Password and Confirm Password
    • Click on Next
  2. Specify Inventory Directory and Credentials
    • Inventory Directory: /u01/app/oraInventory
    • Operating System group name: oinstall
    • Click on Next
  3. Product-specific Prerequisite Checks
    • If you've been following the steps in this guide, all the checks should pass without difficulty. You may receive a warning related to swap file size if the default partition layout was used during OEL5 installation. This may be safely ignored . If one or more checks fail, correct the problem before proceeding.
    • Click on Next
  4. Oracle Configuration Manager Registration
    • Leave this disabled for the demo and click on Next
  5. Summary
    • A summary of the products being installed is presented.
    • Click on Install.
  6. Install
    • Installation progress is displayed
  7. Configuration Assistants
    • The Oracle Net, Oracle Database, and iSQL*Plus configuration assistants will run automatically
    • Take note of the information presented in the Database Configuration Assistant pop-up window and click on OK.
  8. Execute Configuration Scripts
    • At the end of the installation, a pop up window will appear indicating scripts that need to be run as root. Login as root and run the indicated scripts.
    • Click on OK when finished.
  9. End of Installation
    • Make note of the URLs presented in the summary, and click on Exit when ready.
  10. Congratulations! Your new Oracle Database 11g Release 1 database is up and ready for use.