My blog has moved! Redirecting...

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

Tech Resources

Tuesday, June 29, 2010

PXE booting Windows XP Installation


For pxe server setup you can refer my previous post.

Enabling rpmforge repository
#cd /root
#wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
#rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
#yum install cabextract -y
#yum install tftp-server tftp samba -y

Mount XP CD image (I am using XP with Service Pack 3) and copy i386 folder to the directory from where you are going to start the installation
#mkdir /mnt/iso
#mount xpsp3.iso /mnt/iso
#mkdir /tftpboot/winxp/i386/ -p
#cd /mnt/iso/i386
#cp -av * /tftpboot/winxp/i386/

Also copy drivers to i386 folder. I have collected some drives you have to download & copy them to i386 folder
#cd /root
#wget http://downloads.sourceforge.net/project/bootfloppy/pxefiles.tar.gz?use_mirror=space
#tar zxvf pxefiles.tar.gz
#cd pxefiles/drivers
#cp * /tftpboot/winxp/i386/
#cd /tftpboot/winxp/i386/
#cabextract driver.cab

Creating file of windows for pxe boot
#cd /tftpboot/winxp
#cabextract /tftpboot/winxp/i386/startrom.n1_
#sed -i -e 's/NTLDR/XPLDR/gi' startrom.n12
#mv startrom.n12 winxp.0

#cabextract /tftpboot/winxp/i386/setupldr.ex_
#sed -i -e 's/winnt\.sif/winxp\.sif/gi' setupldr.exe
#sed -i -e 's/ntdetect\.com/ntdetect\.wxp/gi' setupldr.exe
#mv setupldr.exe xpldr

#cp /tftpboot/winxp/i386/ntdetect.com ntdetect.wxp

Changing the file name case if they are in uppercase
#cd /tftpboot/winxp/i386/
#ls | awk '$0!=tolower($0){printf "mv \"%s\" \"%s\"\n",$0,tolower($0)}' | sh

Creating samba share
Add this to your existing or new /etc/samba/smb.conf
#vi /etc/samba/smb.conf
[Global]
workgroup = WORKGROUP

[ris]
path = /tftpboot
browsable = true
read only = yes
writable = no
guest ok = yes
#chkconfig --level 35 smb on
#service smb restart

Creating Response file
#cd /tftpboot/winxp
#vi winxp.sif
[data]
floppyless = "1"
msdosinitiated = "1"
; Needed for second stage
OriSrc = "\\SAMBA_SERVER_IP\ris\winxp\i386"
OriTyp = "4"
LocalSourceOnCD = 1
DisableAdminAccountOnDomainJoin = 1

[SetupData]
OsLoadOptions = "/fastdetect"
; Needed for first stage
SetupSourceDevice = "\Device\LanmanRedirector\SAMBA_SERVER_IP\ris\winxp"

[UserData]
ComputerName = *
Create or modify PXE boot menu list
#vi /tftpboot/pxelinux.cfg/default
LABEL XP
kernel winxp/winxp.0
Creating tftp remap file
#vi /tftpboot/tftpd.remap
ri ^[az]: # Remove “drive letters”
rg \\ / # Convert backslashes to slashes
rg \# @ # Convert hash marks to @ signs
rg /../ /..no../ # Convert /../ to /..no../
rg A a
rg B b
rg C c
rg D d
rg E e
rg F f
rg G g
rg H h
rg I i
rg J j
rg K k
rg L l
rg M m
rg N n
rg O o
rg P p
rg Q q
rg R r
rg S s
rg T t
rg U u
rg V v
rg W w
rg X x
rg Y y
rg Z z
r ^/(.*) \1
r ^xpldr winxp/xpldr
r ^ntdetect.wxp winxp/ntdetect.wxp
r ^winxp.sif winxp/winxp.sif
Changes in tftp deamon to run tftp remap file
#vi /etc/xinetd.d/tftp
server_args = -m /tftpboot/tftpd.remap -s -v -v -v -v /tftpboot
Running binl server so that client machine can take needed network drivers
#cp /root/pxefiles/script/binlsrv.py /tftpboot/winxp/
#cp /root/pxefiles/script/infparser.py /tftpboot/winxp/
#cd /tftpboot/winxp/
#/tftpboot/winxp/infparser.py /tftpboot/winxp/i386
#nohup /tftpboot/winxp/binlsrv.py &

