RHEL 6 Linux Bset Gude

RHEL 6 Linux  Bset Gude
Ajay Saxena

Friday 26 September, 2014

Zabbix Installation

Zabbix Installation

3 Installation from packages

From distribution packages

Several popular OS distributions have Zabbix packages provided. You can use these packages to install Zabbix.
OS distributions may lack the latest version of Zabbix in their repositiories.

From Zabbix official repository

Zabbix SIA provides official RPM and DEB packages for Red Hat Enterprise Linux, Debian and Ubuntu LTS.
Package files are available at repo.zabbix.com. yum and apt repositories are also available on the server. A step-by-step tutorial for installing Zabbix from packages is provided here.

Red Hat Enterprise Linux / CentOS

Supported for versions: RHEL 5, RHEL 6, Oracle Linux 5, Oracle Linux 6, CentOS 5, CentOS 6

Installing repository configuration package

Install the repository configuration package. This package contains yum configuration files.
Zabbix 2.2 for RHEL5, Oracle Linux 5, CentOS 5:
# rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/5/x86_64/zabbix-release-2.2-1.el5.noarch.rpm
Zabbix 2.2 for RHEL6, Oracle Linux 6, CentOS 6:
# rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm

Installing Zabbix packages

Install Zabbix packages. Example for Zabbix server and web frontend with mysql database.
Zabbix official repository provides fping, iksemel, libssh2 packages as well. These packages are located in the non-supported directory.
# yum install zabbix-server-mysql zabbix-web-mysql
Example for installing Zabbix agent only.
# yum install zabbix-agent

Creating initial database

Create zabbix database and user on MySQL.
# mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> exit
Import initial schema and data.
# cd /usr/share/doc/zabbix-server-mysql-2.2.0/create
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql

Starting Zabbix server process

Edit database configuration in zabbix_server.conf
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
Start Zabbix server process.
# service zabbix-server start

Editing PHP configuration for Zabbix frontend

Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured.
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# php_value date.timezone Europe/Riga
It's necessary to uncomment the “date.timezone” setting and set the right timezone for you. After changing the configuration file restart the apache web server.
# service httpd restart
Zabbix frontend is available at http://zabbix-frontend-hostname/zabbix in the browser. Default username/password is Admin/zabbix.

Debian / Ubuntu

Supported for version: Debian 6 (Squeeze), Debian 7 (Wheezy), Ubuntu 12.04 LTS (Precise Pangolin), Ubuntu 14.04 LTS (Trusty Tahr)

Installing repository configuration package

Install the repository configuration package. This package contains apt configuration files.
Zabbix 2.2 for Debian 6:
# wget http://repo.zabbix.com/zabbix/2.2/debian/pool/main/z/zabbix-release/zabbix-release_2.2-1+squeeze_all.deb
# dpkg -i zabbix-release_2.2-1+squeeze_all.deb
# apt-get update
Zabbix 2.2 for Debian 7:
# wget http://repo.zabbix.com/zabbix/2.2/debian/pool/main/z/zabbix-release/zabbix-release_2.2-1+wheezy_all.deb
# dpkg -i zabbix-release_2.2-1+wheezy_all.deb
# apt-get update
Zabbix 2.2 for Ubuntu 12.04 LTS:
# wget http://repo.zabbix.com/zabbix/2.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_2.2-1+precise_all.deb
# dpkg -i zabbix-release_2.2-1+precise_all.deb
# apt-get update
Zabbix 2.2 for Ubuntu 14.04 LTS:
# wget http://repo.zabbix.com/zabbix/2.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_2.2-1+trusty_all.deb
# dpkg -i zabbix-release_2.2-1+trusty_all.deb
# apt-get update

Installing Zabbix packages

Install Zabbix packages. dbconfig-common will create the database and populate the initial schema and data automatically. If backend db is located on a different server, please set dbc_remote_questions_default='true' in /etc/dbconfig-common/config.
Example for Zabbix server and web frontend with mysql database.
# apt-get install zabbix-server-mysql zabbix-frontend-php
The zabbix-frontend-php package, during installation, will configure a font, which is used on generated images. If you updated the package from any other repository and text is empty on graphs or maps, please check if a “ttf-dejavu-core” package is installed and try to execute “dpkg-reconfigure zabbix-frontend-php” command.
Example for installing Zabbix agent only.
# apt-get install zabbix-agent

Editing PHP configuration for Zabbix frontend

Apache configuration file for Zabbix frontend is located in /etc/apache2/conf.d/zabbix. Some PHP settings are already configured.
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# php_value date.timezone Europe/Riga
It's necessary to uncomment the “date.timezone” setting and set the correct timezone for you. After changing the configuration file restart the apache web server.
# service apache2 restart
Zabbix frontend is available at http://zabbix-frontend-hostname/zabbix in the browser. Default username/password is Admin/zabbix.

