Compare the packages (deb / apache) on two debian/ubuntu servers

Compare the packages (deb / apache) on two debian/ubuntu servers

Debian / Ubuntu

I worked up this command and I don’t want to lose it

#diff <(dpkg -l|awk '/ii /{print $2}') <(ssh 111.222.33.44 "dpkg -l"|awk '/ii /{print $2}')|grep '>'|sed -e 's/>//'

This command shows a list of all of the packages installed on 111.222.33.44 that are not installed on the current machine

To make this work for you,  just update the ssh 111.222.33.44 command to point to the server you want to compare it with.

I used this command to actually create my apt-get install command

#apt-get install `diff <(dpkg -l|awk '/ii /{print $2}') <(ssh 111.222.33.44 "dpkg -l"|awk '/ii /{print $2}')|grep '>'|sed -e 's/>//'`

Just be careful that you have the same Linux kernels etc,  or you may be installing more than you expect

Apache

The same thing can be done to see if we have the same Apache modeuls enabled on both machines

diff <(a2query -m|awk '{print $1}'|sort) <(ssh 111.222.33.44 a2query -m|awk '{print $1}'|sort)

This will show you which modules are / are not enabled on the different machines

 

Network Boot Server with Linux Install, Debian Etch and Lenny, CentOS and KNOPPIX

Network Boot Server with Linux Install, Debian Etch and Lenny, CentOS and KNOPPIX

I just LOVE my dedicated PXE boot server at the office with several flavors of linux install on it.

I can bring a new server online with a base install in as few as five minutes with Debian or CentOS
I can debug workstations and servers with a quickbooting KNOPPIX install.

I even have some kernel installations customized to install network drivers for the Dell 2650 so that the installs I do for those are quick and simple. (basically the broadcom network drivers and the openssh-server packages are preseeded to be installed with the default package)

Here are the contents my pxelinux.cfg/default file:

DISPLAY boot.txt

#DEFAULT etch_i386_install

LABEL etch_i386_install
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz  —
LABEL etch_i386_expert
kernel debian/etch/i386/linux
append priority=low vga=normal initrd=debian/etch/i386/initrd.gz  —
LABEL etch_i386_rescue
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz  rescue/enable=true —
LABEL knoppix
kernel knoppix/vmlinuz
append secure myconfig=scan nfsdir=192.168.0.1:/srv/diskless/knoppix nodhcp lang=us ramdisk_size=100000 init=/etc/init apm=p
ower-off nomce vga=791 initrd=knoppix/miniroot.gz quiet BOOT_IMAGE=knoppix
LABEL centos5_install
kernel centos/5/vmlinuz
append ks=nfs:192.168.0.1:/srv/diskless/centos/5/ks_prompt.cfg initrd=centos/5/initrd.img ramdisk_size=100000 ksdevice=eth0
ip=dhcp url –url http://mirror.centos.org/centos/5/os/i386/CentOS/
LABEL centos5_raid_install_noprompt
kernel centos/5/vmlinuz
append ks=nfs:192.168.0.1:/srv/diskless/centos/5/ks_raid.cfg initrd=centos/5/initrd.img ramdisk_size=100000 ksdevice=eth0 ip
=dhcp url –url http://mirror.centos.org/centos/5/os/i386/CentOS/
LABEL centos5_hda_install_noprompt
kernel centos/5/vmlinuz
append ks=nfs:192.168.0.1:/srv/diskless/centos/5/ks_hda.cfg initrd=centos/5/initrd.img ramdisk_size=100000 ksdevice=eth0 ip=
dhcp url –url http://mirror.centos.org/centos/5/os/i386/CentOS/
LABEL centos5_install_noprompt
kernel centos/5/vmlinuz
append ks=nfs:192.168.0.1:/srv/diskless/centos/5/ks.cfg initrd=centos/5/initrd.img ramdisk_size=100000 ksdevice=eth0 ip=dhcp
url –url http://mirror.centos.org/centos/5/os/i386/CentOS/

[dfads params=’groups=221&limit=1′]

LABEL lenny_i386_install
kernel debian/lenny/i386/linux
append vga=normal initrd=debian/lenny/i386/initrd.gz —

LABEL lenny_amd64_install
kernel debian/lenny/amd64/linux
append vga=normal initrd=debian/lenny/amd64/initrd.gz —

LABEL etch_amd64_install
kernel debian/etch/amd64/linux
append vga=normal initrd=debian/etch/amd64/initrd.gz —

LABEL etch_amd64_linux
kernel debian/etch/amd64/linux
append vga=normal initrd=debian/etch/amd64/initrd.gz —