Credits

Labels: , , , , ,

Thursday, June 24, 2010

PXE booting Lucid Lynx Ubuntu -10.04


Earlier we have covered how to setup pxe server. Now we will see how to run ubuntu live cd from pxe.

Mount ubuntu live iso on pxe server
#mkdir /mnt/iso
#mount ubuntu-10.04-desktop-i386.iso /mnt/iso

Create nfs share for ubuntu & copy all the content of live cd to it
#mkdir /nfs-share/ubuntu
#cd /mnt/iso/
#cp -av * /nfs-share/ubuntu/

Entries in nfs share export file
#cat /etc/exports


/nfs-share/ubuntu/    *(no_root_squash,rw,async)
#exportfs -rv

Entries in pxelinux.cfg/default my root directory of tftpboot is /tftpboot


LABEL Ubuntu
kernel /tftpboot/images/ubuntu/vmlinuz
append boot=casper netboot=nfs nfsroot=192.168.3.20:/nfs-share/ubuntu initrd=/tftpboot/images/ubuntu/initrd.lz

Copy initrd and vmlinuz from Ubuntu live cd to tftpboot
#cd /nfs-share/ubuntu/casper
#cp vmlinuz initrd.lz /tftpboot/images/ubuntu/
Thats it. Run your pxe client and choose ubuntu.

Labels: , , , , ,

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: , , , , , , ,

Thursday, June 17, 2010

Google search

Here is a quick find to improve your google search. You can directly access it from google's website.

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: , , , , , ,

Wednesday, June 2, 2010

Installing Windows 7 from Hard Disk

Another way of installing windows 7 is installing it from the Hard Disk itself.
Requirements:
Hiren Boot CD 10.4
Windows 7 CD
Usb Stick 


Create Hiren Boot usb by following the guide on Hiren's Website


1. Insert Hiren Boot USB in your USB Port and boot your machine from USB
2. Choose "Dos BootCD" Option
3. Further choose "Partition Tools", "Smart FDISK" and press enter.
4. In Smart FDISK Window press F2 for creating Primary Partition. Size is 15Gb, partition type fat32, click on OK.
5. For marking the partition as active press Alt+P, then Alt+A to mark the partion active.
6. To save the change press Alt+P, then Alt+S,
7. To Exit press Alt+X. It will ask you to restart your machine. Choose OK, Again boot your machine from USB and select "Mini Windows XP" and press enter.
8. In Mini Windows XP mode Right click on My Computer, select Manage. Right Click on the newly created partition and click on format option. Choose File system as NTFS select quick format option.
9. Copy "boot sources bootmgr" from windows 7 disk to your newly formatted C partition 
10. Start Command prompt from the desktop and run the following commands:
c:\
cd boot
bootsect /nt60 SYS
11. Just restart your machine by clicking start button. 
12. Restart your machine by selecting hard disk as a first boot device and it will start with Windows 7 setup.

Labels: , , ,

Tuesday, June 1, 2010

VNC Server on Fedora 13


We have covered installation of Real VNC server on CentOS. Now we are going to setup VNC server on Fedora 13.

Note: commands run by root user are denoted by #
          commands run by normal user are denoted by $
Installing VNC Server:
#yum install -y tigervnc tigervnc-server

 
Configuring VNC Server for user vidyadhar:
#echo 'VNCSERVERS="1:vidyadhar"' >> /etc/sysconfig/vncservers

 
Before starting vncserver as a service, let's create a vnc password with vncpasswd command.
[vidyadhar@vidyadhar ~]$vncpasswd
Password:
Verify:

 
Now let's start vncserver as a service.
#service vncserver start

 
So how do I connect to vncserver? Use vncviewer command in vnc client as following.
[vidyadhar@vidyadhar ~]$ vncviewer localhost:1

Labels: , , , ,