Installation on Browser

1. Welcome_Setup(Zabbix)

2. Check_of_pre-requisites(Zabbix)

3. Configure_DB_connection(Zabbix)

4. Zabbix server details(Zabbix)

5. Pre-Installation summary(Zabbix)

6. Install(Zabbix)

7. Sign-in(Zabbix)

Example Images......





Tuesday 6 May, 2014

Tar’s ten very useful command in linux

The full form of tar is tape archive. Tar is the primary archiving utility in Linux / Unix. Using the tar command we can compress high number of files and folders to form a archive file. Archived tar file is commonly called us tar ball. Tar archived file will ends in three formats filename.tar, filename.tar.bz and filename.tar.bz2. The tar file ends with .bz is said to be gzipped tar archive and the tar file ends with .bz2 is said to be bzipped tar archive. Earlier we have seen data compression using zip command.
Here is top 10 useful Tar command in linux.
1.Command to create tar archive file
tar -cvf  nagios-3.2.0.tar folder_name
-c  option is used to create a tar ball
-v  option is used to verbosely show the .tar file progress.
-f  specifies the filename type
2.Command to extract tar archive file
If you extract a tar ball it will be extracted in the same directory.
tar -xvf nagios-3.2.0.tar
-x  option is used to extract a tar ball.
-v  option is used to verbosely show the .tar file progress.
-f  specifies the filename type.
3.Command to extract tar archive file in different directory.
If you want to extract a tar ball in to different directory use “-C” option.
tar -xvf nagios-3.2.0.tar -C /root/Desktop/
-C Option is used to extract the tar ball in different location.
4.Command to view files inside tar archive with out extracting it.
tar -tvf nagios-3.2.0.tar
-t option is used to view content present inside the archive file.
5.Command to extract only single file from a tar archive.
tar -xvf nagios-3.2.0.tar compile.sh
Another Method
tar –extract –file=nagios-3.2.0.tar compile.sh
6.Command to extract multiple files from a tar archive.
syntax:
tar -xvf archive_filename.tar file1 file2
Example:
tar -xvf nagios-3.2.0.tar compile.sh config.guess
Another Method
tar –extract –file=nagios-3.2.0.tar compile.sh config.guess
Examples of gzipped tar archive
7.Command to create tar.gz archive file
tar -cvzf  tts.tar.gz folder_name
-z  Option is used to create gzip archive file
-c  option is used to create a tar ball
-v  option is used to verbosely show the .tar file progress.
-f  specifies the filename type
8.Command to extract tar.gz archive file
If you extract a tar ball it will be extracted in the same directory.
tar -xvf nagios-3.2.0.tar.gz
-x  option is used to extract a tar ball
-v  option is used to verbosely show the .tar file progress.
-f  specifies the filename type
9.Command to extract tar.gz archive file in different directory
If you want to extract a tar ball in to different directory use “-C” option.
tar -xvf nagios-3.2.0.tar.gz -C /root/Desktop/
-C Option is used to extract the tar ball in different location.
10.Command to view files inside tar.gz archive with out extracting it.
tar -tvf nagios-3.2.0.tar.gz
-t option is used to view content present inside the archive file.
11.Command to extract only single file from a tar.gz archive.
tar -xvf nagios-3.2.0.tar.gz compile.sh
Another Method
tar –extract –file=nagios-3.2.0.tar.gz compile.sh
12.Command to extract multiple files from a tar.gz archive.
syntax:
tar -xvf archive_filename.tar.gz file1 file2
Example:
tar -xvf nagios-3.2.0.tar.gz compile.sh config.guess
Another Method
tar –extract –file=nagios-3.2.0.tar.gz compile.sh config.guess
Examples of bzipped tar archive
13.Command to create tar.bz2 archive file
tar -cvjf  tts.tar.gz folder_name
-j  Option is used to create gzip archive file
-c  option is used to create a tar ball
-v  option is used to verbosely show the .tar file progress.
-f  specifies the filename type
14.Command to extract tar.bz2 archive file
If you extract a tar ball it will be extracted in the same directory.
tar -xvf nagios-3.2.0.tar.bz2
-x  option is used to extract a tar ball
-v  option is used to verbosely show the .tar file progress.
-f  specifies the filename type
15.Command to extract tar.bz2 archive file in different directory
If you want to extract a tar ball in to different directory use “-C” option.
tar -xvf nagios-3.2.0.tar.bz2 -C /root/Desktop/
-C Option is used to extract the tar ball in different location.
16.Command to view files inside tar.bz2 archive with out extracting it.
tar -tvf nagios-3.2.0.tar.bz2
-t option is used to view content present inside the archive file.
17.Command to extract only single file from a tar.bz2 archive.
tar -xvf nagios-3.2.0.tar.bz2 compile.sh
Another Method
tar –extract –file=nagios-3.2.0.tar.bz2 compile.sh
18.Command to extract multiple files from a tar.bz2 archive.
syntax:
tar -xvf archive_filename.tar.bz2 file1 file2
Example:
tar -xvf nagios-3.2.0.tar.bz2 compile.sh config.guess
Another Method
tar –extract –file=nagios-3.2.0.tar.bz2 compile.sh config.guess
19.Command to add files and folders to an existing or already created tar ball
tar -rvf testing.tar test/
-r Option is used to append files and folders to the end of an archive
20.Command to view tar version
tar –version
 ............................................................................

