Vincent's Webspace Logo Banner
Search my website:

Powered by Google
Home Page
My Profile
My Facebook
My Xanga日記
Search Engines
Game
散文集
For Sell
Links
Personal
Love
Psychology
Astrology
Living in HK
Books
Health & Care
Computers
Benchmark
Linux
Computer Pricing
RPM / Binaries
RedHat Linux
Debian Linux
Windows Server
Windows
Windows PE
OpenOffice.org
Asterisk
Virtualization
SQL Server
Firewall
PHP
Visual Studio
XOOPS CMS
MySQL Server
Adobe Photoshop
SWiSH
Microsoft Office
Exchange Server
Lotus Notes
Microsoft Project
SharePoint
Request Tracker
PKI
BlackBerry
PocketPC/WM PDA Phone
Palm
Software Development
Toolbox
Website Building
Graphics
Documentations
Visitor Report
ICQ2Go!

RedHat Linux

General

RedHat Network
RPM Packages
RPM Usage
  • Building RPM SRC Packages
    Most simple for RedHat 8.0:
    1. install the: rpm-build package
    2. run: rpmbuild -ba [spec file name]
  • query rpm package file
    • How to list package dependencies:
      	#rpm -qpR [package-1.2.3-1.i386.rpm]
      	
    • How to install rpm-s in correct order:
      	put all rpm's that you want to install in a one dir... 
      	and then :
      	#rpm -ihv *.rpm
      	Rpm will install them in correct order 
      	
    • How to extract files from an rpm:
      	Extract all the files inside an rpm to the current directory:
      	#rpm2cpio /path/to/rpm/filename.rpm | cpio -ivd
      	
    • List all the RPM with name & version seperate:
      	#rpm -qa --qf "%{NAME}\t%{VERSION}-%{RELEASE}\n"
      	
