Prakash Sawarkar: Kernel 3.8 Released, how to Compile in Redhat, CenOS and Fedora..

Kernel 3.8 Released, how to Compile in Redhat, CentOS and Fedora.

Tuesday, 29 June 2010

How to Enable SRIOV of IBM Servers and Blade Servers BIOS

What is SR-IOV? The short answer is that SR-IOV is a specification that allows a PCIe device to appear to be multiple separate physical PCIe devices. The SR-IOV specification was created and is maintained by the PCI SIG, with the idea that a standard specification will help promote interoperability.

Step 1: Power on the system, and press F1 to enter the Setup utility.
Step 2: Select System Settings and then Network.
Step 3: Under the Network Device List, select the device to be configured and press Enter to see all the Network Device options (Figure 1).




















Step 4: Select the device’s description and press Enter to configure the device 
Step 5: From the selection menu, select Advanced Mode and press Enter to change the value.
Step 6: Choose Enable and press Enter.
Step 7: On the same selection menu, select Controller Configuration and press Enter to enter the configuration menu.
Step 8: Select Configure SRIOV and hit Enter.
Step 9: On the Configure SRIOV page, press Enter to toggle the values
Step 10: Select Enable and press Enter
Step 11: Select Save Current Configurations and press Enter.
Step 12: Press Esc to exit the menu. Then, click Save to save the configuration.
Step 13: Reboot the system.

Sunday, 27 June 2010

Setting up an SSL secured Webserver with CentOS

1. Getting the required software
For an SSL encrypted web server you will need a few things. Depending on your install you may or may not have OpenSSL and mod_ssl, Apache's interface to OpenSSL. Use yum to get them if you need them.
# yum install mod_ssl openssl
Yum will either tell you they are installed or will install them for you.
2. Generate a self-signed certificate
Using OpenSSL we will generate a self-signed certificate. If you are using this on a production server you are probably likely to want a key from Trusted Certificate Authority, but if you are just using this on a personal site or for testing purposes a self-signed certificate is fine. To create the key you will need to be root so you can either su to root or use sudo in front of the commands
# Generate private key 
openssl genrsa -out ca.key 1024 
# Generate CSR 
openssl req -new -key ca.key -out ca.csr
# Generate Self Signed Key
openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
# Move the files to the correct locations
# mv ca.crt /etc/pki/tls/certs
# mv ca.key /etc/pki/tls/private/ca.key
# mv ca.csr /etc/pki/tls/private/ca.csr
Then we need to update the Apache SSL configuration file
# vi +/SSLCertificateFile /etc/httpd/conf.d/ssl.conf
Change the paths to match where the Key file is stored. If you've used the method above it will be
SSLCertificateFile /etc/pki/tls/certs/ca.crt
Then set the correct path for the Certificate Key File a few lines below. If you've followed the instructions above it is:
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
Quit and save the file and then restart Apache
# /etc/init.d/httpd restart
All being well you should now be able to connect over https to your server and see a default Centos page. As the certificate is self signed browsers will generally ask you whether you want to accept the certificate. Firefox 3 won't let you connect at all but you can override this.
Restart Apache again using 
# /etc/init.d/httpd restart 

Tuesday, 26 January 2010

Recover deleted files using Foremost

Foremost is a console program to recover files based on their headers, footers, and internal data structures. This process is commonly referred to as data carving. Foremost can work on image files, such as those generated by dd, Safeback, Encase, etc, or directly on a drive. The headers and footers can be specified by a configuration file or you can use command line switches to specify built-in file types. These built-in types look at the data structures of a given file format allowing for a more reliable and faster recovery.
Originally developed by the United States Air Force Office of Special Investigations and The Center for Information Systems Security Studies and Research and now foremost has been opened to the general public.
Files types supported by foremost:
jpg, gif, png, bmp
avi, mpg, wav, wmv, mov
pdf, doc, zip, exe, rff, rar, html, cpp
You can tweak /etc/foremost.conf to add support for more file types.
Please note that there's no guarantee that foremost will succeed in recovering your files, but at least there's a chance.
Foremost Installation:
Open the terminal and type following command to install foremost:
               # yum  install  foremost
Foremost isn’t the greatest solution; it recovers every file it sees and doesn’t support very many file types. It is possible to add types to the /etc/foremost.conf file, but it doesn’t look an easy task. However, if you’ve lost a bunch of photos or documents, Foremost could be just what you need.
Using Foremost:
Suppose you want to recover png file, from command line type following commad:
foremost -t png -i /dev/sda1
After completion, you will find a folder called output in the directory from where you executed the foremost, where within you can see the folder 'png' and inside png you can find your lost png file.
There are many more tools that you can use to recover your files:
Recover deleted files from NTFS filesystem from Centos Linux - Ntfsundelete
Recover your deleted jpeg pictures from filesystem or camera memory card - recoverjpeg
Utility to recover deleted files from an ext3 or  ext4 Linux partition - Extundelete

