Archive for November, 2011


Red Hat

1. Setup NTP on the front end node

– yum install -y ntp
– ntpdate pool.ntp.org

2. Setup the packages required for eucalyptus installation

– yum install -y java-1.6.0-openjdk ant ant-nodeps dhcp \
bridge-utils perl-Convert-ASN1.noarch \
scsi-target-utils httpd

3. Install Hypervisor (Xen recommended)

– yum install -y xen

4. Disable SELinux

– run system-config-securitylevel-tui
– select Security Level: Disabled
– select OK

5. Setup yum repository

– vi /etc/yum.repos.d/yum.repo

Paste the following lines

[euca]

name=Eucalyptus
baseurl=http://www.eucalyptussoftware.com/downloads/repo/eucalyptus/{{VERSION}}/yum/centos/{{BASEARCH}}
gpgcheck=0

6. Using yum install the packages

FRONT END

– yum install eucalyptus-cloud eucalyptus-cc eucalyptus-walrus \

eucalyptus-sc

NODE

yum install eucalyptus-nc

1. yum -y install squid

2. vi /etc/squid/squid.conf

3. Edit the config file as shown

acl CONNECT method CONNECT

# line 31: add ( define new ACL )

acl lan src 10.0.0.0/24

http_access allow localhost

# line 59: add ( allow defined ACL above )

http_access allow lan

# line 64: change

http_port 8080

# add at the last line

request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all

# add (specify hostname)

visible_hostname (proxy name)

# add (hide IP address)

forwarded_for off

4. service squid restart

5. chkconfig squid on

 

#include<stdio.h>
#include<conio.h>
#include<string.h>
struct inode
{
int inodeno;
int rc;
}*in[10];
struct fdnode
{
int fd;
struct inode *next;
}*fd[10],*nfd;
struct file
{
char name[10];
int inodeno;
}*fp[10],*root;
struct tree
{
int inodeno;
char fname[10];
struct tree *left,*right;
};
int winode;
int main()
{
char path[30];
int inode,i,k,j;
char name[][10]={“root”,”etc”,”usr”,”bin”};
char temp[5][10];
struct tree *node[4],*newnode;
for(i=0;i<4;i++)
{
node[i]=(struct tree*)malloc(sizeof(struct tree));
strcpy(node[i]->fname,name[i]);
node[i]->inodeno=rand()%1000;
node[i]->left=NULL;
node[i]->left=NULL;
}
node[0]->left=node[2];
node[0]->right=node[1];
node[1]->left=node[3];
start:
printf(“Enter filename:”);
scanf(“%s”,path);
k=1;
for(j=0;j<4;j++)
{
for(i=0;i<10;i++)
{
if(path[k]==’/’ || path[k]==”)
{
k++;
break;
}
temp[j][i]=path[k];
k++;
}
if(k==strlen(path)+1)
{
temp[j][i]=”;
break;
}
temp[j][i]=”;
continue;
}
root=(struct file*) malloc (sizeof(struct file));
strcpy(root->name,”root”);
root->inodeno=rand()%1000;
winode=root->inodeno;
newnode=(struct tree*)malloc(sizeof(struct tree));
strcpy(newnode->fname,temp[j]);
//newnode->inodeno=rand()%1000;
newnode->left=NULL;
newnode->right=NULL;
for(i=0;i<=j;i++)
{
printf(“%s\n”,temp[i]);
}
if(strcmp(temp[0],node[0]->fname)==0)
{
if(strcmp(temp[1],node[1]->fname)==0)
{
if(j==2)
{
node[1]->right=newnode;
inode=namei(temp[2]);
}
else
{
if(strcmp(temp[2],node[3]->fname)==0)
{
if(j==3)
{
node[3]->right=newnode;
inode=namei(temp[3]);
}
else
{
printf(“Wrong path\n”);
goto start;
}
}
else
{
printf(“Wrong path\n”);
goto start;
}
}
}
else
{
if(strcmp(temp[1],node[2]->fname)==0)
{
if(j==2)
{
node[2]->right=newnode;
inode=namei(temp[2]);
}
else
{
printf(“Wrong path\n”);
goto start;
}
}
else
{
printf(“Wrong path\n”);
goto start;
}
}
}
else
{
printf(“Wrong path\n”);
goto start;
}
if(inode==0)
goto end;
for(i=0;i<10;i++)
{
if(in[i]->inodeno==inode)
{
in[i]->rc++;
nfd=(struct fdnode*) malloc (sizeof(struct fdnode));
nfd->fd=rand()%1000;
nfd->next=in[i];
break;
}
}
printf(“UFD AND INODE TABLE(after dup)\n”);
printf(“File Desc\tInode No\tRC\n”);
for(i=0;i<10;i++)
{
printf(“%d\t\t%d\t\t%d\n”,fd[i]->fd,in[i]->inodeno,in[i]->rc);
}
printf(“%d\t\t%d\t\t%d\n”,nfd->fd,nfd->next->inodeno,nfd->next->rc);
printf(“——————————————————————————–\n”);
end:
getch();
}
int namei(char name[10])
{
char fname[10][10]={“demo”,”all”,”info”,”data”,”sam”,”exam”,”eg”,”test”,”dev”,”etc”};
int i,flag=0;
for(i=0;i<10;i++)
{
fp[i]=(struct file*) malloc (sizeof(struct file));
strcpy(fp[i]->name,fname[i]);
fp[i]->inodeno=rand()%1000;
}
printf(“FILE SYSTEM HIERARCHY\n”);
printf(“Filename\tInode No\n”);
for(i=0;i<10;i++)
{
printf(“%s\t\t%d\n”,fp[i]->name,fp[i]->inodeno);
}
printf(“——————————————————————————–\n”);
for(i=0;i<10;i++)
{
in[i]=(struct inode*) malloc (sizeof(struct inode));
in[i]->inodeno=fp[i]->inodeno;
in[i]->rc=1;
fd[i]=(struct fdnode*) malloc (sizeof(struct fdnode));
fd[i]->fd=rand()%1000;
}
printf(“FILE DATASTRUCTUES..\n”);
printf(“UFD AND INODE TABLE\n”);
printf(“File Desc\tInode No\tRC\n”);
for(i=0;i<10;i++)
{
printf(“%d\t\t%d\t\t%d\n”,fd[i]->fd,in[i]->inodeno,in[i]->rc);
}
printf(“——————————————————————————–\n”);
for(i=0;i<10;i++)
{
if(strcmp(fp[i]->name,name)==0)
{
winode=fp[i]->inodeno;
break;
}
}
flag=iget(winode);
if(flag==1)
return winode;
printf(“Error… File not available..”);
return 0;
}
int iget(int inode)
{
int inodecache[10],i;
for(i=0;i<10;i++)
{
inodecache[i]=fp[i]->inodeno;
}
for(i=0;i<10;i++)
{
if(winode==inodecache[i])
return 1;
}
return 0;
}

 Installation
