tempwatch

程序写一些文件到tmp目录下,一段时间内没有被访问的文件会被自动清空,是利用了crontab + tmpwatch 来做的,Google之,

referencelink: http://www.360doc.com/content/11/0517/11/3947093_117376392.shtml

tmpwatch – removes files which haven’t been accessed for a period of time

-x, –exclude=path
Skip path; if path is a directory, all files contained in it are skipped too. If path does not exist, it must be an absolute
path that contains no symbolic linksdf

-x 参数来排除不需要被检查的目录

于是修改/etc/cron.daily/
/usr/sbin/tmpwatch -x /tmp/.X11-unix -x /tmp/.XIM-unix -x /tmp/.font-unix \
-x /tmp/.ICE-unix -x /tmp/.Test-unix -x /tmp/myholdingdir 240 /tmp

 

Installing Python2.6.7 On CentOS5

Source Link: http://www.hostucan.com/webmaster-tutorials/centos-python-2.6-install
Install Python 2.6 on CentOS 5

CentOS 5 is the most common Python hosting environment in the market, but the default version of python it is 2.4 now. As some projects request the python version to be greater than V2.5, in this article, you will see how to install python 2.6 by compiling source code step by step.

1. Download python source from python.org and Uncompress it.

$ wget http://www.python.org/ftp/python/2.6.7/Python-2.6.7.tgz
$ tar xzvf Python-2.6.7.tgz
2. Build & Install. In the source code folder:
$ ./configure –prefix=/opt/python2.6 –with-threads –enable-shared –with-zlib=/usr/include
$ make
$ make install
3. Add Python 2.6 lib to system lib. execute:
$ sudo ln -s /opt/python2.6/lib/libpython2.6.so /usr/lib
$ sudo ln -s /opt/python2.6/lib/libpython2.6.so.1.0 /usr/lib

# Create necessary links and cache
$ sudo /sbin/ldconfig -v

# make a symbolic link to python
$ sudo ln -s /opt/python2.6/bin/python /usr/local/python
4. Check python version use “python -V”. If you still see old version of Python, you need to edit /etc/profile (as root), add the following line:
pathmunge /opt/python2.6/bin/
Above setting should be added before the line like:
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
Then re-login system, try “python -V” again. 5. After install yum, try “yum search php” This is to make sure we did not accidentally mess up “yum”, which is the biggest threat when upgrading Python version. If you see no errors, you should be good to start using Python 2.6.

Update python-MySQLdb

http://blog.csdn.net/inte_sleeper/article/details/6556103

How To Build Linux Driver Into Booting img for PXE booting

How To Build Linux Driver Into Booting img for PXE booting

Written by: Libo.Ma
Created on July 28,2011

1. mkdir /tmp/testkernel/ # create testkernel package dir
2. gzip -cd /pxeist/tftpboot_centos54/initrd.img |cpio -ivd
3. cd modules; gzip -dc modules.cgz | cpio -ivd
4. cp /var/www/html/drivers/tg3.ko ./2.6.18-164.el5/x86_64 # Copy driver to kernel dir
5. modinfo -F alias 2.6.18-164.el5/x86_64/tg3.ko | sed -e ‘s/^/alias /’ -e ‘s/$/ tg3/’ >>modules.alias
6. find 2.6.18-164.el5 | cpio -o -H crc | gzip -9 > modules.cgz; rm -rf 2.6.18-164.el5
7. cd ..;find . | cpio -o -H newc | gzip -9 > /tmp/initrd.img
8. cd /pxeist/tftpboot_centos54/;
mv initrd.img bak_initrd.img
9. cp /tmp/initrd.img /pxeist/tftpboot_centos54/
10. OK

reference scripts:
#!/bin/sh

#This scripts is used to making kernel images for PXE BOOTING of linux
#installation.
#Created by Libo.ma @ July 26,2011
#
#

if [ ! -f $1 ]
then
echo “Usage: `basename $0` driver.ko”
exit 1
fi

