My blog has moved! Redirecting...

You should be automatically redirected. If not, visit http://techienote.com and update your bookmarks.

Tech Resources

Tuesday, June 22, 2010

PXE Boot server on CentOS

This post will be helpful for linux admins who frequently installs diff linux os. PXE boot is one of the best option to start linux installation & for rescue of the other failed systems. we are using CentOS as pxe boot server.

Install tftp-server
#yum install tftp-server -y

Enable tftp server
#vi /etc/xinetd.d/tftp

service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s -vv /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
Start tftp server and mark it for system startup
#service xinetd restart
#chkconfig --level 35 xinetd on

We have to download the latest version of syslinux and build the rpm cause there are some bugs in the existing version that ships with centos.
#cd /root
#wget http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.86.tar.gz
#tar -zxvf syslinux-3.86.tar.gz
#cp syslinux-3.86/syslinux.spec /usr/src/redhat/SPECS/
#cd ..
#cp syslinux-3.86.tar.gz /usr/src/redhat/SOURCES

Now building the rpm
#cd /usr/src/redhat/SPECS
#rpmbuild -ba syslinux.spec

Installing rpm
#cd /usr/src/redhat/RPMS/i386
#rpm -ivh syslinux-3.86-1.i386.rpm

Copy needed files from syslinux to the tftpboot directory
#cp /usr/share/syslinux/pxelinux.0 /tftpboot
#cp /usr/share/syslinux/menu.c32 /tftpboot
#cp /usr/share/syslinux/memdisk /tftpboot
#cp /usr/share/syslinux/mboot.c32 /tftpboot
#cp /usr/share/syslinux/chain.c32 /tftpboot

Create a base directory for images. Create directories for each CentOS release you are supporting.
#mkdir -p /tftpboot/images/centos/i386/5.4
#cp /tmp/dvd-centos-54/images/pxeboot/vmlinuz /tftpboot/images/centos/i386/5.4/
#cp /tmp/dvd-centos-54/images/pxeboot/initrd.img /tftpboot/images/centos/i386/5.4/

Configure dhcp-server.
Add this to your existing or new /etc/dhcpd.conf.
Note: xxx.xxx.xxx.xxx is the IP address of your PXE server
Configuring dhcp server on centos
allow booting;
allow bootp;
next-server xxx.xxx.xxx.xxx; # IP of my PXE server
filename "/pxelinux.0";
#service dhcpd restart

Create the directory for your PXE menus
#mkdir /tftpboot/pxelinux.cfg

My sample config file
#vi /tftpboot/pxelinux.cfg/default

default menu.c32  

prompt 0  
timeout 50  
ONTIMEOUT localboot  
 
MENU TITLE PXE Menu  
   
LABEL localboot  
MENU LABEL Boot From Hard Disk  
LOCALBOOT  0  

LABEL CentoS 5.4 i386 Installer  
MENU LABEL CentOS 5.4 i386 Installer  
KERNEL images/centos/i386/5.4/vmlinuz  
append vga=normal initrd=images/centos/i386/5.4/initrd.img ramdisk_size=32768
Now start the client machine, boot it from lan, it should get a DHCP lease, and start booting successfully from the network
For troubleshooting check /var/log/messages
Credits

Labels: , , , , , , ,

Wednesday, June 16, 2010

Dynamic DNS on CentOS

Installing required packages:
#yum install -y bind bind-chroot bind-libs bind-utils caching-nameserver dhcp

Configuring DHCP server
#rm -rf /etc/dhcpd.conf
#mv /usr/share/doc/dhcp-*/dhcpd.conf.sample /etc/dhcpd.conf

My dhcp configuration is as follows:
#vi /etc/dhcpd.conf
authoritative;              # No other DHCP servers on this subnet
ddns-update-style interim;  # Supported update method - see man dhcpd.conf
ignore client-updates;      # Overwrite client configured FQHNs
ddns-domainname "home.network.";
ddns-rev-domainname "in-addr.arpa.";
include "/var/named/chroot/etc/rndc.key";
zone home.network. {          # Forward zone to be updated
primary 127.0.0.1;
key rndckey;
}
zone 1.168.192.in-addr.arpa. { # Backward zone to be updated
primary 127.0.0.1;
key rndckey;
}
subnet 192.168.1.0 netmask 255.255.255.0 { # Here Specify your subnet
option routers  192.168.1.1; # Specify your router address              
option subnet-mask      255.255.255.0; # Specify subnet mask
option domain-name      "home.network"; # Specify domain name
option domain-name-servers      192.168.1.1; # Specify domain name ip
option time-offset            19800;        # Indian Standard Time
range dynamic-bootp 192.168.1.50 192.168.1.254; # Specify address pool from which dhcp client can get ips 
default-lease-time 21600; # Default leased time in sec
max-lease-time 43200; # Max leased time in sec
}
Changing permission of rndc.key
#chmod 755 /var/named/chroot/etc/rndc.key

