(一)配置前的準備工作
1、配ip地址(略)
2、設置hosts文件
#vim /etc/hosts
添加如下內容
192.168.1.15 linux.yichunlan99.com
3、關閉防火牆及selinux(略)
4、設置yum源(略)
--------------------------------------------------------------------------------------------------
(二)安裝客戶端軟件ypbind以及yp-tools(默認已安裝)
#yum install ypbind -y
#yum install yp-tools -y
--------------------------------------------------------------------------------------------------
(三)設置nis域名
#domainname yichunlan99
#vim /etc/sysconfig/network
添加如下內容
NISDOMAIN=yichunlan99
--------------------------------------------------------------------------------------------------
(四)配置nis客戶端
方法一、修改/etc/yp.conf文件
設置爲
domain yichunlan99 server linux.yichunlan99.com
或者爲
domain yichunlan99 broadcast
或者爲
ypserver linux.yichunlan99.com
或者爲
broadcast
方法二、使用system-config-authentication圖形界面設置
方法三、使用authconfig設置
authconfig --enablenis --nisdomain yichunlan99 --nisserver linux.yichunlan99.com --updateall
--------------------------------------------------------------------------------------------------
(五)啓動ypbind服務
#service ypbind start
#chkconfig ypbind on
--------------------------------------------------------------------------------------------------
(六)測試
#yptest
如果沒有報錯,說明nis已經正常運行
(七)設置nsswitch配置文件,使客戶端能解析nis
#vim /etc/nsswitch.conf
修改如下內容
passwd: files nis
shadow: files nis
group: files nis
--------------------------------------------------------------------------------------------------
(八)設置nis的宿主目錄
由於使用的使nis賬戶進行登錄系統,所以在本機並沒有該賬戶的宿主目錄。我們可以通過在nis服務器上設置nfs,共享nis的/home目錄,並在客戶端掛載來解決這個問題
1、在nis服務器進行如下設置
(1)#vim /etc/exports
添加如下內容
/home *(sync,rw)
(_2)啓動nfs服務
#service nfs start
#chkconfig nfs on
2、在客戶端進行如下設置
#mount -t nfs 192.168.1.15:/home /home
#vim /etc/fstab
添加如下內容
192.168.1.15:/home /home nfs defaults 0 0
--------------------------------------------------------------------------------------------------
至此,你就可以通過nis用戶登錄改局域網內的任意nis客戶端了