Linux: December 2010 Archives

NIS setup script for CentOS

user-pic
Vote 0 Votes

以下 Script 僅在 CentOS 5.5 x64 測試過, 其他 distro 可能需作調整
前幾行變數, 請調整成自己的環境

for Master NIS
NISDOMAIN=pank.org
MASTER=yp1.pank.org
SLAVE=yp2.pank.org
NETWORK=192.168.6.0
NETMASK=255.255.255.0
yum -y install portmap ypbind yp-tools ypserv
nisdomainname $NISDOMAIN
echo NISDOMAIN=$NISDOMAIN >> /etc/sysconfig/network
echo $NETMASK $NETWORK >> /var/yp/securenets
echo $SLAVE > /var/yp/ypservers
/etc/init.d/portmap start
/etc/init.d/ypserv start
/etc/init.d/yppasswdd start
/etc/init.d/ypxfrd start
/usr/lib64/yp/ypinit -m
cd /var/yp
make

for Slave NIS
NISDOMAIN=pank.org
MASTER=yp1.pank.org
SLAVE=yp2.pank.org
NETWORK=192.168.6.0
NETMASK=255.255.255.0
yum -y install portmap ypbind yp-tools ypserv
nisdomainname $NISDOMAIN
echo NISDOMAIN=$NISDOMAIN >> /etc/sysconfig/network
echo $NETMASK $NETWORK >> /var/yp/securenets
/etc/init.d/portmap start
/etc/init.d/ybind start
/etc/init.d/ypserv start
/etc/init.d/yppasswdd start
/etc/init.d/ypxfrd start
/usr/lib64/yp/ypinit -s $MASTER
/etc/init.d/ypserv restart

for NIS client
NISDOMAIN=pank.org
MASTER=yp1.pank.org
SLAVE=yp2.pank.org
yum -y ypbind
echo NISDOMAIN=$NISDOMAIN >> /etc/sysconfig/network
nisdomainname $NISDOMAIN
echo domain $NISDOMAIN >> /etc/yp.conf
echo ypserver $MASTER >> /etc/yp.conf
echo ypserver $SLAVE >> /etc/yp.conf
/etc/init.d/portmap restart
/etc/init.d/ypbind start

若要在 Client 端用 yppasswd 改密碼時立即 Update 資料
在 /usr/lib64/yp/pwupdate 最後加一行
/etc/init.d/ypserv restart > /dev/null

About this Archive

This page is an archive of entries in the Linux category from December 2010.

Linux: November 2010 is the previous archive.

Linux: February 2011 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Linux: Monthly Archives

Monthly Archives