备考
关于RHEL5上使用alternatives配置JAVA的使用说明
[
|
2009/06/02 22:28]
|
2009/06/02 22:28]
参考链接:
http://www.linuxsir.org/bbs/thread305424.html
首先说明一下alternatives是个什么东西?就是让你用来切换某个功能的组建开关。在具体点说:实现mta功能的东西可以使endmail,也可以是postfix,在以前的时候你只能按照一个,没有办法共存,而现在在RHEL里面可以让他们共存了,只需要改变实际软件的软链接的指向就可以了。而这个软链接指向是两次指向。首先指向/etc/alternatives/*里面,再由alternatives开关命令来修改,将链接指向实际的应用位置。而alternatives开关配置文件存在于/var/lib/alternatives/*
1:alternatives可控项目的配置文件位置(主要修改这里)
/var/lib/alternatives/
2:alternatives可控项目里面定义的链接指向(这里无需修改)
/etc/alternatives/
如下图:
/usr/bin/java ---> /etc/alternatives/java ----> 某个版本的JDK的/bin/java
案例1:
安装JRE,JDK使其成为alternatives的可控应用
1:下载JAVA,安装JRE,JDK
首先从http://java.sun.com/products/archive/选择相应的版本,我们这里1.4.2的最高版本1.4.2_19为例,包名如下:
j2re-1_4_2_19-linux-i586-rpm.bin
j2sdk-1_4_2_19-linux-i586-rpm.bin
安装方法:
A:以root身份执行以下操作:
首先将文件赋予可以执行权限
chmod 700 j2re-1_4_2_19-linux-i586-rpm.bin j2sdk-1_4_2_19-linux-i586-rpm.bin
B:执行bin软件包,读完sun的License声明,敲yes,就可以将其解压为rpm文件,对了,这个有自行校验功能。可以检查出解压缩的rpm的完整性。
./j2re-1_4_2_19-linux-i586-rpm.bin
./j2sdk-1_4_2_19-linux-i586-rpm.bin
C:在执行目录下面下,产生rpm文件如下:
j2re-1_4_2_19-linux-i586-rpm j2sdk-1_4_2_19-linux-i586-rpm
D:安装rpm包,这个简单吧。
rpm -ivh j2re-1_4_2_19-linux-i586-rpm j2sdk-1_4_2_19-linux-i586-rpm
2:配置/var/lib/alternatives/java文件
由于rhel5 update1默认安装了一个java,故原文件如下:
[root@kook alternatives]# pwd
/var/lib/alternatives
[root@kook alternatives]# cat java
auto
/usr/bin/java
jre
/usr/lib/jvm/jre
jre_exports
/usr/lib/jvm-exports/jre
keytool
/usr/bin/keytool
rmiregistry
/usr/bin/rmiregistry
/usr/lib/jvm/jre-1.4.2-gcj/bin/java
1420
/usr/lib/jvm/jre-1.4.2-gcj
/usr/lib/jvm-exports/jre-1.4.2-gcj
/usr/lib/jvm/jre-1.4.2-gcj/bin/keytool
/usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
修改后的文件如下:
我做一下分割线吧。结构挺清楚的,对了,数字越大优先级越高。我的数字瞎写的。
还有我这里jre和jdk都是一个版本挺没有必要的。就是为了写两段而已。
auto
/usr/bin/java
jre
/usr/lib/jvm/jre
jre_exports
/usr/lib/jvm-exports/jre
keytool
/usr/bin/keytool
rmiregistry
/usr/bin/rmiregistry
/usr/lib/jvm/jre-1.4.2-gcj/bin/java
1420
/usr/lib/jvm/jre-1.4.2-gcj
/usr/lib/jvm-exports/jre-1.4.2-gcj
/usr/lib/jvm/jre-1.4.2-gcj/bin/keytool
/usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
+++++++++++++++使用时,请去掉分割线+++++++++++++++++
/usr/java/j2re1.4.2_19/bin/java
1500
/usr/java/j2re1.4.2_19
/usr/java/j2re1.4.2_19/lib
/usr/java/j2re1.4.2_19/bin/keytool
/usr/java/j2re1.4.2_19/bin/rmiregistry
+++++++++++++++使用时,请去掉分割线+++++++++++++++++
/usr/java/j2sdk1.4.2_19/bin/java
1600
/usr/java/j2sdk1.4.2_19/jre
/usr/java/j2sdk1.4.2_19/lib
/usr/java/j2sdk1.4.2_19/bin/keytool
/usr/java/j2sdk1.4.2_19/bin/rmiregistry
+++++++++++++++使用时,请去掉分割线+++++++++++++++++
3:使用alternatives来配置新安装的JDK版本
[root@kook alternatives]# alternatives --config java
共有 3 个程序提供“java”。
选择 命令
-----------------------------------------------
+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /usr/java/j2re1.4.2_19/bin/java
* 3 /usr/java/j2sdk1.4.2_19/bin/java
按 Enter 来保存当前选择[+],或键入选择号码:2
最后查看一下版本:
[root@kook ~]# java -version
java version "1.4.2_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)
Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)
如上*号代表优先级最高的程序,+号代表当前使用的程序。我选择了2。
请自己尝试一下吧。
http://www.linuxsir.org/bbs/thread305424.html
首先说明一下alternatives是个什么东西?就是让你用来切换某个功能的组建开关。在具体点说:实现mta功能的东西可以使endmail,也可以是postfix,在以前的时候你只能按照一个,没有办法共存,而现在在RHEL里面可以让他们共存了,只需要改变实际软件的软链接的指向就可以了。而这个软链接指向是两次指向。首先指向/etc/alternatives/*里面,再由alternatives开关命令来修改,将链接指向实际的应用位置。而alternatives开关配置文件存在于/var/lib/alternatives/*
1:alternatives可控项目的配置文件位置(主要修改这里)
/var/lib/alternatives/
2:alternatives可控项目里面定义的链接指向(这里无需修改)
/etc/alternatives/
如下图:
/usr/bin/java ---> /etc/alternatives/java ----> 某个版本的JDK的/bin/java
案例1:
安装JRE,JDK使其成为alternatives的可控应用
1:下载JAVA,安装JRE,JDK
首先从http://java.sun.com/products/archive/选择相应的版本,我们这里1.4.2的最高版本1.4.2_19为例,包名如下:
j2re-1_4_2_19-linux-i586-rpm.bin
j2sdk-1_4_2_19-linux-i586-rpm.bin
安装方法:
A:以root身份执行以下操作:
首先将文件赋予可以执行权限
chmod 700 j2re-1_4_2_19-linux-i586-rpm.bin j2sdk-1_4_2_19-linux-i586-rpm.bin
B:执行bin软件包,读完sun的License声明,敲yes,就可以将其解压为rpm文件,对了,这个有自行校验功能。可以检查出解压缩的rpm的完整性。
./j2re-1_4_2_19-linux-i586-rpm.bin
./j2sdk-1_4_2_19-linux-i586-rpm.bin
C:在执行目录下面下,产生rpm文件如下:
j2re-1_4_2_19-linux-i586-rpm j2sdk-1_4_2_19-linux-i586-rpm
D:安装rpm包,这个简单吧。
rpm -ivh j2re-1_4_2_19-linux-i586-rpm j2sdk-1_4_2_19-linux-i586-rpm
2:配置/var/lib/alternatives/java文件
引用
由于rhel5 update1默认安装了一个java,故原文件如下:
[root@kook alternatives]# pwd
/var/lib/alternatives
[root@kook alternatives]# cat java
auto
/usr/bin/java
jre
/usr/lib/jvm/jre
jre_exports
/usr/lib/jvm-exports/jre
keytool
/usr/bin/keytool
rmiregistry
/usr/bin/rmiregistry
/usr/lib/jvm/jre-1.4.2-gcj/bin/java
1420
/usr/lib/jvm/jre-1.4.2-gcj
/usr/lib/jvm-exports/jre-1.4.2-gcj
/usr/lib/jvm/jre-1.4.2-gcj/bin/keytool
/usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
修改后的文件如下:
我做一下分割线吧。结构挺清楚的,对了,数字越大优先级越高。我的数字瞎写的。
还有我这里jre和jdk都是一个版本挺没有必要的。就是为了写两段而已。
auto
/usr/bin/java
jre
/usr/lib/jvm/jre
jre_exports
/usr/lib/jvm-exports/jre
keytool
/usr/bin/keytool
rmiregistry
/usr/bin/rmiregistry
/usr/lib/jvm/jre-1.4.2-gcj/bin/java
1420
/usr/lib/jvm/jre-1.4.2-gcj
/usr/lib/jvm-exports/jre-1.4.2-gcj
/usr/lib/jvm/jre-1.4.2-gcj/bin/keytool
/usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
+++++++++++++++使用时,请去掉分割线+++++++++++++++++
/usr/java/j2re1.4.2_19/bin/java
1500
/usr/java/j2re1.4.2_19
/usr/java/j2re1.4.2_19/lib
/usr/java/j2re1.4.2_19/bin/keytool
/usr/java/j2re1.4.2_19/bin/rmiregistry
+++++++++++++++使用时,请去掉分割线+++++++++++++++++
/usr/java/j2sdk1.4.2_19/bin/java
1600
/usr/java/j2sdk1.4.2_19/jre
/usr/java/j2sdk1.4.2_19/lib
/usr/java/j2sdk1.4.2_19/bin/keytool
/usr/java/j2sdk1.4.2_19/bin/rmiregistry
+++++++++++++++使用时,请去掉分割线+++++++++++++++++
3:使用alternatives来配置新安装的JDK版本
[root@kook alternatives]# alternatives --config java
共有 3 个程序提供“java”。
选择 命令
-----------------------------------------------
+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /usr/java/j2re1.4.2_19/bin/java
* 3 /usr/java/j2sdk1.4.2_19/bin/java
按 Enter 来保存当前选择[+],或键入选择号码:2
最后查看一下版本:
[root@kook ~]# java -version
java version "1.4.2_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)
Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)
如上*号代表优先级最高的程序,+号代表当前使用的程序。我选择了2。
请自己尝试一下吧。
奥运开幕当天8月8日报名,8月15日考试,RHCE终于Pass了。
[
|
2008/08/20 10:18]
|
2008/08/20 10:18]
从去年十一培训报考RHCE,到现在已经10个月之久了,拖了这么久真是自己也烦的不行了。幸好奥运到了,工作突然变得很闲。所有的生产环境都无法进场维护了。正好可以复习一下考试了。呵呵。于是就考了。挑了个吉利的日子,8月8日,没想到15号就考了,只有6天的准备时间了。很好,终于可以了结它了。哈哈!
经历了上午2个半小时,下午3个小时,终于完成了考试。上午的考试很顺利,考完之后自己的成绩也就清楚了。下午的时间很匆忙,从装系统,到完成所有的服务,每个服务下面还有三四个要求需要满足。还是试验做的不熟啊!我自己基本上都没有什么时间做一次整体检查了。所幸是有惊无险的,完成了考试并且Pass了。
1:请先参考一下台湾的胡尚忠老师的RHCE的考试指南吧(下载那个PDF):
http://tw.myblog.yahoo.com/lin-lange/article?mid=956&prev=957&next=-1
2:另外就是考试大纲:
http://www.redhat.com.cn/training/examprep.php
3:再就是RedHat给你的培训教材了。
几个关心的问题:
1:考试全程开SElinux
2:iptables无限制,也就是说iptables用不用,随你。
奉劝考试的各位同学,多做试验,做到熟练,不要想有man的时间,那样你的时间会不够,心里会很没有底。还有考试决对没有想象的那么难。其实东西很基础。最后祝各位好运。

经历了上午2个半小时,下午3个小时,终于完成了考试。上午的考试很顺利,考完之后自己的成绩也就清楚了。下午的时间很匆忙,从装系统,到完成所有的服务,每个服务下面还有三四个要求需要满足。还是试验做的不熟啊!我自己基本上都没有什么时间做一次整体检查了。所幸是有惊无险的,完成了考试并且Pass了。
引用
1:请先参考一下台湾的胡尚忠老师的RHCE的考试指南吧(下载那个PDF):
http://tw.myblog.yahoo.com/lin-lange/article?mid=956&prev=957&next=-1
2:另外就是考试大纲:
http://www.redhat.com.cn/training/examprep.php
3:再就是RedHat给你的培训教材了。
几个关心的问题:
1:考试全程开SElinux
2:iptables无限制,也就是说iptables用不用,随你。
奉劝考试的各位同学,多做试验,做到熟练,不要想有man的时间,那样你的时间会不够,心里会很没有底。还有考试决对没有想象的那么难。其实东西很基础。最后祝各位好运。

RHEL5下双网卡bonding做法
[
|
2008/07/14 22:08]
|
2008/07/14 22:08]
参考:
/usr/share/doc/kernel-doc-2.6.18/Documentation/networking/bonding.txt
将eth1和eth2做bonding为bond0
1:修改/etc/modprobe.conf,添加如下:
[root@ha01 network-scripts]# tail -2 /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=1
关于mode见本文最下面。
2:在/etc/sysconfig/network-scripts/下创建ifcfg-bond0,ifcfg-eth1,ifcfg-eth2
[root@ha01 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=192.168.137.0
NETMASK=255.255.255.0
IPADDR=192.168.137.9
USERCTL=no
GATEWAY=
TYPE=Ethernet
[root@ha01 network-scripts]# cat ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=yes
[root@ha01 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=yes
关于mode的部分
mode
Specifies one of the bonding policies. The default is
balance-rr (round robin). Possible values are:
balance-rr or 0
Round-robin policy: Transmit packets in sequential
order from the first available slave through the
last. This mode provides load balancing and fault
tolerance.
active-backup or 1
Active-backup policy: Only one slave in the bond is
active. A different slave becomes active if, and only
if, the active slave fails. The bond's MAC address is
externally visible on only one port (network adapter)
to avoid confusing the switch.
In bonding version 2.6.2 or later, when a failover
occurs in active-backup mode, bonding will issue one
or more gratuitous ARPs on the newly active slave.
One gratuitous ARP is issued for the bonding master
interface and each VLAN interfaces configured above
it, provided that the interface has at least one IP
address configured. Gratuitous ARPs issued for VLAN
interfaces are tagged with the appropriate VLAN id.
This mode provides fault tolerance. The primary
option, documented below, affects the behavior of this
mode.
balance-xor or 2
XOR policy: Transmit based on the selected transmit
hash policy. The default policy is a simple [(source
MAC address XOR'd with destination MAC address) modulo
slave count]. Alternate transmit policies may be
selected via the xmit_hash_policy option, described
below.
This mode provides load balancing and fault tolerance.
broadcast or 3
Broadcast policy: transmits everything on all slave
interfaces. This mode provides fault tolerance.
802.3ad or 4
IEEE 802.3ad Dynamic link aggregation. Creates
aggregation groups that share the same speed and
duplex settings. Utilizes all slaves in the active
aggregator according to the 802.3ad specification.
Slave selection for outgoing traffic is done according
to the transmit hash policy, which may be changed from
the default simple XOR policy via the xmit_hash_policy
option, documented below. Note that not all transmit
policies may be 802.3ad compliant, particularly in
regards to the packet mis-ordering requirements of
section 43.2.4 of the 802.3ad standard. Differing
peer implementations will have varying tolerances for
noncompliance.
Prerequisites:
1. Ethtool support in the base drivers for retrieving
the speed and duplex of each slave.
2. A switch that supports IEEE 802.3ad Dynamic link
aggregation.
Most switches will require some type of configuration
to enable 802.3ad mode.
balance-tlb or 5
Adaptive transmit load balancing: channel bonding that
does not require any special switch support. The
outgoing traffic is distributed according to the
current load (computed relative to the speed) on each
slave. Incoming traffic is received by the current
slave. If the receiving slave fails, another slave
takes over the MAC address of the failed receiving
slave.
Prerequisite:
Ethtool support in the base drivers for retrieving the
speed of each slave.
balance-alb or 6
Adaptive load balancing: includes balance-tlb plus
receive load balancing (rlb) for IPV4 traffic, and
does not require any special switch support. The
receive load balancing is achieved by ARP negotiation.
The bonding driver intercepts the ARP Replies sent by
the local system on their way out and overwrites the
source hardware address with the unique hardware
address of one of the slaves in the bond such that
different peers use different hardware addresses for
the server.
Receive traffic from connections created by the server
is also balanced. When the local system sends an ARP
Request the bonding driver copies and saves the peer's
IP information from the ARP packet. When the ARP
Reply arrives from the peer, its hardware address is
retrieved and the bonding driver initiates an ARP
reply to this peer assigning it to one of the slaves
in the bond. A problematic outcome of using ARP
negotiation for balancing is that each time that an
ARP request is broadcast it uses the hardware address
of the bond. Hence, peers learn the hardware address
of the bond and the balancing of receive traffic
collapses to the current slave. This is handled by
sending updates (ARP Replies) to all the peers with
their individually assigned hardware address such that
the traffic is redistributed. Receive traffic is also
redistributed when a new slave is added to the bond
and when an inactive slave is re-activated. The
receive load is distributed sequentially (round robin)
among the group of highest speed slaves in the bond.
When a link is reconnected or a new slave joins the
bond the receive traffic is redistributed among all
active slaves in the bond by initiating ARP Replies
with the selected MAC address to each of the
clients. The updelay parameter (detailed below) must
be set to a value equal or greater than the switch's
forwarding delay so that the ARP Replies sent to the
peers will not be blocked by the switch.
Prerequisites:
1. Ethtool support in the base drivers for retrieving
the speed of each slave.
2. Base driver support for setting the hardware
address of a device while it is open. This is
required so that there will always be one slave in the
team using the bond hardware address (the
curr_active_slave) while having a unique hardware
address for each slave in the bond. If the
curr_active_slave fails its hardware address is
swapped with the new curr_active_slave that was
chosen.
/usr/share/doc/kernel-doc-2.6.18/Documentation/networking/bonding.txt
将eth1和eth2做bonding为bond0
1:修改/etc/modprobe.conf,添加如下:
[root@ha01 network-scripts]# tail -2 /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=1
关于mode见本文最下面。
2:在/etc/sysconfig/network-scripts/下创建ifcfg-bond0,ifcfg-eth1,ifcfg-eth2
[root@ha01 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=192.168.137.0
NETMASK=255.255.255.0
IPADDR=192.168.137.9
USERCTL=no
GATEWAY=
TYPE=Ethernet
[root@ha01 network-scripts]# cat ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=yes
[root@ha01 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=yes
关于mode的部分
mode
Specifies one of the bonding policies. The default is
balance-rr (round robin). Possible values are:
balance-rr or 0
Round-robin policy: Transmit packets in sequential
order from the first available slave through the
last. This mode provides load balancing and fault
tolerance.
active-backup or 1
Active-backup policy: Only one slave in the bond is
active. A different slave becomes active if, and only
if, the active slave fails. The bond's MAC address is
externally visible on only one port (network adapter)
to avoid confusing the switch.
In bonding version 2.6.2 or later, when a failover
occurs in active-backup mode, bonding will issue one
or more gratuitous ARPs on the newly active slave.
One gratuitous ARP is issued for the bonding master
interface and each VLAN interfaces configured above
it, provided that the interface has at least one IP
address configured. Gratuitous ARPs issued for VLAN
interfaces are tagged with the appropriate VLAN id.
This mode provides fault tolerance. The primary
option, documented below, affects the behavior of this
mode.
balance-xor or 2
XOR policy: Transmit based on the selected transmit
hash policy. The default policy is a simple [(source
MAC address XOR'd with destination MAC address) modulo
slave count]. Alternate transmit policies may be
selected via the xmit_hash_policy option, described
below.
This mode provides load balancing and fault tolerance.
broadcast or 3
Broadcast policy: transmits everything on all slave
interfaces. This mode provides fault tolerance.
802.3ad or 4
IEEE 802.3ad Dynamic link aggregation. Creates
aggregation groups that share the same speed and
duplex settings. Utilizes all slaves in the active
aggregator according to the 802.3ad specification.
Slave selection for outgoing traffic is done according
to the transmit hash policy, which may be changed from
the default simple XOR policy via the xmit_hash_policy
option, documented below. Note that not all transmit
policies may be 802.3ad compliant, particularly in
regards to the packet mis-ordering requirements of
section 43.2.4 of the 802.3ad standard. Differing
peer implementations will have varying tolerances for
noncompliance.
Prerequisites:
1. Ethtool support in the base drivers for retrieving
the speed and duplex of each slave.
2. A switch that supports IEEE 802.3ad Dynamic link
aggregation.
Most switches will require some type of configuration
to enable 802.3ad mode.
balance-tlb or 5
Adaptive transmit load balancing: channel bonding that
does not require any special switch support. The
outgoing traffic is distributed according to the
current load (computed relative to the speed) on each
slave. Incoming traffic is received by the current
slave. If the receiving slave fails, another slave
takes over the MAC address of the failed receiving
slave.
Prerequisite:
Ethtool support in the base drivers for retrieving the
speed of each slave.
balance-alb or 6
Adaptive load balancing: includes balance-tlb plus
receive load balancing (rlb) for IPV4 traffic, and
does not require any special switch support. The
receive load balancing is achieved by ARP negotiation.
The bonding driver intercepts the ARP Replies sent by
the local system on their way out and overwrites the
source hardware address with the unique hardware
address of one of the slaves in the bond such that
different peers use different hardware addresses for
the server.
Receive traffic from connections created by the server
is also balanced. When the local system sends an ARP
Request the bonding driver copies and saves the peer's
IP information from the ARP packet. When the ARP
Reply arrives from the peer, its hardware address is
retrieved and the bonding driver initiates an ARP
reply to this peer assigning it to one of the slaves
in the bond. A problematic outcome of using ARP
negotiation for balancing is that each time that an
ARP request is broadcast it uses the hardware address
of the bond. Hence, peers learn the hardware address
of the bond and the balancing of receive traffic
collapses to the current slave. This is handled by
sending updates (ARP Replies) to all the peers with
their individually assigned hardware address such that
the traffic is redistributed. Receive traffic is also
redistributed when a new slave is added to the bond
and when an inactive slave is re-activated. The
receive load is distributed sequentially (round robin)
among the group of highest speed slaves in the bond.
When a link is reconnected or a new slave joins the
bond the receive traffic is redistributed among all
active slaves in the bond by initiating ARP Replies
with the selected MAC address to each of the
clients. The updelay parameter (detailed below) must
be set to a value equal or greater than the switch's
forwarding delay so that the ARP Replies sent to the
peers will not be blocked by the switch.
Prerequisites:
1. Ethtool support in the base drivers for retrieving
the speed of each slave.
2. Base driver support for setting the hardware
address of a device while it is open. This is
required so that there will always be one slave in the
team using the bond hardware address (the
curr_active_slave) while having a unique hardware
address for each slave in the bond. If the
curr_active_slave fails its hardware address is
swapped with the new curr_active_slave that was
chosen.
Redhat下chkconfig添加启动脚本的方法。
[
|
2008/06/23 13:07]
|
2008/06/23 13:07]
#!/bin/bash
# chkconfig: 35 99 05
# description: Test chkconfig
# file: /etc/init.d/foo
env > /tmp/ENVLOG
最上面三行都是必须的。第四行非必须的。
否则报错如下:
[root@kook init.d]# chkconfig --add foo
foo 服务不支持 chkconfig
[root@kook init.d]# chkconfig --add foo
service foo does not support chkconfig
解释一下chkconfig: 35 99 05
35:就是在哪种runlevel下启动。
99:在rc3.d和rc5.d下产生S99foo
05:在rc0.d、rc1.d、rc2.d、rc4.d、rc6.d下产生K05foo
S代表Start
K代表Kill
上面的对于SuSE不适用。SuSE下可以用chkconfig来添加,但是无法控制启动和关闭顺序,只能手工软链接来处理启动顺序。
SuSE会自己搞一个启动数字,不知道这个是怎么一个规律。
关于Apache中目录访问控制的Allow,Deny的一些情况。
[
|
2008/03/19 17:24]
|
2008/03/19 17:24]
正常定义下:
<Directory "/var/www/html">
Order allow,deny
Allow from all
</Directory>
未定义全:
<Directory "/var/www/html">
Order allow,deny
</Directory>
未定义Allow,结果全部deny
<Directory "/var/www/html">
Order deny,allow
</Directory>
未定义Deny,结果全部allow
以下四种情况:
<Directory "/var/www/html">
Order allow,deny
Deny from .kook.com
</Directory>
全部Deny,定义的那个kook.com无意义。
<Directory "/var/www/html">
Order deny,allow
Allow from .kook.com
</Directory>
全部Allow,定义的那个kook.com无意义。
<Directory "/var/www/html">
Order deny,allow
Deny from .kook.com
</Directory>
定义生效,除了kook.com其他的域都可以访问。
<Directory "/var/www/html">
Order allow,deny
Allow from .kook.com
</Directory>
定义生效,除了kook.com其他的域都不可以访问。
<Directory "/var/www/html">
Order allow,deny
Allow from all
</Directory>
未定义全:
<Directory "/var/www/html">
Order allow,deny
</Directory>
未定义Allow,结果全部deny
<Directory "/var/www/html">
Order deny,allow
</Directory>
未定义Deny,结果全部allow
以下四种情况:
<Directory "/var/www/html">
Order allow,deny
Deny from .kook.com
</Directory>
全部Deny,定义的那个kook.com无意义。
<Directory "/var/www/html">
Order deny,allow
Allow from .kook.com
</Directory>
全部Allow,定义的那个kook.com无意义。
<Directory "/var/www/html">
Order deny,allow
Deny from .kook.com
</Directory>
定义生效,除了kook.com其他的域都可以访问。
<Directory "/var/www/html">
Order allow,deny
Allow from .kook.com
</Directory>
定义生效,除了kook.com其他的域都不可以访问。