Friday 7 March, 2014

How to configure Apache web server

Hello Friend's, Today i am going to tell you, How to install and configure your web server in Linux with Apache, Apache is a open source web server, To know more about  wikipedia.. 
     Fist we have to install Apache server and then configure the httpd.conf file which is located in /etc/httpd/conf/httpd.conf, This file contend all the information about your web server :) 





Now  create any test page in /var/www/html location which is default location of your web server documents..

undefined

Tuesday 18 February, 2014

Important Port Numbers for Linux Admins

Important Port Numbers for Linux Admins

  • A port number is part of the addressing information used to identify the senders and receivers of messages. Port numbers are most commonly used with TCP/IP connections.
  •   Port numbers range is 0 to 65535, means total port numbers are 65536, The port number field is 16-bit size.So we get only 2^16(2 to the power of 16) ports , its equal to 65536 ports
  •  Default ports are 0 to 1023 (2^10=1024 ports), default ports means particular well known services such as ftp server, web server, mail server, dns server, samba server nfs server etc.., these servers are using default port numbers(dns=53, ftp=21, Apache=80, samba=139)
Note : You can see all Port Numbers in Linux /etc/services file
                # vim /etc/services

Important Port Numbers : 


     
PORT
NAME
COMMENT
1
tcpmux
TCP Port Service multiplexer

7
echo
Echo service
20
FTP Data
File Transfer Protocol - For transferring FTP data
21
FTP Control
For starting FTP connection
22
SSH
Secure Shell
23
Telnet
For insecure remote administration
25
SMTP
Send Mail Transfer Protocol
43
WHOIS service

53
DNS
Domain Name System
67
Bootp
Bootstrap Protocol(DHCP-client to server communication)
68
DHCP
Dynamic Host Configuration Protocol(Server to client communication)
69
TFTP
Trivial file transfer protocol uses udp protocol for connection less transmission of data
80
HTTP/WWW
Hypertext Transfer Protocol/apache
88
Kerberos
Kerberos is a computer network authentication protocol which works on the basis of 'tickets' to allow nodes communicating
110
POP3
Post Office Protocol - Mail delivery Agent
111
Rpcbind
part of the portmap package
123
NTP
Network time protocol used for time syncing uses UDP protocol
137
NetBIOS(nmbd)

139
SMB-Samba(smbd)
SAMBA Server
143
IMAP
Internet Message Access Protocol
161
SNMP
Simple Network Management Protocol - For network monitoring
389
LDAP
Lightweight Directory Access Protocol - For centralized administration
443
HTTPS
HTTP+SSL for secure web access
514
Syslogd

636
ldaps
LDAP over SSL - both tcp and udp
873
Rsync
Remote sync
989
FTPS-data

990
FTPS
Also known as FTP-ES, FTP-SSL and FTP Secure
993
IMAPS
IMAP Secure
995
POP3s
POP over SSL
1194
openVPN
virtual private network
1812
RADIUS
Remote Authentication Dial In User Service
2049
NFS
Network File System
2401
CVS server
Concurrent Versioning System
3128
Squid Proxy

3306
MySql
Mysql Database
3690
SVN
Apache Subversion
8008
http-alt
Hypertext Tranfer Protocol (HTTP) alternate

8080
Webcache
World Wide Web(WWW) caching service
10000
Webmin

6000 -6063
X11
X11 use 6000 to 6063.. ports for connecting X11 from remote server





Friday 24 January, 2014

LNB Magic in RHEL6