Configuring DNS Server
(Note : You can get the copy of name file in /usr/share/doc/bind-*/sample/etc)

My bind configuration is as follows:
#vi /var/named/chroot/etc/named.conf
//sample named.conf
options {
query-source port 53;
directory "/var/named";
forwarders { 8.8.8.8; 8.8.4.4; };
}; 
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
include "/etc/rndc.key";
zone "." {
type hint;
file "named.ca";
}; 
zone "0.0.127.in-addr.arpa" {
type master;
file "named.local";
}; 
zone "home.network" {
type master;
file "home.network.zone";
allow-update { key "rndckey"; };
notify yes;
}; 
zone "1.168.192.in-addr.arpa" {
type master;
file "1.168.192.zone";
allow-update { key "rndckey"; };
notify yes;
};
Now we have to create sample zone files
Creating home.network.zone file
#vi /var/named/chroot/var/named/home.network.zone
$TTL 86400
@ IN SOA home.network root.home.network (
20100616   ; serial in yyymmddxx
28800      ; refresh (8 hours)
14400      ; retry (4 hours)
3600000    ; expire (5 weeks 6 days 16 hours)
86400      ; minimum (1 day)
)
@    IN  NS  home.network. 
@    IN  A  192.168.1.10
home.network. IN  A  192.168.1.10
Creating reverse lookup zone file
#vi /var/named/chroot/var/named/1.168.192.zone
$TTL 86400
@ IN SOA home.network root.home.network (
20100616   ; serial in yyymmddxx
28800      ; refresh (8 hours)
14400      ; retry (4 hours)
3600000    ; expire (5 weeks 6 days 16 hours)
86400      ; minimum (1 day)
) 
@    IN  NS  home.network. 
10.1.168.192.in-addr.arpa.     IN  PTR  home.network.
Modifying host file
#vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.10 home.network
Modifying resolv.conf
#vi /etc/resolv.conf
nameserver 192.168.1.10
Now make shortcuts of these files in the /var/named directory with the same name
#cd /var/named
#ln –s /var/named/chroot/var/named/home.network.zone home.network.zone
#ln –s /var/named/chroot/var/named/1.168.192.zone 1.168.192.zone

Creating soft link of named.conf file
#ln -s /var/named/chroot/etc/named.conf /etc/named.conf

Changing permissions
#chmod 770 /var/named/chroot/var/named
#chmod 770 /var/named

Starting dhcp and bind 
#service dhcpd restart
#service named restart

Starting both the services at system start-up
#chkconfig --level 35 dhcpd on
#chkconfig --level 35 named on 

To troubleshoot, both see /var/log/messages file
#tail -f /var/log/messages | grep dhcp
#tail -f /var/log/messages | grep named 

Labels: , , , , , ,

Monday, May 18, 2009

Cacti on CentOS

Cacti is a complete network graphing solution designed to harness the power of RRDTool's data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.
We have to install following packages on our machine.
#rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

#yum install -y mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd net-snmp-utils php-snmp net-snmp-libs

Configuring the MySQL server

#service mysqld start

Assign  root password for MySQL

# mysqladmin -u root password NEW_PASSWORD

Creating cacti database

#mysql -u root -p
enter you mysql root password
mysql>create database cacti;

Creating user for cacti and assign a new password as cacti
mysql>GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti';
mysql>FLUSH privileges;
mysql>exit;
Configuring snmp

Just copy my snmpd.conf file on your server, to do it

#cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.original
#rm -rf /etc/snmp/snmpd.conf

Copy my snmpd.file from here.

Just change the contact and network as per your requirements.

Run the following command to know wether the snmp is working or not

#service snmpd restart
#snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex

