Jun 18, 2012

Install SUN QFS in Solaris 10


Install SUN QFS in Solaris and Create new Filesystem


Release:
Oracle Solaris 10_X86
SUN QFS 5.2

Solution:

1)      Copy the SUN QFS iso image file from cd to /opt filesystem

2)      Mount the iso image using the below command

# lofiadm -a /opt/SUN_QFS_5.2.iso
/dev/lofi/1

# mount –F hsfs /dev/lofi/1 /mnt/

3)      Install the QFS package using the pkgadd command’

# cd /mnt/x64/2.10/
# pkgadd -d . SUNWqfsr SUNWqfsu

Note: The above command asks some confirmation like license agreement, give yes to all. Finally we got output like “Installation of was successful

4)      By default the QFS package installed in /opt filesystem. So we need to manually add this to the PATH variable to use QFS command.

# vi /.profile

PATH=$PATH:/opt/SUNWsamfs/bin:/opt/SUNWsamfs/sbin
export PATH

5)      Copy the default mcf file to the /etc/opt/SUNWsamfs directory

# cd /etc/opt/SUNWsamfs
# cp /opt/SUNWsamfs/examples/mcf .

6)      Create the Slices in second disk to create QFS filesystem.

# format –e

Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0t0d0
            /pci@0,0/pci8086,3408@1/pci103c,3245@0/sd@0,0
       1. c2t0d0
          /pci@0,0/pci8086,340c@5/pci103c,3243@0/sd@0,0

Specify disk (enter its number): 1

selecting c2t0d0
[disk formatted]

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        inquiry    - show vendor, product and revision
        scsi       - independent SCSI mode selects
        cache      - enable, disable or query SCSI disk cache
        volname    - set 8-character volume name
        !     - execute , then return
        Quit