LNB Magic in RHEL6
How to rectify LNB ;) in my way firstly tell me exactly did you know what is LNB,  Hope so you don’t know. Don’t worry I’ll tell you, actually it was my Project about how to make Bootable it. That I was trying before some days about LNB (Linux Not for Bootable) I’m just kidding some time but not abut Linux because I love it, Yah! I’m telling you, and the fact is that now I’ve make it easy in my way, because I find everywhere on net about it, and try also lots of suggestion form people but no one give there suggestion in proper way whose help somebody can perform this task easily, So After my hard tuning and give it final touch I’ve saved it. And sharing with you specially………….!!
Regards
Ajay Saxena

Follow these steps given below ------------------>>>>>                                                                                         
                                                                                                            
Follow these steps given below
root@localhost~] # fdisk –cu /dev/sdb
Command (m for help): m
[It’ll show you help]
Command (m for help): n [It’ll ask you about partition] [n for create Partition]
e extended
p primary partition
Type “p” for primary and chose partition no. (1-4) like chose “1”
(1-4): 1
And then press two time Enter for make it full space, if you want to give manually space press one time Enter and give value and then press Enter.

Command (m for help): t  [choose filesystem type in Hex value]
(1-4): 1  [Select Partition]
Hex Code (type L to list code): L [show list code of filesystem] Note: - See “b W95 FAT32”

Hex Code (type L to list code): 0B  [For choose “b W95 FAT32”] “It’s Zero & B” “not O for Operator”

Command (m for help): m  [confirmation for bootable tag code] It’s “a”
Command (m for help): a  [Choose for tag bootable]
 (1-4): 1  [Select Partition]
Command (m for help): w  [For Save & Exit from “fdisk –cu /dev/sdb” Command]
root@localhost~] # init 6   or reboot –f  [Restart for save changes]
root@localhost~] # mkfs.vfat /dev/sdb1 [Format Partition]
root@localhost~] # mkdir –p /mnt/usb  [Make new directory with name “usb” in /mnt folder]
root@localhost~] # mount /dev/sdb1 /mnt/usb [Mount “sdb1” partition in “usb” directory “/mnt/usb”]
root@localhost~] # mkdir Redhat  [Make new Directory in root’s home directory”~”]
Note: - Put Rhel6 ISO in Home Directory [/root]
root@localhost~] # mount –o loop /root/RHEL-6.0_x 86_64-bin-DVD.iso /root/Redhat  [Mount Image in Redhat folder]
Note: -Now Copy data in USB media
root@localhost~] # cp /root/Redhat/isolinux/* /mnt/usb [Copy “isolinux” folder into Redhat folder to USB media]
root@localhost~] # cp –a /root/Redhat/images/ /mnt/usb [Copy “images” folder into Redhat folder to USB media]
Error: cp failed to preserve ownership for ‘/mnt/usb/images/pxeboot/vmlinuz’: operation not permitted.
root@localhost~] # cd /mnt/usb  [Open media mount point “/mnt/usb”]
You have new mail in /var/spool/mail/root [If you wish you can check there otherwise directly to follow these steps given below.]
root@localhost usb] # ls  [Show list]
root@localhost usb] # mv isolinux.cfg syslinux.cfg  [Rename “isolinux.cfg” file]
root@localhost usb] # cd /  [Just go back]
root@localhost /] # umount /dev/sdb1  [Unmount media partition]
root@localhost /] # syslinux /dev/sdb1  [Run “syslinux” in Partition]
root@localhost /] # grub-install --root-directory=/mnt/usb /dev/sdb  [Install Grub in USB media]
Massage see here Probing devices to guess BIOS drives. This may take a long time. /dev/mapper/.. /dm-0 does not have any corresponding BIOS drive.
root@localhost /] # mount /dev/sdb1 /mnt/usb  [Mount media partition]
root@localhost /] # grub-install --root-directory=/mnt/usb /dev/sdb  [Install Grub in USB media]
Massage see here Probing devices to guess BIOS drives. This may take a long time.
Installation Finished No errors reported………….
This is the contents of the device map /mnt/usb/boot/grub/device.map
Check if this is correct or not, if there any of these lines incorrect, fix it and Re-run that “grub-install” Script again.
 (fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
root@localhost /] # vim /mnt/usb/boot/grub/grub.conf  [Open media Grub.conf file ] Press “i” for insert text.
File text start from here.
~default=0
~timeout=5
~splashimage=(hd0,0)/grub/splash.xpm.gz
~title USB (hd0,0)
~[tab] root (hd0,0)
~[tab] kernel /vmlinuz
~[tab] initrd /initrd.img
~title USB (hd1,0)
~[tab] root (hd1,0)
~[tab] kernel /vmlinuz
~[tab] initrd /initrd.img
File text “End” here, and now press “Esc” and write :wq (For Save & Exit file)
After that Put your RHEL-6 ISO in your Media
Now Enjoy Bootable USB with RHEL6……!! Thanks