Sample output
IP-MIB::ipAdEntIfIndex.192.168.213.128 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1

Installing cacti

#yum -y install cacti

Installing cacti tables

#mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.7d/cacti.sql
(You need to type cacti user password in my case it is cacti)

Configuring cacti

#vi /etc/cacti/db.php

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";

Save the file and exit

Configuring webserver

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

#
# Cacti: An rrd based graphing tool
#
Alias /cacti    /usr/share/cacti
 

        Order Deny,Allow
        Allow from all


Save and exit.

Restarting webserver

#service httpd restart

Cronjob for cacti

Open /etc/cron.d/cacti file and uncomment the first line.

Running cacti installer

Now cacti is ready to install. Copy the following link on your webbrowser:

http://you_server_ip/cacti/

Just follow on screen instructions. The default username and password for cacti is admin / admin. Upon first login, you will be force to change the default password.

Labels: ,

Sunday, April 26, 2009

Configuring Samba on CentOS

Samba is an Open Source / Free Software suite that has, since 1992, provided file and print services to all manner of SMB/CIFS clients, including the numerous versions of Microsoft Windows operating systems. Samba is freely available under the GNU General Public License.

The Samba project is a member of the Software Freedom Conservancy.
Operatring System
Samba
Installing samba via yum
#yum -y install samba samba-common samba-client
Configuring samba
#mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
Showing you  the basic configuration of samba. In this example we are going to share softwares directory. Only samba user can able to save files in this directory.
#vi /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = Samba Server Version %v
security = share
load printers = yes
cups options = raw
[share]
writeable = yes
admin users = it
path = /softwares
force user = root
valid users = it
public = yes
available = yes
Save and exit the configuration file. Now we have to create samba user as well as the softwares directory which we want to share.
#mkdir /softwares
#adduser it
#passwd it
#smbpasswd -a it
#/etc/init.d/smb restart
Thats it now you are ready to browse the samba share. To access the samba share on windows pc follow the below given procedure:
Start -> run -> cmd
At the prompt type: net use z: \\ip_of_your_samba_server\share /user:it it_password
At this point you have successfully set up Samba under Linux and are now successfully connected to your share from your Windows machine.

Labels: , ,

Tuesday, April 21, 2009

NVU web authoring system for creating web pages


Hi

Trying to build a basic website for my personal use. For a while I used windows notepad for creating webpages.  But u must have a very good html knowledge for that. While searching an open source solution for it I come to know NVUweb authering system. 

Nvu (pronounced "N-view," for a "new view") is a free, open source software program that allows you to build websites and web pages using a simple WYSIWYG editor (what-you-see-is-what-you-get).  Nvu makes creating web pages as easy as using a word processor and rivals such programs as Adobe's Dreamweaver and Microsoft's Expression Web, only for free!  With Nvu's built-in site manager, connecting to your website and making changes is a snap. 

I liked the software cause you can use the same software in Windows as well as in Linux. I am using it on My CentOS
You can download it from the below link

For windows users:
nvu-1.0-win32-installer-full.exe

For linux user:
RPM base
kompozer-0.7.10-i386.rpm

Source file
kompozer-0.7.10-gcc4.0.3-i486.tar.gz

For more information you can go to their website:
NVU websites

Labels: ,

Sunday, April 12, 2009

Installing Joomla on CentOS

Joomla! is a free open source content management system for publishing content on the World Wide Web and intranets as well as a Model–view–controller (MVC) Web Application Development framework. The system includes features such as page caching to improve performance, RSS feeds, printable versions of pages, news flashes, blogs, polls, website searching, and language internationalization. Joomla is licensed under the GPL, and is the result of a fork of Mambo.

It is written in the PHP programming language and uses the MySQL database. Here is the step by step guide of how to install joomla on CentOS.

Operating System:
CentOS5.2

Joomla:
Joomla v.1.5.10

Installing prerequisites:

Enabling RPM repositeries:

#rpm -ivh http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Enabling Utter Ramblings repositeries:

#rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

Creating repo file:

# touch /etc/yum.repos.d/utterramblings.repo
# echo '[utterramblings]' >> /etc/yum.repos.d/utterramblings.repo
# echo "name=Jason's Utter Ramblings Repo" >> /etc/yum.repos.d/utterramblings.repo
# echo 'baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/' >> /etc/yum.repos.d/utterramblings.repo
# echo 'enabled=1' >> /etc/yum.repos.d/utterramblings.repo
# echo 'gpgcheck=1' >> /etc/yum.repos.d/utterramblings.repo
# echo 'gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka' >> /etc/yum.repos.d/utterramblings.repo

