Monday 21 December 2015

SNMP installation on Ubuntu

Step 1:
sudo apt-get install snmp snmp-mibs-downloader
this will install the SNMP 

Configuring the SNMP Manager

Open the /etc/snmp/snmp.conf file in your text editor with sudo privileges:
In this file, there are a few comments and a single un-commented line. To allow the manager to import the MIB files, we simply need to comment out the mibs : line:
Save and close the file when you are finished.,
We are now finished configuring the manager portion, but we will still need to use this server to help us configure our agent computer.

Sunday 12 July 2015

LAMP Guide -on Linux Operating System

1. Install Apache

To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.
step :
sudo apt-get install apache2

2. Install MySQL

To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.
step :
sudo apt-get install mysql-server

3. Install PHP

To install PHP you must install the Metapackages php5 and libapache2-mod-php5. This can be done by searching for and installing in the Software Centre, or by running the following command.
step :
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install php5-cli
sudo apt-get install php5-mysql


4. Restart Server

Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn't, execute this command.
step:
sudo /etc/init.d/apache2 restart

5. Check Apache

Open a web browser and navigate tohttp://localhost/. You should see a message saying It works!


6. Check PHP

php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'



This will set up the LAMP on Linux base.

Monday 30 March 2015

CentOS / RHEL Disk space re-sizing / Reallocation


Disk space rallocation in Linux-RHEL/CentoOS

Reducing the size of the /home/ from 500GB to 50GB and allocating it /root
 
scenario :
[root@cloud ~]# df -h /home/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_cloud-LogVol00
                             12G  9.2G  1.9G  84% /home

Follow the steps :


Step 1:
unmount the the /home

[root@openstack ~]# umount /home/
Step 2:
check the filesystem for Errors using e2fsck command.
[root@openstack ~]# e2fsck -f /dev/mapper/vg_openstack-lv_home
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_openstack-lv_home: 11/3276800 files (0.0% non-contiguous), 251699/13107200 blocks
[root@openstack ~]#
Note: In the above command e2fsck , we use the option '-f' to forcefully check the filesystem , even if the filesystem is clean.

Step 3:
Shrink the size of /home to desire size.
[root@openstack ~]# resize2fs /dev/mapper/vg_openstack-lv_home 50G resize2fs 1.41.12 (17-May-2010) Resizing the filesystem on /dev/mapper/vg_openstack-lv_home to 13107200 (4k) blocks. The filesystem on /dev/mapper/vg_openstack-lv_home is now 13107200 blocks long.
Step 4:
Now reduce the size using lvreduce command.
[root@openstack ~]# lvreduce -L 50G /dev/mapper/vg_openstack-lv_home
  WARNING: Reducing active logical volume to 50.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Reducing logical volume lv_home to 50.00 GiB
  Logical volume lv_home successfully resized
Step 5:
For the safer side , now check the reduced filesystem for errors
 
[root@openstack ~]# e2fsck -f /dev/mapper/vg_openstack-lv_home e2fsck 1.41.12 (17-May-2010) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mapper/vg_openstack-lv_home: 11/3276800 files (0.0% non-contiguous), 251699/13107200 blocks [root@openstack ~]#


Step 6:  
 Mount the file system and verify the size.



[root@openstack ~]# mount /home/
[root@openstack ~]# df -kh
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg_openstack-lv_root   50G  6.0G   41G  13% /
tmpfs                              16G  228K   16G   1% /dev/shm
/dev/sda1                         485M   40M  420M   9% /boot
/dev/mapper/vg_openstack-lv_home   50G  180M   47G   1% /home


Step 7:

Resize the desired partition with required space

lvextend -L 75G /dev/mapper/vg_openstack-lv_root
resize2fs /dev/mapper/vg_openstack-lv_root

check the sze of the partion changes 
df -kh


and you done resizing the partition.