HOWTOs
  • HowtoForge
  • Rescue Fedora Core 4
    • Since Fedora Core 4 is using GCC 4.0 to compile, it cannot use most 3rd party boot CD / boot floppy to rescue the system (in chroot enviornment) and must use Fedora Core 4's CD1
    • When using other boot CD to chroot Fedora Core 4 root, these error may happen:
      1) child setpgid (4061 to 4061): No such process,
      2) when doing grub-install, /boot/grub/stage1 not read correctly
  • Using iptables to rate-limit incoming connections
    This is generic, not only for Debian Linux.
    
    e.g. Limit 3 SSH connections per minute (the 4th+ connections will get droped)
    iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
    iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update \
    --seconds 60 --hitcount 4 -j DROP
    
  • Software RAID in RedHat Linux
    • Linux RAID FAQ
    • Root-on-LVM-on-RAID HOWTO
    • Unofficial Kernel 2.4 Root-on-RAID and Root-on-LVM-on-RAID HOWTO
    • 1U-Raid5.net - Linux Software RAID website
      A bit out-dated, but get the idea of how a bootable Linux Software RAID will work
    • To transfer an existing partition /dev/hda1 into a software RAID-1 partition /dev/md0 in Fedora Core 3
      1. Create enough md devices:
        		mknod /dev/md0 b 9 0
        		mknod /dev/md1 b 9 1
        		mknod /dev/md2 b 9 2
        		
      2. connect the prepare to be RAID disk as /dev/hdc
      3. boot up Linux, create partition(s) at /dev/hdc:
        hdc1, type: fd, bootable (for root)
        hdc2, type: fd (for swap)
      4. Create & activate initial single disk RAID devices:
        /sbin/mdadm --create --verbose --force /dev/md0 --level=1 --raid-devices=1 /dev/hdc1
        /sbin/mdadm --create --verbose --force /dev/md0 --level=1 --raid-devices=1 /dev/hdc2
      5. mke2fs -j /dev/md0
      6. mkswap /dev/md1
      7. mount the /dev/md0 to e.g. /mnt2, and transfer files from /dev/hda1
      8. chroot to /mnt2, modify the fstab to e.g.:
        /dev/md0                /                       ext3    defaults        1 1
        none                    /dev/pts                devpts  gid=5,mode=620  0 0
        none                    /proc                   proc    defaults        0 0
        none                    /dev/shm                tmpfs   defaults        0 0
        /dev/md1                swap                    swap    defaults        0 0
        
        *** Note that a label is not needed at the /dev/md0
      9. make sure /etc/modprobe.conf contain this for the md0 to be bootable:
        alias md-personality-3 raid1
      10. create an initrd file for booting the software RAID-1
        /sbin/mkinitrd --preload raid1 initrd-`uname -r`-raid1.img `uname -r`
        *** Make sure /dev/md0 and /dev/md1 is running before run mkinitrd, check with: cat /proc/mdstat *** Expect run more than 3 min even on a P3 1Ghz system
      11. modify the grub.conf to contains e.g.:
        title Fedora Core-up (2.6.9-1.667) SWRAID1
                root (hd0,0)
                kernel /boot/vmlinuz-2.6.9-1.667 ro root=/dev/md0
                initrd /boot/initrd-2.6.9-1.667-raid.img
        
      12. Run grub to make /dev/hdc bootable:
        		#> grub --batch --no-floppy
        		grub> root (hd1,0)
        		grub> setup (hd1)
        		
      13. exit from chroot, unmount the /dev/hdc, shutdown
      14. remove the old /dev/hda disk or clean the partiton before boot up.
      15. boot with hdc, You should be able to boot from the software RAID partition
      16. After boot up, set the RAID devices to 2 disks:
        /sbin/mdadm --grow /dev/md0 --raid-disks=2
        /sbin/mdadm --grow /dev/md1 --raid-disks=2
      17. Create the partitions at hda:
        hda1, type: fd, bootable (for root)
        hda2, type: fd (for swap)
      18. Add the partitions at hda to the RAID devices:
        /sbin/mdadm --manage /dev/md0 --add /dev/hda1 /sbin/mdadm --manage /dev/md1 --add /dev/hda2
      19. Wait until the rebuild finish
      20. Run grub to make /dev/hda bootable, too:
        		#> grub --batch --no-floppy
        		grub> root (hd0,0)
        		grub> setup (hd0)
        		
      21. *** Other Useful commands:
        		Stop a MD device:
        		/sbin/mdadm --manage --stop /dev/md0
        		
        		Remove a partition from a MD device by clear the superblock:
        		/sbin/mdadm --misc --zero-superblock /dev/hdc1
        		
        		Remove a partition from a MD device by clear the superblock:
        		/sbin/mdadm --misc --zero-superblock /dev/hdc1
        		
        		Fail and remove hda1 from md0:
        		/sbin/mdadm --manage /dev/md0 --fail /dev/hda1
        		/sbin/mdadm --manage /dev/md0 --remove /dev/hda1
        		
      22. *** root at RAID-5:
        You can consider setup the /boot partition with RAID-1 across all the drives (hda1, hdb1, hdc1...etc) , then setup the / partition with RAID-5 on all the drives (hda2, hdb2, hdc2...etc)
    • To resize a RAID-1 array in Fedora Core 3 (replace a larger disk)
      1. Fail and remove a disk, then shutdown, replace with a larger disk, hot add it and let them rebuild. Repeat for all disks.
      2. Reboot the system after rebuild
      3. resize the MD device with: /sbin/mdadm --grow /dev/md0 --size [cal_size]
        *** NOTE: [cal_size] number should be 128 smaller than you see in fdisk (reserve 128k at the end for RAID use)
      4. The sync may be delayed, reboot to let the new MD device sync
      5. Resize with ext2online: (Need kernel support, I tested Fedora Core 3's 2.6.9-1.667 works)
        /usr/sbin/ext2online -v /dev/md0
      6. Resize swap by rebuild the swap again:
        swapoff /dev/md1
        mkswap /dev/md1
        swapon /dev/md1
    • To transfer an existing partition /dev/hda1 into a software RAID-1 partition /dev/md0 in RedHat 8.0
      1. connect the prepare to be RAID disk as /dev/hdc
      2. boot up Linux, create partition(s) at /dev/hdc, type: fd
      3. prepare a dummy /etc/raidtab, create more md devices if needed:
        raiddev             /dev/md0
        raid-level                  1
        nr-raid-disks               2
        chunk-size                  4k
        persistent-superblock       1
        nr-spare-disks              0
            device          /dev/hdc1
            raid-disk     0
            device          /dev/hdp1
            failed-disk     1
        
      4. mkraid /dev/md0 to activate the 'failed raid-1 array'
      5. mke2fs the /dev/md0
      6. mount the /dev/md0 to e.g. /mnt2, and transfer files from /dev/hda1
      7. chroot to /mnt2, modify the fstab to e.g.:
        /dev/md0                /                       ext3    defaults        1 1
        none                    /dev/pts                devpts  gid=5,mode=620  0 0
        none                    /proc                   proc    defaults        0 0
        none                    /dev/shm                tmpfs   defaults        0 0
        /dev/md1                swap                    swap    defaults        0 0
        
      8. make sure /etc/modules.conf contains:
        alias md-personality-3 raid1
      9. create an initrd file for booting the software RAID-1
        /sbin/mkinitrd --preload raid1 initrd-`uname -r`-raid1.img `uname -r`
      10. modify the grub.conf to contains e.g.:
        title Red Hat Linux (2.4.18-14smp) SWRAID1
                root (hd0,0)
                kernel /boot/vmlinuz-2.4.18-14smp ro root=/dev/md0
                initrd /boot/initrd-2.4.18-14smp-raid1.img
        
      11. Run grub to make /dev/hdc bootable:
        #> grub --batch --no-floppy
        grub> root (hd1,0) grub> setup (hd1)
      12. exit from chroot, unmount the /dev/hdc, boot up the hdc dummy RAID-1 partition
        replace the /dev/hda or clean the partiton before boot up.
      13. You should be able to boot from the software RAID partition
      14. Afterboot up, transfer the partition information from /dev/hdc to /dev/hda: (or manual create with fdisk)
        sfdisk -d --no-reread /dev/hdc > /tmp/partition
        sfdisk /dev/hda < /tmp/partition
      15. correct the /etc/raidtab:
        replace 'failed-disk' to 'raid-disk'
        replace '/dev/hdp1' to '/dev/hda1'
      16. rebuild the array:
        raidhotadd /dev/md0 /dev/hda1
      17. Run grub to make /dev/hda bootable, too:
        		#> grub --batch --no-floppy
        		grub> root (hd0,0)
        		grub> setup (hd0)
        		
  • How to change runlevel at boot time?
  • Promise RAID card with RedHat / Fedora Linux
  • Persistent connection using wvdial
    • Special config may needed for persistent connection using wvdial
      At /etc/sysconfig/network-scripts/ifcfg-pppX, removed all entries except the following:
      
      DEVICE=ppp2
      NAME=mobilcom
      WVDIALSECT=mobilcom
      MODEMPORT=/dev/ttyS0
      LINESPEED=115200
      PAPNAME=x
      USERCTL=true
      ONBOOT=no
      PERSIST=no
      
      modify /etc/wvdial.conf, set:
      Stupid mode = 1
      
  • Setup PPP Server
  • Steps to upgrade RedHat 8.0 MySQL from 3.23.xx to 4.0
    1. install MySQL-shared-compat (4.x)
    2. uninstall mysql-server (3.x)
    3. uninstall mysql (3.x)
    4. install MySQL-client (4.x)
    5. install MySQL-server (4.x)
Enterprise Volume Management System
Virtual Private Network (VPN)
IPSec PPTP
Troubleshooting
  • Fedora Core 4: Public key for autoconf-2.59-5.noarch.rpm is not installed:
    Retrieving GPG key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
    GPG key at file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora (0x4F2A6FD2) is already installed
    The GPG keys listed for the "Fedora Core 4 - i386 - Base" repository are already installed but they are not correct for this package.
    • Solution: install the GPG key by: rpm --import /usr/share/rhn/RPM-GPG-KEY
  • module-info and system.map
  • Fedora Core 1 on VMware installation problem (VMware Workstation internal monitor error)
  • HTML::Mason perl module in RedHat 8.0
  • Setup Perl CPAN
  • After installed a kernel RPM, grubby fatal error: unable to find a suitable template
  • There was an SSL error: [('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')]
  • "Call to undefined function: pg_connect()" in PHP script
    • Try to re-install the php-pgsql package with both latest php & postgresql installed
  • RPM hang when using 'rpm -e package-name'
    • This is an rpm bug. remove /var/lib/rpm/__db.*, then run rpm --rebuilddb (15mins on a P3 700Mhz machine)
  • Fedora Core 1 cannot use up2date due to Keyring error
  • RedHat 7.0 hangs at "Freeing unused kernel memory: "
    • glibc & glibc-common maybe installed with i686 binary, try to find a way to replace the system's glibc into i386 binary
    • Maybe due to glibc for Pentium Pro used
      ...RH 7.0 automatically installs glibc for a Pentium Pro or later if that cpu is present during install...?
    • Maybe turn off apm
      pass kernel parameter: apm=off (not work for me)




This page is last updated at: 2006-09-04 09:07pm +0800
Questions to ask me? You can give me a e-mail.

This website is built with TextPad. Viewing under Microsoft Internet Explorer 6.0 Service Pack 1.
Special Thanks to Alex Chan of AnimeNet for hosting my website!

© 2002-2008 Vincent W.S. Tam. All rights reserved.