Installing required packages:

#yum -y install mysql mysql-server mysql-devel httpd php php-mysql

Creating database for joomla:

#mysql -u root -p
mysql>create database joomla;
mysql>exit

#echo "extension=mysql.so" >> /etc/php.ini

Installation of joomla:

Download and unzip the joomla package in your web root directory. In my case it is /var/www/html

Creating a temporary configuration file
# touch /var/www/html/joomla/configuration.php
# chmod 777 /var/www/html/joomla/configuration.php

Restart your web server:
#service httpd restart

Enter the following url in your browser:
http://your_ip/joomla and follow the webinstallation process. It is quit simple.

Labels: , ,

Tuesday, April 7, 2009

Installing Nagios on CentOS

Nagios is a popular open source computer system and network monitoring software application. It watches hosts and services, alerting users when things go wrong and again when they get better. Nagios was originally designed to run under Linux, but also runs well on other Unix variants. Nagios is free software licensed under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Operating System:
CentOS5.2

Nagios:
Nagios 3.0.6

Prerequisites:
Installing prerequisites on your CentOS box.

# yum install -y httpd gcc glibc glibc-common gd gd-devel

Downloading & Installing nagios and its plugin:

Creating user

#/usr/sbin/useradd -m nagios
#/usr/sbin/groupadd nagcmd
#/usr/sbin/usermod -G nagios,nagcmd nagios
#/usr/sbin/usermod -G nagios,nagcmd apache

Assigning password for user nagios

#passwd nagios

Downloading nagios

#cd /usr/local/src/
#wget http://ovh.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.6.tar.gz
#tar -xzf nagios-3.0.6.tar.gz

Installing Nagios

#cd /usr/local/src/nagios-3.0.6
#./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker
#make all
#make install
#make install-init
#make install-commandmode
#make install-config
#make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.

#htpasswd -bc /usr/local/nagios/etc/htpasswd.users nagiosadmin urpassword

Installing nagios plugin

#cd /usr/local/src
#wget http://ovh.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
#tar -xzf nagios-plugins-1.4.13.tar.gz
#cd nagios-plugins-1.4.13
#./configure --with-nagios-user=nagios --with-nagios-group=nagios
#make
#make install

Restart Apache to take effect all the changes.
#service httpd restart

Starting Nagios:
#service nagios start
Fireup your web browser and go to http://your_server_ip/nagios

Make sure your machine's firewall rules are configured to allow access to the web server if you want to access the Nagios interface remotely.

Labels: ,

Sunday, April 5, 2009

VNC Server on CentOS

RealVNC provides remote control software which lets you see and interact with desktop applications across any network.
The software has a widespread user base from individuals to the largest multi-national companies. Founded by the original developers of VNC to promote, enhance and commercialise VNC.

Operating System:
CentOS5.2

VNC Server version:
vnc-server-4.1.2.14

Installing VNC Server:

#cd /usr/local/src/
#wget http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
#rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#yum -y install vnc vnc-server

Configuring VNC Server:

#echo 'VNCSERVERS="1:root"' >> /etc/sysconfig/vncservers

Before starting vncserver as a service, let's create a vnc password with vncpasswd command.

[root@localhost ~]#vncpasswd
Password:
Verify:

Now let's start vncserver as a service.

#service vncserver start



If you edit the script called xstartup, you will notice following comment in red.
Uncomment those two lines in red as shown below!!! Otherwise, you will get nothing but grey screen.

#cd /root/.vnc
#vi xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &


Since we've just edited vnc startup script, let's restart the vncserver.

#service vncserver restart

So how do I connect to vncserver? Use vncviewer command in vnc client as following.

[root@localhost ~]$ vncviewer localhost:1

Labels: ,

VMware Server On A CentOS

This tutorial provides step-by-step instructions on how to install VMware Server on a CentOS 5.2 desktop system. With VMware Server you can create and run guest operating systems ("virtual machines") such as Linux, Windows, FreeBSD, etc. under a host operating system. This has the benefit that you can run multiple operating systems on the same hardware which saves a lot of money, and you can move virtual machines from one VMware Server to the next one.