RTMINIX3 can be installed in several ways. It is possible to install it from
an installation CD. Furthermore it is possible to rebuild a standard Minix
3.1.2a installation to RTMINIX3 by patching or copying the source code. We
also provide a pre-installed VMware virtual machine image.
Using the installation CD
Installation of RTMINIX3 is exactly the same as installing Minix 3. You
can use the installation manual of Minix 3 to guide you through the instal-
lation.
Patching and rebuilding a Minix 3.1.2a installation
1. Install Minix 3.1.2a (if not already done).
2. Install GNU Patch. GNU Patch is not available in Packman. Either
build it from source or install the binary by transferring it to your
system (e.g downloading using urlget or FTP).
3. Transfer the patch le to your computer (e.g. using FTP).
4. Create a backup of the source directory:
cp -r /usr/src/ /usr/src_backup/
5. Patch the source directory:
/usr/gnu/bin/patch -p0 < /path/to/rtminix3.patch
6. Rebuild the system:
cd /usr/src/tools && make fresh install
7. Reboot:
reboot
8. Rebuild commands:
cd /usr/src/commands && make all install

Copying the source code and rebuilding a Minix 3.1.2a installation
1. Install Minix 3.1.2a (if not already done).
2. Create a backup of the source directory:
mv /usr/src/ /usr/src_backup/
3. Transfer the source code package (rtminix3.tar.bz2) to your computer
(e.g. using FTP).
4. unzip the package to rtminix3.tar:
bunzip2 rtminix3.tar.bz2
5. Extract the tarbal le to /usr/src/:
tar xvf rtminix3.tar
6. Rebuild the system:
cd /usr/src/tools && make fresh install
7. Reboot:
reboot
8. Rebuild commands:
cd /usr/src/commands && make all install
Using the VMware virtual machine image
1. Unzip the le containing the virtual machine image (RTMINIX3 vmware.zip).
2. Follow the instructions of your VMware software to add an existing virtual machine.3. If asked for the vmx con g le, provide the path to RTMINIX3.vmx