FILE=$1

TKERNEL=/pxeist/tftpboot_centos54/testkernel
MODULES=/pxeist/tftpboot_centos54/testkernel/modules
FILE_NAME=$(basename $FILE)
FILE_ALIAS=${FILE_NAME%.*}
if [ -f $FILE ]
then
cp $FILE /var/www/html/drivers/2.6.18-164.el5/x86_64/ -rf
sed -i “/$FILE_ALIAS\$/d” $MODULES/modules.alias
modinfo -F alias 2.6.18-164.el5/x86_64/$FILE_NAME | sed -e “s/^/alias /” -e “s/$/ $FILE_ALIAS/” >> $MODULES/modules.alias
echo “Packag driver into modules.cgz”…
find 2.6.18-164.el5 | cpio -o -H crc | gzip -9 > $MODULES/modules.cgz
cd $TKERNEL
echo “Making kernel initrd.img…”
if find . | cpio -o -H newc | gzip -9 > /tmp/initrd.img;
then
echo “/tmp/initrd.img making successfully.”
else
echo “Failure.”
fi
fi

Refernece links:
http://lingho.com/mediawiki/index.php/Adding_driver_to_RHEL_PXE_initrd_file#Step_3_-_Add_or_replace_the_driver

Kickstart options notes

refer to :Fedora Kickstart Configration
Here is my Kickstart config file for general Centos Installation.

# Kickstart file automatically generated by anaconda.

install
url --url http://10.130.142.155/mirrors/centos5.4
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto static --ip 10.130.142.13 --netmask 255.255.255.0 --gateway 10.130.142.1 --nameserver 10.130.130.10,202.106.0.20 --hostname VIA-02
rootpw --iscrypted $1$Jd5lGnyJ$jcziaYiiCTqf4uWi8h4lc.
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc Asia/Chongqing
bootloader --location=mbr --driveorder=sda
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux --drives=sda
part /boot --fstype ext3 --size=100 --ondisk=sda
part pv.7 --size=0 --grow --ondisk=sda
volgroup VolGroup00 --pesize=32768 pv.7
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=40000
logvol /images --fstype ext3 --name=images.disk --vgname=VolGroup00 --size=60000
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1000 --grow --maxsize=5856

%packages
@admin-tools
@base
@core
@dns-server
@development-libs
@development-tools
@editors
@ftp-server
@network-server
@server-cfg
@text-internet
@xen
@web-server
keyutils
kexec-tools
iscsi-initiator-utils
trousers
bridge-utils
fipscheck
device-mapper-multipath
perl-XML-SAX
perl-XML-Twig
perl-XML-Dumper
perl-TimeDate
perl-libxml-perl
perl-Convert-ASN1
libstdc++44-devel
perl-XML-NamespaceSupport
perl-DateManip
perl-Crypt-SSLeay
perl-Mozilla-LDAP
perl-LDAP
perl-XML-Grove
python-imaging
perl-Archive-Zip
gcc44-c++
gcc44-gfortran
imake
gcc-objc
gcc-gnat
libgfortran44
gcc44
tftp
Virtualization-en-US
-gnome-applet-vm
%end

%pre
%end
%post
%end
reboot