Operating System:
CentOS5.2

VMware Server Version:
VMware Server 1.0.3


Preparing CentOS before installing VMware Server

#yum –y install system-config-services xinetd kernel-devel

Downloading VMware Server

To get the serial number you need to run VMware Server, go to http://register.vmware.com/content/registration.html. Fill in your personal details. Afterwards you will get a page with a serial number for VMware Server. Write it down or print it out:

#cd /usr/local/src
#wget http://download3.vmware.com/software/vmserver/VMware-server-1.0.3-44356.tar.gz
#tar zxvf VMware-server-1.0.3-44356.tar.gz
#cd vmware-server-distrib
#./vmware-install.pl

The installer will ask you a lot of questions. You can always accept the default values simply by hitting . When it asks you

You will now find VMware Server under Applications > System Tools:

When you start it, select Local host:

Source:

Labels: , ,

Thursday, April 2, 2009

OCSNG Server Setup on CentOS5.2

Open Computer and Software Inventory Next Generation (OCS inventory NG) is free software that enables users to inventory their IT assets. OCS-NG collects information about the hard- and software of networked machines running the OCS client program ("OCS Inventory Agent"). OCS can be used to visualize the inventory through a web interface. Furthermore, OCS comprises the possibility of deploying applications on the computers according to search criteria. Agent-side IpDiscover makes it possible to know the entirety of networked computers and devices.

Operating System:
CentOS5.2

Downloading OCS Inventory:
OCS Linux Server 1.01

Installing OCS_Inventory server required dependencies:

#cd /usr/local/src/
#wget http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
#rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

MySQL & Apache setup:

#yum -y install mysql-server mysql httpd
#echo "ServerName your_server_name:80" >> /etc/httpd/conf/httpd.conf

Creating database for OCS inventory:

#mysql -u root -p
mysql>CREATE DATABASE ocsweb;
mysql>GRANT ALL PRIVILEGES ON ocsweb.* TO ocs@localhost IDENTIFIED BY 'ocs';
mysql>exit


PHP & Perl Modules setup:

#yum -y install perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Apache-DBI perl-Net-IP perl-SOAP-Lite
#yum -y install php-pecl-zip php-mysql php-devel zlib-devel php-pear php-gd gcc
#yum -y install php-snmp php-posix libgd2 gd-devel libpng libpng-devel perl-config-IniFiles perl-Crypt-DES perl-Digest-HMAC perl-Digest-SHA1 perl-GD perl-IO-Socket-INET6 perl-Net-SNMP perl-rrdtool perl-Socket6 mod_perl perl-XML-Parser

#yum -y install sudo make gcc

Adding zip support to PHP installation:

#pecl install zip
#echo ";Add zip support" >> /etc/php.ini
#echo "extension=zip.so" >> /etc/php.ini
#service httpd restart

OCS Server Installation:

#cd /usr/local/src
#wget http://nchc.dl.sourceforge.net/sourceforge/ocsinventory/OCSNG_LINUX_SERVER_1.01.tar.gz
#tar zxvf OCSNG_LINUX_SERVER_1.01.tar.gz
#cp -rf OCSNG_LINUX_SERVER_1.01 /var/www/html/OCSNG
#cd /var/www/html/OCSNG/ocsreports
#touch dbconfig.inc.php
#chmod 666 dbconfig.inc.php
#cd /var/www/html/OCSNG
#./setup.sh

Pretty much everything is self-explanatory, and for the most part, you can select the defaults. The first screen is only important if you've had a previous version of OCS running on the server.
OCS is now installed in /var/www/html and the main configuration file will be located in the web server's httpd directory, /etc/httpd/conf.d/ocsinventory.conf, along with logging directory at /var/log/ocsinventory-NG/.

Now restart your apache server:
#service httpd restart

Enter the following link into your browser:
http://your_server_ip/OCSNG/ocsreports/install.php

You should see a login box for your MySQL credentials.
MySQL login: root
MySQL Password: whatever you change it too
MySQL HostName: localhost

If everything goes well, you should see a long list of steps the installer completed. If not, fix the problems and try again. If it succeeded, go ahead and click the submit query button at the very bottom of the page. You can now login to the web interface with username and password of both admin. You can change the default password at the top right-hand side of the browser window.

SOURCE

Labels: ,