**NIS+NFS Service** === **[NIS]** --- **HOST List** vi /etc/hosts ``` 10.7.129.52 h2-login01 10.7.129.53 h2-login02 10.7.129.54 h2-nfs 10.7.129.55 h2-slurm01 10.7.129.56 h2-slurm02 10.7.129.57 h2-cn01 10.7.129.58 h2-cn02 10.7.129.59 h2-cn03 10.7.129.60 h2-mgmt 10.7.129.61 h2-mds01 10.7.129.62 h2-ss01 10.7.129.63 h2-ss02 ``` **安裝服務** ``` yum install -y yp* rpcbind ``` **配置網路** ``` vi /etc/sysconfig/network NETWORKING=yes NISDOMAIN=hpcdemo #配置域名 YPSERV_ARGS="-p 1011" #固定端口 ``` **yppasswdd配置** ``` vi /etc/sysconfig/yppasswdd YPPASSWDD_ARGS="--port 1012" #固定端口 ``` **ypserv.conf 配置** ``` vi /etc/ypserv.conf # Host : Domain : Map : Security # # * : * : passwd.byname : port # * : * : passwd.byuid : port * : * : * : none ``` **啟動服務** ``` systemctl restart network systemctl start ypserv rpcbind yppasswdd.service systemctl enable ypserv rpcbind yppasswdd.service ``` **檢查是否運行** ``` rpcinfo -p localhost * #*要查的服務 ``` **帳號資料庫(Master)** ``` /usr/lib64/yp/ypinit -m #建立資料庫 cd /var/yp/;make #更新資料庫 systemctl restart ypserv #重啟資料庫 ``` **帳號資料庫(Slave)** ``` /usr/lib64/yp/ypinit -s h2-login01 #建立資料庫 cd /var/yp/;make #更新資料庫 systemctl restart ypserv #重啟資料庫 ``` **[NFS]** --- **1.安裝服務** ``` yum -y install nfs-utils rpcbind ``` **2.配置NFS** ``` vi /etc/exports /data/nfs *(rw,sync,no_root_squash) #配置說明: /data/nfs:是共享的數據目錄 #*:表示任何人都有權限連接,當然也可以是一個網段,一個 IP,也可以是域名 #rw:讀寫的權限 #sync:表示文件同時寫入硬盤和內存 #no_root_squash:當登錄 NFS 主機使用共享目錄的使用者是 root 時,其權限將被轉換成為匿名使用者,通常它的 UID 與 GID,都會變成 nobody 身份 ``` **3.啟動服務** ``` systemctl enable rpcbind.service nfs.service systemctl start rpcbind.service nfs.service ``` **4.檢查是否運行** ``` rpcinfo -p cat /var/lib/nfs/etab #查NFS目錄設定 ``` **[NIS Client]** --- **1.安裝服務** ``` yum install -y ypbind yp-tools -y ``` **2.配置域名** ``` vi /etc/sysconfig/network ``` 和server配置一樣 ``` NETWORKING=yes NISDOMAIN=hpcdemo #配置域名 YPSERV_ARGS="-p 1011" #固定端口 ``` **3.自動配置更新** ``` authconfig --enablenis --nisdomain=hpcdemo --nisserver=h2-login01 --update ``` **4.重啟服務** ``` systemctl restart ypbind rpcbind ``` **5.測試** ``` yptest #確認是否同步 ``` **[NFS Client]** --- **1.安裝服務** ``` yum -y install nfs-utils ``` **2.掛載** ``` #立即掛載 mount -t nfs h2-nfs:/home /home mkdir /var/spool/slurm mount -t nfs h2-nfs:/var/spool/slurm /var/spool/slurm mount.nfs h2-nfs:/opt /opt #開機掛載 vi /etc/fstab h2-nfs:/home /home nfs defaults 0 0 h2-nfs:/var/spool/slurm /var/spool/slurm nfs defaults 0 0 h2-nfs:/opt /opt nfs defaults 0 0 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up