format> p

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        8      - change '8' partition
        9      - change `9' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        ! - execute , then return
        Quit

partition> 0
Enter partition id tag[usr]:
Enter partition permission flags[wm]:
Enter new starting Sector[34]:
Enter partition size[20971520b, 20971553e, 10240mb, 10gb, 0tb]: 10gb

Note: Create the next slice from the last sector of the first slice. We can get that value by listing all the partitions using “p” option.

partition> 4
Enter partition id tag[usr]:
Enter partition permission flags[wm]:
Enter new starting Sector[20971554]: 20971554
Enter partition size[629145600b, 650117153e, 307200mb, 300gb, 0tb]: 300gb

partition> 5
Enter partition id tag[usr]:
Enter partition permission flags[wm]:
Enter new starting Sector[650117154]: 650117154
Enter partition size[629145600b, 1279262753e, 307200mb, 300gb, 0tb]: 300gb

partition> l
[0] SMI Label
[1] EFI Label
Specify Label type[1]:
Ready to label disk, continue? y

partition> q
format> q

7)      Edit the mcf file

# vi /etc/opt/SUNWsamfs/mcf

qfs1000              10    ma   qfs1000       on
/dev/dsk/c0t0d0s7    11    mm   qfs1000       on
/dev/dsk/c2t0d0s5    12    mr   qfs1000       on
/dev/dsk/c2t0d0s6    13    mr   qfs1000       on

Note: Here Select equipment type according to your environment. Otherwise you got an error message. In my configuration file the metadata information are stored in the first disk and the filesystem created in the second disk.

ms          Defines a file system that stores both data and metadata on the same device (an md device).
ma          Defines a file system that stores metadata on a separate device (an mm device). The data in an ma file system can be stored on md, or mr devices.
md          Defines a striped or round-robin device that uses dual allocation for storing file data. See also Dual and Single Allocation Schemes.
mm         Defines a metadata device for storing inode and other metadata information. You can specify multiple metadata devices. Metadata (including inodes, directories, allocation maps, and so on) on ma file systems is located on metadata devices, separated from the file data devices. By default, metadata is allocated using round-robin allocation if you have multiple metadata devices.
mr           Defines a round-robin or striped data device that uses single allocation for storing file data. See also Dual and Single Allocation Schemes.

8)      Issue “samd config” command to update the configuration changes to the sam-fsd daemon.

# samd config

9)      Now create the QFS filesystem

# sammkfs qfs1000

10)   Mount the QFS filesystem using the below command

# mkdir /qfs1000
# mount –F samfs qfs1000 /qfs1000

11)   For the permanent mount add the below entry in the vfstab file

# vi /etc/vfstab

qfs1000 -       /qfs1000        samfs   -   yes     -

12)   Once restart the server and confirm, whether QFS filesystem auto mounted or not

# reboot




Feb 28, 2012

Mount Windows Share in Linux


Mount Windows Share in Linux

Release:
RedHat Enterprise Linux
SUSE Linux
AIX 5.3
Windows Server 2003

Problem:
Need to mount the windows share in the Linux Server using the CIFS.

Solution:

In RHEL:

            Mount Windows partition in RHEL using the below command

                        # mount -t cifs -o username=administrator,password='XXXXXX' //172.16.1.50/files /mnt

            By default windows share mounted with the full permission (777) in Linux. If u want to change the default permission use the “dir_mode” and “file_mode” options to set directory and file permission.

                        # mount -t cifs -o username=administrator,password='XXXXXX',dir_mode=0755,file_mode=0755 //172.16.1.50/files /mnt

Where,
/mnt – mount point name
//172.16.1.50/files – share folder name with server IP address


In SUSE Linux:

            Mount windows partition in SUSE Linux using the below command

                        # mount -t smbfs -o username=administrator,password='XXXXXX' //172.16.1.50/files /mnt


In AIX:

            Mount the windows partition in AIX using the below command

                        # mount -v cifs -n serverip/username/password -o wrkgrp=domain,fmode=755 /sharename /localmountpoint

Example:

                        # mount -v cifs -n 172.16.1.50/administrator/XXXXXX -o wrkgrp=domainname,fmode=755 /files /mnt



Jan 17, 2012

Reverse Proxy in apache

Reverse Proxy Configuration in apache

Introduction:

            A reverse proxy is a gateway for servers, it can be used whenever multiple web servers must be accessible via a single public IP address. The web servers listen on different ports in the same machine, with the same local IP address or, possibly, on different machines and different local IP addresses altogether. The reverse proxy analyses each incoming call and delivers it to the right server within the local area network.

Release:
RedHat Enterprise Linux
Apache 2.x

Problem:
Configure Apache webserver as a reverse proxy server

Solution:

1)       Install the required rpm

            # yum install httpd

2)       Enable the proxy related modules in the httpd,conf file

            # vi /etc/httpd/conf/httpd.conf

LoadModule  proxy_module      modules/mod_proxy.so
LoadModule  proxy_http_module modules/mod_proxy_http.so


3)       Add the below entries to the http configuration file.

                        # vi /etc/httpd/conf/httpd.conf

            <IfModule mod_proxy.c>

            ProxyRequests Off
            <Proxy *>
            Order deny,allow
            Allow from all
            </Proxy>

            ProxyPreserveHost On
            ProxyVia On
            SSLProxyEngine on

            ProxyPass /webdav http://ServerIP:8080/webdav 
            ProxyPassReverse /webdav http://ServerIP:8080/webdav
 
            </IfModule>

Note: In the above sample all the request comes to /webdav URL redirect to the another tomcat server. For example Apache server IP is 10.0.0.1 and the tomcat server IP is 10.0.0.2, then the request like http://10.0.0.2/webdav will be redirect to http://10.0.0.2:8080/webdav

4)       To enable logging for the reverse proxy, add the below lines in the configuration file

            # vi /etc/httpd/conf/httpd.conf

            <IfModule mod_proxy.c>

            CustomLog logs/access_proxy.log combined
            ErrorLog logs/error_proxy.log

            </IfModule>

5)       Restart the httpd service

                        # /etc/init.d/httpd restart

                       



Jan 5, 2012

webdav configuration in apache


Sample Webdav Configuration in Apache

Introduction:
            WebDAV stands for "Web-based Distributed Authoring and Versioning". It is a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers.

Release:
RedHat Enterprise Linux 5.x
Apache 2.x

Problem:
Need to enable the webdav (Web-based Distributed Authoring and Versioning) in apache web server.

Solution:

1)      Install the required rpms

                        # yum install httpd

2)      Enable the webdav related modules in the httpd,conf file

            # vi /etc/httpd/conf/httpd.conf

            LoadModule dav_module modules/mod_dav.so
            LoadModule dav_fs_module modules/mod_dav_fs.so

3)      Create a directory to publish over web server

                  # mkdir /var/www/webdav

4)      Create one new configuration file for the webdav

            # vi /etc/httpd/conf.d/webdav.conf

            <IfModule mod_dav.c>
            LimitXMLRequestBody 131072

            Alias /webdav "/var/www/webdav"
            <Directory /var/www/webdav>
            Dav On
            Options +Indexes
            IndexOptions FancyIndexing
            AddDefaultCharset UTF-8
            Order allow,deny
            Allow from all
            </Directory>
            </IfModule>

5)      If want to enable authentication for the webdav means, add the below lines in the webdav.conf file and also create the user database
           
            # vi /etc/httpd/conf.d/webdav.conf

            AuthType Basic
            AuthName "WebDAV Server"
            AuthUserFile /etc/httpd/webdav.users.db
            Require valid-user
           
6)      Create the user database using the below command

            # htpasswd -c /etc/httpd/webdav.users.db testuser

7)      Restart the httpd service

            # service httpd restart

8)      Access the webdav from the client using the below URL

            http://ServerIPAddress/webdav