LABEL etch_amd64_expert
kernel debian/etch/amd64/linux
append priority=low vga=normal initrd=debian/etch/amd64/initrd.gz —

LABEL etch_amd64_rescue
kernel debian/etch/amd64/linux
append vga=normal initrd=debian/etch/amd64/initrd.gz rescue/enable=true —

LABEL etch_amd64_auto
kernel debian/etch/amd64/linux
append auto=true priority=critical vga=normal initrd=debian/etch/amd64/initrd.gz —

PROMPT 1

Here are the contents of my boot.txt file (so that I know what to type at the command line when booting)

– Boot Menu –
=============

etch_i386_install   –   Debian Stable
etch_i386_expert    –   Debian Stable (Shows install menu every step)
etch_i386_rescue    –   Debian Stable Rescue
lenny_i386_install — has Broadcom net card customization
lenny_amd64_install — has Broadcom net card customization
etch_amd64_install
etch_amd64_linux
etch_amd64_expert
etch_amd64_rescue
etch_amd64_auto
centos5_install –  CentOS 5 (Will prompt for disks)
centos5_install_noprompt –  CentOS 5 (Will auto install without prompts)
centos5_hda_install_noprompt –  CentOS 5 (Will auto install without prompts)
centos5_raid_install_noprompt –  CentOS 5 (Will auto install on raid 1 without prompts)
knoppix

Hope someone out there can find some use from this.
We of course can help people having trouble with their own TFTP and PXE Boot Server .

Debian Lenny Network Boot on Dell 2650 (Broadcom Network Card)

Debian Lenny Network Boot on Dell 2650 (Broadcom Network Card)

Debian Lenny (and etch) both do not include the drivers for the broadcom network cards that come with many dell servers,  I use the Dell 2650 a lot but I have also had issues with the 1750 and 1950,   I am sure their are other
I hear it is a licensing problem with debian not being able to distribute the drivers or something.
Here is the solution I have come up with from my end.

On my pxeboot server (I refer to pxe booting but I dont describe how to set one up,  check this howto out)

I cd into the directory that my lenny installation is to be setup in (based on the pxelinux.cfg/default file)

#cd /tftpboot/debian/lenny/i386/

I am going to download all of the network installation files for debian lenny on i386, this should apply 64 bit too though.

# wget http://ftp.nl.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/netboot.tar.gz
# wget http://ftp.nl.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz
# wget http://ftp.nl.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/debian-installer/i386/linux

download the broadcom drivers package and extract it to a folder called bnx2

# wget http://ftp.us.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_0.14+lenny1_all.deb
# dpkg-deb  -x firmware-bnx2_0.14+lenny1_all.deb bnx2

Create a temp working directory

# mkdir temp
# cd temp

extract all of the installation files from the initrd.gz file so you can manipulate them (include the driver)

# zcat ../initrd.gz |cpio -iv

Copy all of the firmware drivers from the extracted bnx2 directory into the root of the extracted initrd.gz kernel directory

# cp ../bnx2/lib/firmware/* ../bnx2/usr/share/initramfs-tools/hooks/firmware_bnx2 .

Since the kernel initrd.gz is only used during installation of the OS,  this fix so far hasn’t addressed installing the broadcom driver package for the OS after installation.
To do this you will need to customize the kernel to select and install this package during installation using “preseeding”
Create and edit a file called preseed.cfg in the root of the extracted kernel directory (

# vi preseed.cfg

Place the following contents in that file (I have aso included the ssh server since I typcially do a minimum install without ANY packages but I need ssh)

#automatically select these packages when installing the server
#d-i pkgsel/include string openssh-server firmware-bnx2
base-config     apt-setup/non-free      boolean true
d-i     preseed/late_command            string apt-install firmware-bnx2; apt-install openssh-server;

As another shortcut that can shave a tiny bit of time of of your installation,  if you do not use USB storage during your installation,  there is no need to wait for the delay and errors that occur during the system’s search for those USB storage devices. Deleting the USB drivers from the installation kernel will prevent these errors

# rm -rf lib/modules/2.6.26-2-486/kernel/drivers/usb/storage

Now it is time to put the extracted kernel directory back together in the location that the pxe boot is looking for it.

# find . -print0 | cpio -0 -H newc -ov | gzip -c > ../initrd.gz

that is  it!  you have customized and rebuilt your installation kernel for network boot.
Simply pxeboot to this installation with your Dell or broadcom server and the drivers will be included.
The concepts used above can also help you to setup and customize a net boot which has packages already selected or otherwise speed your install along with drivers or other customizations already selected,  look into preseeding for more options here.

Call Now Button(208) 344-1115

SIGN UP TO
GET OUR 
FREE
 APP BLUEPRINT

Join our email list

and get your free whitepaper