Friday, 20 November 2009

LVM (Logical Volume Manager) Concept on Linux RHEL / CentOS

 LVM is a method of allocating harddrive space into logical  volumes that can be easily resized instead of partitions.
 With LVM the harddrive (or) set of harddrives are allocated to  one or more physical volumes.
 The physical volumes are combined into volume  groups
 Each volume group is divided into logical volumes which are  assigned mountpoints such as /home and filesystem types such  as   ext3.
To configure LVM

1)Create three LVM partitions
2)Convert them as physical volumes
3)Create volume groups from physical volumes
4)Create logical volumes from volume groups and assign mountpoints

IMPLEMENTATION:
# fdisk /dev/sda
n
+500M
t
<partition number>
8e
w
partprobe
To convert LVM partitions as physical volumes
# pvcreate /dev/sda<partition numbers>
ex: pvcreate /dev/sda{9,10,11}

To view physical volumes
# pvdisplay

To create volume group
# vgcreate <vg name> <partitions>
ex: vgcreate maaza /dev/sda{9,10,11}

To view volume groups
# vgdisplay

To create a logical volume
# lvcreate -L <+size> <vg name> -n <LV name>
ex: lvcreate -L +500M /dev/maaza -n fanta

To view logical volumes
# lvdisplay

To format logical volumes
# mke2fs -j /dev/maaza/fanta

Create a mountpoint and mount logical volume on it
# mkdir /cyber
# mount /dev/maaza/fanta /cyber
# cd /cyber

To extend size of logical volume
# umount <mountpoint>
# lvcreate -L <size> <lv name>
ex:lvcreate -L +500M /dev/maaza/fanta

To make filesystem for extended size
# resize2fs <logical volume>
ex: resize2fs /dev/maaza/fanta
# mount /dev/maaza/fanta /cyber

To resize a logical volume
note:whenever we are reducing an LVM we have to take backup
# mkdir /a
# cp -rf /cyber/* /a

# lvreduce -L <-size> <LVM>
ex: lvreduce -L -100M /dev/maaza/fanta

To format LVM
# mkfs.ext3 <logical volume>
ex:mkfs.ext3 /dev/maaza/fanta

# mount /dev/maaza/fanta /cyber
# cp -rf /a/* /cyber

To remove an LVM
# umount <mountpoint>
# lvremove <logical volume>
ex:lvremove /dev/maaza/fanta

To extend volume group
1)create another LVM partition
2)convert into physical volume

# vgextend <vg name> <partition name>
ex:vgextend /dev/maaza /dev/sda12

To reduce volume group
# vgreduce <vgname> <partition name>
ex:vgreduce /dev/maaza /dev/sda12

To remove volume group
# vgremove <vg name>
ex:vgremove /dev/maaza

To delete physical volumes
# pvremove <partitions>

ex:pvremove /dev/sda{9,10,11,12}

Monday, 28 September 2009

DNS Configuration in CentOS /Redhat

DNS is a service which is used to resolve host to IP address and zone records & configuration files.

MASTER DNS

There are two types of zonerecords
1) Forwad lookup zone
2) Reverse lookup zone

 By defaults, computer connects to another computer with the help of IP address


Forward lookup zone :  It converts names into IP addresses

Reverse lookup zone: It converts IP addresses to names
Steps:
# yum install bind-* caching-nameserver*-y
# service named start
# chkconfig named on
# cd /var/named/chroot/etc
# ls
# cp named-caching-nameserver named.conf
# vi named.conf
  delete ipv6 lines (line nos. 16 &22)

(line no15) Listen on port 53 {127.0.0.1; 192.168.0.254;}
(here 192.168.0.254 is server ip
(line no 21) allow-query  192.168.0.0/24 (clients range)
(line no 30) match-clients {local host; 192.168.0.0/24; } (here 192.168.0.0/24 is clients ip range & subnet mask)
(line no 31) match-destinations    {localhost; 192.168.0.0/24;}
save&quit

#  vi /etc/rfc1912.zones
 copy ten lines from 21 to 31 and paste under 31
 change as follows
 zone "redhat.com" IN { 
  type master;
  file "redhat.for"
   allow-update { none; };
};
zone "0.168.192.IN-addr-arpa IN {
   type master;
   file "redhat.rev"
    allow-update { none; };
};

