Linux Virtual Server Setup

Fore June

  • Introduction
  • Lab 1 -- Building Linux Kernel
  • Lab 2 -- Installing LVS Admin. Package
  • Lab 3 -- Setting Up Linux Virtual Server
  • Lab 4 -- Setting Up LVS/Tunnel Cluster
  • Lab 5 -- Building a Web Server Cluster
  • Lab 6 -- Installing Heartbeat and Ldirector
  • Lab 7 -- Configuring Heartbeat and Ldirector
  • Lab 1 Building Linux Kernel

      Installation of Linux

    1. Install Red Hat Linux 7.3 in your system. Create a partition called /apps to hold your application packages that will be used in the labs. Choose lilo booting.

      Prepration

    2. Read the mini-howto of lvs at http://www.linuxvirtualserver.org/Joseph.Mack/mini-HOWTO/LVS-mini-HOWTO.html. If you have time read the HOWTO document at the site too.
    3. Make a directory /apps/download to hold your downloaded packages.
    4. Browse briefly the site http://www.kernel.org/ to learn about the Linux system. Download the package linux-2.4.18.tar.gz ( Linux Kernel version 2.4.18 ) from the URL: http://www.kernel.org/pub/linux/kernel/v2.4/
    5. Download the Linux Virtual Server ( lvs ) patch linux-2.4.18-ipvs-1.0.4.patch.gz and admin package ipvsadm-1.21.tar.gz from http://www.linuxvirtualserver.org/software/index.html
    6. Browse the site http://www.ssi.bg/~ja/ and download the arp patch hidden-2.4.5-1.diff from it. Understand from the site the use of this package.
    7. Make the directory /apps/linux2418 and go to the directory by cd /apps/linux2418.
    8. Unpack the kernel into the directory by gunzip -c /apps/download/linux-2.4.18.tar.gz |tar xvf -
    9. Go to the unpacked directory by cd linux

      Patching the kernel

    10. Now patch the kernel with lvs by gunzip -c /apps/download/linux-2.4.18-ipvs-1.0.4.patch.gz | patch -p1
    11. Then patch the kernel with arp package: patch -p1 < /apps/download/hidden-2.4.5-1.diff

      Configuring and building the kernel

    12. Copy the original kernel configuration file. cp /usr/src/linux/.config . ( If the .config file does not exist, you can first log in as root and go to /usr/src/linux. Then execute make menuconfig and save the configuration as .config. )
    13. Configure the kernel by make menuconfig We are going to build a Linux Virtual Server that supports tunneling. Check the modules in the kernel configuration menu as follows ( You may also refer to the howto of the lvs site ).

      First turn on Code maturity level options
      Code maturity level options  --->
         [*] Prompt for development and/or incomplete code/drivers
      
      The IP Masquerading lives under:
      
      Networking options  --->
       <M>   IP: tunneling 
       <M>   IP: GRE tunnels over IP                               
      
      IP: Netfilter Configuration  --->
      
      <M> IP tables support (required for filtering/masq/NAT)
        <M> Full NAT
        <M> MASQUERADE target support
      
      
      All the LVS stuff should be under:
      
      Networking options  --->
      IP: Virtual Server Configuration  --->
      
      

      Here's the networking config:

      
      <*> Packet socket                                                      
      	[ ] Packet socket: mmapped IO                                        
      	[*] Kernel/User netlink socket                                         
      	[*] Routing messages                                                 
      	<*> Netlink device emulation                                         
      	[*] Network packet filtering (replaces ipchains)                       
      	[*] Network packet filtering debugging                               
      	[*] Socket Filtering                                                   
      	<*> Unix domain sockets                                                
      	[*] TCP/IP networking                                                  
      	[ ]   IP: multicasting                                                 
      	[*]   IP: advanced router                                              
      	[*]     IP: policy routing                                             
      	[*]       IP: use netfilter MARK value as routing key                  
      	[*]       IP: fast network address translation                         
      	[*]     IP: equal cost multipath                                       
      	[*]     IP: use TOS value as routing key                               
      	[*]     IP: verbose route monitoring                                   
      	[*]     IP: large routing tables                                       
      	[*]   IP: kernel level autoconfiguration                               
      	[ ]     IP: BOOTP support                                              
      	[ ]     IP: RARP support                                               
      	<M> IP: tunneling                                                    
      	< > IP: GRE tunnels over IP                                          
      	[ ]   IP: multicast routing                                            
      	[ ]   IP: ARP daemon support (EXPERIMENTAL)                            
      	[ ]   IP: TCP Explicit Congestion Notification support                 
      	[ ]   IP: TCP syncookie support (disabled per default)                 
      	  IP: Netfilter Configuration  ---> IP: Virtual Server Configuration  ---> < > The IPv6 protocol (EXPERIMENTAL)                                 
      	< > Kernel httpd acceleration (EXPERIMENTAL)                         
      	[ ] Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)                    
                                                       
      	
      

      Turn on all the Virtual Server configuration.

      
       <M> virtual server support (EXPERIMENTAL)                                       
      	[*]   IP virtual server debugging (NEW)                                         
      	(16)   IPVS connection table size (the Nth power of 2) (NEW)                    
      	--- IPVS scheduler                                                              
      	<M> round-robin scheduling (NEW)                                              
      	<M> weighted round-robin scheduling (NEW)                                     
      	<M> least-connection scheduling scheduling (NEW)                              
      	<M> weighted least-connection scheduling (NEW)                                
      	<M> locality-based least-connection scheduling (NEW)                          
      	<M> locality-based least-connection with replication scheduling (NEW)         
      	<M> destination hashing scheduling (NEW)                                      
      	<M> source hashing scheduling (NEW)                                           
      	--- IPVS application helper                                                     
      	<M> FTP protocol helper (NEW)                                                 
      	
      

      Here's the configuration for the netfilter section:

      
      <M> Connection tracking (required for masq/NAT)
      	<M> FTP protocol support
      	<M> Userspace queueing via NETLINK (EXPERIMENTAL)
      	<M> IP tables support (required for filtering/masq/NAT)
      	<M> limit match support
      	<M> MAC address match support
      	<M> netfilter MARK match support
      	<M> Multiple port match support
      	<M> TOS match support
      	<M> Connection state match support
      	<M> Unclean match support (EXPERIMENTAL)
      	<M> Owner match support (EXPERIMENTAL)
      	<M> Packet filtering
      	<M> REJECT target support
      	<M> MIRROR target support (EXPERIMENTAL)
      	<M> Full NAT
      	<M> MASQUERADE target support
      	<M> REDIRECT target support
      	<M> Packet mangling
      	<M> TOS target support
      	<M> MARK target support
      	<M> LOG target support
      	<M> ipchains (2.2-style) support
      	<M> ipfwadm (2.0-style) support                                         
      	 
      


      Building the kernel


      ( If your system does not have enough memory to compile the kernel while running X-windows. You can switch the system to the console by the command #telinit 3 and logout or reboot your system. The symbol '#' is the root prompt meaning that you have to execute the command as root. )
    14. Make dependencies by make dep
    15. Login as root by su.
    16. Execute the commands
      1. # make modules
      2. # make modules_install
    17. Exit root.
    18. Create a kernel image by make bzImage
    19. Login as root using su.
    20. Copy the system map of the kernel you just made to the boot directory by # cp System.map /boot/System.map-2.4.18a
    21. Link the new system map ( note that you must first remove System.map, which is actually a link ). # rm /boot/System.map
      # ln -s /boot/System.map-2.4.18a /boot/System.map
    22. Copy the kernel image to the boot directory: # cd arch/i386/boot
      # cp bzImage /boot/vmlinuz-2.4.18a
    23. Make nodes by # mkinitrd /boot/initrd-2.4.18a.img 2.4.18
    24. Edit the lilo configuration file so that the system can boot to the new kernel. Edit the file /etc/lilo.conf to include something like:
      	prompt
      	timeout=50
      	default=linux2418a
      	boot=/dev/hda
      	map=/boot/map
      	install=/boot/boot.b
      	message=/boot/message
      	linear
      
      	image=/boot/vmlinuz-2.4.18a
      	label=linux2418a
      	initrd=/boot/initrd-2.4.18a.img
      	read-only
      	root=/dev/hda1      
      	
      (If you have used GRUB to boot your system, you need to edit the file /etc/grub.conf and skip the next step. )
    25. Load your lilo configuration by # lilo -v -v -v
    26. Reboot your system.
    27. Execute the command uname -a to check if the new kernel is running.

    << Prev  Next >>