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

Leave a comment

About this Entry

This page contains a single entry by Pank published on December 12, 2010 1:30 AM.

Date calculate in script was the previous entry in this blog.

Using VLC to Send/Receive Multicast is the next entry in this blog.

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

Monthly Archives