(here redhat.com is domain name and 0.168.192. is redhat.coms network range redhat.for is forward look up zone & redhat.rev is reverse lookup zone)
save & quit
#  chgrp named named.conf
# chgrp named named.rfc1912.zones
# cd /var/named/chroot/var/named
# cp localhost.zone redhat.for
# cp named.local redhat.rev
#  vi redhat.for

change as follows
$TTL    86400
@               IN SOA  redhat.com.       root.redhat.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           server1.redhat.com.
server1.redhat.com.             IN A            192.168.0.254
www254.redhat.com.           IN CNAME        server1.redhat.com.
station1.redhat.com.           IN A            192.168.0.1
www1.redhat.com.              IN CNAME        station1.redhat.com.
station2.redhat.com.          IN A            192.168.0.2
www2.redhat.com.             IN CNAME        station2.redhat.com.
xxx2.redhat.com.              IN CNAME        station2.redhat.com.
yyy2.redhat.com.              IN CNAME        station2.redhat.com.
station3.redhat.com.        IN A            192.168.0.3
www3.redhat.com.           IN CNAME        station3.redhat.com.
station4.redhat.com.        IN A            192.168.0.4
www4.redhat.com.           IN CNAME        station4.redhat.com.
station5.redhat.com.        IN A            192.168.0.5
www5.redhat.com.           IN CNAME        station5.redhat.com.
station6.redhat.com.            IN A            192.168.0.6
www6.redhat.com.                IN CNAME        station6.redhat.com.



(zone: zone is a storage database which contains all zone records

forward lookup zone: used for resolving hostname to ipaddress & it maintains host to ip mapping information
reverse lookup zone: used for resolving ip address to hostname & it maintains ip to hostname mapping information

Types of records: 
SOA : sort of authority the first record in any zone  it indicates who is authority for this domain
NS :nameserver it identifies the dns server for each zone
A record : resolves hostname to ip address
CNAME record : resolves an alias name to a hostname
PTR record : resolves an ipaddress to a hostname
MX record : resolves mail server ip (used by mail server)
TTL :time to live)

save & quit

# vi redhat.rev
(change as follows)
$TTL    86400
@       IN      SOA redhat.com.    root.redhat.com.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                     86400 )    ; Minimum
            IN        NS      server1.redhat.com.
254      IN       PTR     server1.redhat.com.
1         IN       PTR     station1.redhat.com.
2        IN       PTR      station2.redhat.com.
3         IN      PTR     station3.redhat.com.
4         IN      PTR     station4.redhat.com.
5         IN      PTR     station5.redhat.com.
6         IN      PTR   station6.redhat.com.

save & quit

#  chgrp named redhat.for
#  chgrp named redhat.rev
#  service named restart

 to check:
# dig server1.redhat.com
# dig -x 192.168.0.1
 (if answer is 1 server is ready if answer is 0 server has some error)

to check error in configuration file
# named-checkconf redhat.com /var/named/chroot/etc/named.conf

to check errors in zone record 
# named-checkzone redhat.com /var/named/chroot/var/named/redhat.for
# named-checkzone redhat.com /var/named/chroot/var/named/redhat.rev

 SLAVE DNS

 Master DNS Server
It is the Master Copy of all the Zone Information.
It is Read/Write copy.

Slave DNS Server
It is Slave Backup of Master zone. It is Read Only

        if any error may occur to your dns server at the time the entir network will stop.sometimes it may cause huge damage.for that one we are createing slave dns for faulttolerance and load balancing.

we need another system which contains server o/s

Steps:

# yum install bind-* caching-nameserver -y
# service named start
# chkconfig named on
# cd /var/named/chroot/etc/named-rfc1912.zone

(change as follows)
copy 10 lines from 21 to 31 paste under 31
zone "redhat.com"
  type slave;
  file "redhat.for"
  masters {192.168.0.254:};

zone "0.168.192. IN-ADDR-arpa" IN {
  type slave ;
  file " redhat.rev"
  masters {192.168.0.254;};

save& quit

#service named restart
go to client 
# vi /etc/resolv.conf

nameserver 192.168.0.254
nameserver 192.168.0.1 (slave dns ip)  

FORWARDERS

If you have trusted relationship with another company  those comapny users can enter into our network & our company users can enter into their network by using this forwarders
Steps:
in master dns server 
#  vi /var/named/chroot/etc/named.conf

add aline 
 forwarders {192.168.10.254:};
 forward only ;
};
(here 192.168.10.254 is trusted companies dns)
save & quit

# service named restart