Kickstart Steps:
1. Install vsftpd package
2. Copy the entire contents of the dvd to /var/ftp/pub
3. Install the package create repo
createrepo -g comps*.xml /var/ftp/pub
4. Setup yum repo
5. Install system-netboot-tools package
6. Set up nfs exports to export the file “/var/ftp/pub *(ro,sync)”
7. Configure tftp server by setting disable=no instead of disable=yes and comment the line in /etc/xinetd/tftp
8. Setup dhcp server use config file dhcpd.conf done by me in /home/kickstart folder
9. Use system-config-kickstart command to setup anaconda-ks.cfg file and copy it to /var/ftp/pub
10.Install kernel el5 and setup headers and dependency packages “kernel-2.6*.el5”
11. Use network boot in the client

sample ks.cfg file

#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth –useshadow –enablemd5
# System bootloader configuration
bootloader –location=mbr
# Partition clearing information
clearpart –none
# Use text mode install
text
# Firewall configuration
firewall –enabled
# Run the Setup Agent on first boot
firstboot –disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging –level=info
# Use NFS installation media
nfs –server=192.168.1.1 –dir=/var/ftp/pub/
# Network information
network –bootproto=dhcp –device=eth0 –onboot=on
# Reboot after installation
reboot
# SELinux configuration
selinux –disabled
# System timezone
timezone Asia/Calcutta
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig –defaultdesktop=GNOME –depth=8 –resolution=800×600
# Disk partitioning information
part / –bytes-per-inode=4096 –fstype=”ext3″ –size=5000
part /boot –bytes-per-inode=4096 –fstype=”ext3″ –size=1000
part /home –bytes-per-inode=4096 –fstype=”ext3″ –size=10000
part swap –bytes-per-inode=4096 –fstype=”swap” –size=2000
%packages
@office
@development-libs
@editors
@gnome-software-development
@text-internet
@x-software-development
@virtualization
@gnome-desktop
@dialup
@core
@base
@games
@java
@legacy-software-support
@base-x
@graphics
@printing
@sound-and-video
@admin-tools
@development-tools
@graphical-internet
emacs
mesa-libGLU-devel
kexec-tools
bridge-utils
device-mapper-multipath
xorg-x11-utils
xorg-x11-server-Xnest
xorg-x11-server-Xvfb
libsane-hpaio
imake
-sysreport

dhcpd.conf

#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# — default gateway
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;

# option nis-domain “domain.org”;
# option domain-name “domain.org”;
# option domain-name-servers 192.168.1.1;

option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# — Selects point-to-point node (default is hybrid). Don’t change this unless
# — you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.1.10 192.168.1.20;
filename “linux-install/pxelinux.0”;
next-server 192.168.1.1;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}

tftp configuration

# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
# disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

Setup NFS if needed

Social Networking Website

Well this was the project we worked on during our 4th semester project.

Languages used : PHP ,AJAX.

Design Components : Headers and menus using Adobe Photoshop and Adobe Flash

Screen Shots coming soon 😛

Nice article

http://www.thegeekstuff.com/2011/06/iptables-rules-examples/

NFS Setup

1. Install the nfs packages (nfs portmap)

yum install nfs portmap

2. Restart the services and enable at startup

service nfs restart

service portmap restart

chkconfig nfs on

chkconfig portmap on

3. Add entry to your nfs file(exports)

vi /etc/exports

4. Make the following changes just a sample is given change according to your requirements

/common 172.24.0.0/255.255.0.0(rw,sync)

5. Change SELinux context

setsebool -P samba_share_nfs=1

6. Restart nfs and portmap

You must now be able to access NFS

1. Install the packages required for running http server

yum install httpd

2. Restart the service and enable at boot up

service httpd restart

chkconfig httpd on

3.  Create a Sample html file named index.html under /var/www/html

4. Go to your browser and type http://(ip-address)

5. Your http server must be up and running. The page you just created must appear.