significant Options explaination:

  • clearpart –all –drives=sda

    –all
    Erases all partitions from the system.

    –initlabel
    Initializes the disk label to the default for your architecture (for example msdos for x86 and gpt for Itanium). It is useful so that the installation program does not ask if it should initialize the disk label if installing to a brand new hard drive.

    –linux
    Erases all Linux partitions.
    –none (default)
    Do not remove any partitions.

  • firewall

    This option corresponds to the Firewall Configuration screen in the installation program:
    firewall –enabled|–disabled [options]

    –trust=
    Listing a device here, such as eth0, allows all traffic coming from that device to go through the firewall. To list more than one device, use –trust eth0 –trust eth1. Do NOT use a comma-separated format such as –trust eth0, eth1.

    Replace with none or more of the following to allow the specified services through the firewall.
    –ssh – The ssh option is enabled by default, regardless of the presence of this flag.
    –smtp
    –http
    –ftp
    –port=
    You can specify that ports be allowed through the firewall using the port:protocol format. You can also specify ports numerically. Multiple ports can be combined into one option as long as they are separeted by commas. For example:
    firewall –port=imap:tcp,1234:ucp,47
    –service=
    This option provides a higher-level way to allow services through the firewall. Some services (like cups, avahi, etc.) require multiple ports to be open in order for the service to work. You could specify each individual service with the –port option, or specify –service= and open them all at once. Valid options are anything recognized by the lokkit program in the system-config-firewall-base package

  • graphical

    Perform the kickstart installation in graphical mode. This is the default.

  • install

    Tells the system to install a fresh system rather than upgrade an existing system. This is the default mode. For installation, you must specify the type of installation from one of cdrom, harddrive, nfs, or url (for ftp or http installations). The install command and the installation method command must be on separate lines.
    cdrom
    Install from the first CD-ROM/DVD drive on the system.
    harddrive
    Install from a directory of ISO images on a local drive, which must be either vfat or ext2. In addition to this directory, you must also provide the install.img in some way. You can either do this by booting off the boot.iso or by creating an images/ directory in the same directory as the ISO images and placing install.img in there.
    –biospart=
    BIOS partition to install from (such as 82p2).
    –partition=
    Partition to install from (such as, sdb2).
    –dir=
    Directory containing both the ISO images and the images/install.img. For example:
    harddrive –partition=hdb2 –dir=/tmp/install-tree
    nfs
    Install from the NFS server specified. This can either be an exploded installation tree or a directory of ISO images. In the latter case, the install.img must also be provided subject to the same rules as with the harddrive installation method described above.
    –server=
    Server from which to install (hostname or IP).
    –dir=
    Directory containing the Packages/ directory of the installation tree. If doing an ISO install, this directory must also contain images/install.img.
    –opts=
    Mount options to use for mounting the NFS export. Any options that can be specified in /etc/fstab for an NFS mount are allowed. The options are listed in the nfs(5) man page. Multiple options are separated with a comma.
    For example:
    nfs –server=nfsserver.example.com –dir=/tmp/install-tree
    url
    Install from an installation tree on a remote server via FTP or HTTP.
    –url=
    The URL to install from.
    –proxy=[protocol://][username[:password]@]host[:port]
    Specify an HTTP/HTTPS/FTP proxy to use while performing the install. The various parts of the argument act like you would expect.
    –noverifyssl
    For a tree on a HTTPS server do not check the server’s certificate with what well-known CA validate and do not check the server’s hostname matches the certificate’s domain name.

  • logvol

    Create a logical volume for Logical Volume Management (LVM).
    logvol –vgname= –size= –name=

    –noformat
    Use an existing logical volume and do not format it.
    –useexisting
    Use an existing logical volume and reformat it.
    –fstype=
    Sets the file system type for the logical volume. Valid values include ext4, ext3, ext2, btrfs, swap, and vfat. Other filesystems may be valid depending on command line arguments passed to anaconda to enable other filesystems. Btrfs is a experimental filesystem. Do take regular backups if you are using it.
    –fsoptions=
    Specifies a free form string of options to be used when mounting the filesystem. This string will be copied into the /etc/fstab file of the installed system and should be enclosed in quotes.
    –grow
    Tells the logical volume to grow to fill available space (if any), or up to the maximum size setting. Note that –grow is not supported for logical volumes containing a RAID volume on top of them.
    –maxsize=
    The maximum size in megabytes when the logical volume is set to grow. Specify an integer value here, and do not append the number with MB.
    –recommended
    Determine the size of the logical volume automatically.
    –percent
    Specify the size of the logical volume as a percentage of available space in the volume group. Without the above –grow option, this may not work.
    –encrypted
    Specify that this logical volume should be encrypted.
    –passphrase=
    Specify the passphrase to use when encrypting this logical volume. Without the above –encrypted option, this option does nothing. If no passphrase is specified, the default system-wide one is used, or the installer will stop and prompt if there is no default.
    –escrowcert=
    Load an X.509 certificate from . Store the data encryption key of this logical volume, encrypted using the certificate, as a file in /root. Only relevant if –encrypted is specified as well.
    –backuppassphrase
    Only relevant if –escrowcert is specified as well. In addition to storing the data encryption key, generate a random passphrase and add it to this logical volume. Then store the passphrase, encrypted using the certificate specified by –escrowcert, as a file in /root. If more than one LUKS volume uses –backuppassphrase, the same passphrase will be used for all such volumes.
    Create the partition first, create the logical volume group, and then create the logical volume. For example:
    part pv.01 –size 3000
    volgroup myvg pv.01
    logvol / –vgname=myvg –size=2000 –name=rootvol

  • network

    Configures network information for target system and activates network devices in installer environment. Device of the first network command is activated if network is required, e.g. in case of network installation or using vnc. Activation of the device can be also explicitly required by –activate option. If the device has already been activated to get kickstart file (e.g. using configuration provided with boot options or entered in loader UI) it is re-activated with configuration from kickstart file.
    In F15, the device of first network command is activated also in case of non-network installs, and device is not re-activated using kickstart configuration.
    Additional devices configured in kickstart with network command can be activated in installer using –activate option (since F16).
    –bootproto=[dhcp|bootp|static|ibft]
    The default setting is dhcp. bootp and dhcp are treated the same.
    The DHCP method uses a DHCP server system to obtain its networking configuration. As you might guess, the BOOTP method is similar, requiring a BOOTP server to supply the networking configuration.
    The static method requires that you enter all the required networking information in the kickstart file. As the name implies, this information is static and will be used during and after the installation. The line for static networking is more complex, as you must include all network configuration information on one line. You must specify the IP address, netmask, gateway, and nameserver. For example: (the \ indicates that it is all one line):
    network –bootproto=static –ip=10.0.2.15 \
    –netmask=255.255.255.0 –gateway=10.0.2.254 \
    –nameserver=10.0.2.1
    If you use the static method, be aware of the following restriction:
    All static networking configuration information must be specified on one line; you cannot wrap lines using a backslash, for example.
    ibft setting is for reading the configuration from iBFT table. It was added in F16.
    –device=
    Specifies device to be configured and/or activated with the network command. The device can be specified in the same ways as ksdevice boot option. For example:
    network –bootproto=dhcp –device=eth0
    For the first network command, if the option is not specified it defaults to 1) ksdevice boot option, 2) device activated to fetch kickstart, or 3) selection dialog in UI. For following network commands, the –device option is required.
    –ip=
    IP address for the interface.
    –ipv6=
    IPv6 address for the interface. This can be the static address, “auto” for address assignment based on automatic neighbor discovery, or “dhcp” to use the DHCPv6 protocol.
    –gateway=
    Default gateway, as an IPv4 or IPv6 address.
    –nodefroute
    Prevents grabbing of the default route by the device. It can be useful when activating additional devices in installer using –activate option. Since F16.
    –nameserver=
    Primary nameserver, as an IP address. Multiple nameservers must be comma separated.
    –nodns
    Do not configure any DNS server.
    –netmask=
    Netmask for the installed system.
    –hostname=
    Hostname for the installed system.
    –ethtool=
    Specifies additional low-level settings for the network device which will be passed to the ethtool program.
    –essid=
    The network ID for wireless networks.
    –wepkey=
    The encryption key for wireless networks.
    –onboot=
    Whether or not to enable the device a boot time.
    –dhcpclass=
    The DHCP class.
    –mtu=
    The MTU of the device.
    –noipv4
    Disable IPv4 on this device.
    –noipv6
    Disable IPv6 on this device

  • selinux

    Sets the state of SELinux on the installed system. SELinux defaults to enforcing in anaconda.
    selinux [–disabled|–enforcing|–permissive]
    –disabled
    If this is present, SELinux is disabled.
    –enforcing
    If this is present, SELinux is set to enforcing mode.
    –permissive
    If this is present, SELinux is enabled, but only logs things that would be denied in enforcing mode

  • skipx
    If present, X is not configured on the installed system.
  • volgroup

    Use to create a Logical Volume Management (LVM) group.
    volgroup

    Name given to the volume group. The (which denotes that multiple partitions can be listed) lists the identifiers to add to the volume group.
    –noformat
    Use an existing volume group and do not format it.
    –useexisting
    Use an existing volume group and reformat it.
    –pesize=
    Set the size of the physical extents.
    Create the partition first, create the logical volume group, and then create the logical volume. For example:
    part pv.01 –size 3000
    volgroup myvg pv.01
    logvol / –vgname=myvg –size=2000 –name=rootvol

  • %packages

    refer to the repodata/*comps.xml file on the first CD-ROM for a list of groups.
    syntax:
    %packages
    @…
    @..
    @..
    %end

    PS: This may be handy if the kickstart file is used as a template and pulls in various other files with the %include mechanism.

  • Pre-installation Script

    This section must be at the end of the kickstart file (after the commands) and must start with the %pre command. You can access the network in the %pre section; however, name service has not been configured at this point, so only IP addresses will work.
    Preinstallation scripts are required to be closed with %end.

  • <2h2>post-install

    Examples

    Run a script named runme from an NFS share:
    %post
    mkdir /mnt/temp
    mount 10.10.0.2:/usr/new-machines /mnt/temp
    open -s -w — /mnt/temp/runme
    umount /mnt/temp
    %end
    Copy the file /etc/resolv.conf to the file system that was just installed:
    %post –nochroot
    cp /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
    %end

  • Creating a Kickstart Boot CD-ROM
    Installation Boot CD-ROM section in the Red Hat Enterprise Linux Installation Guide for instruction on creating a boot CD-ROM; however, before making the file.iso image file, copy the ks.cfg kickstart file to the isolinux/ directory.

CentOS yum repository management tools

CentOS yum repository management tool


    —- Search

  • 1. yum list package_name (simple search)
    yum list package_name* wildcard supported.
  • 2. yum search package_name (deep search)
  • 3. To do a search for any packages that provide php, you can use the following command
    yum provider php*
    —- Group

  • 1. yum grouplist
  • 2. yum groupinstall groupname

lighting XEN management README[ Updating in the progress…]

These set of scripts used to manage xen dom0s and domUs.

1. Struchture

1.1
File Structure:

DIRs:

bin: Control Center bin files.
plugin-bin: Dom0 Plugin-bin files
libs: System libiraries.
hvs_web_cgi: gathering info of instance & and show them via web server.

FILE:

iamges: standard.img

1.2 Control Introduction.

Control Center
———————————————-
dom0_control.py DOM0_NAME cmd…
domu_comtrol.py DOMU_NAME cmd…
———————————————–
dom0-1 dom0-2 dom0-…. dom0-20
————————————————
-domU1 . . . . . . . . . . .. . . . . . . . . .domUx

———————————————————–

2. Command introduction Client-Plugin

xen_create_instance : create instance on dom0s
xen_delete_instance : remove instance on dom0s
xen_getimg : download standard iamges for instance creation

3. See Also
/var/www/html/hvs
http://10.130.142.155/hvs/xenlist

The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server

The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server

文章分类:操作系统 关键字: nagios
The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server
解决方案,确定安装下面的包。
libgd2- libgd2-xpm-dev
libgd2-xpm
libgd-devel
libpng
libpng-devel
libjpeg
libjpeg-devel
zlib
zlib-devel
回到nagios安装时解压开的目录
Bash代码
#make devclean
#./configure –with-gd-lib=/usr/lib –with-gd-inc=/usr/include
#make all
#make install
#make install-init
#make install-config
#make install-commandmode
#make install-webconf