nis安裝
1首先確認關閉iptables
# /etc/init.d/iptables stop
# chkconfig iptables off
[@more@]2安裝ypbind包,確認你聯網執行下面的命令
# yum install -y ypserv ypbind portmap yp-tools
3修改/etx/sysconfig/network加入以下配置
NISDOMAIN="nis-cmdi.com"
4 修改/etc/yp.conf加入下面的設定
ypserv 192.168.1.212
在配置檔案 /etc/hosts 中新增 NIS 伺服器的記錄
192.168.1.212 nis-cmdi.com
修改/etc/ypserv.conf
把最後一行的註釋去掉,也就是說通配所有的主機,加入所有的域,map所有的東西,none是表示沒有安全性,這一項其實是個安全選項,可以透過這個控制許可權
* : * : * : none
為了安全,你可以這樣寫:
127.0.0.0/255.255.255.0 : * : * : none
192.168.1.0/255.255.255.0 : * : * : none
* : * : * : deny
5 接下來執行下面的命令
# /etc/init.d/portmap start
# /etc/init.d/yppasswdd start
# /etc/init.d/ypserv start
# chkconfig portmap on
# chkconfig yppasswdd on
# chkconfig ypserv on
6 修改/var/yp/Makefile將
all: passwd group hosts rpc services netid protocols mail
修改為
all: passwd group hosts rpc services netid protocols mail auto.master auto.home
7 接下來新增我們需要的使用者
#groupadd system
# useradd -g system -u 601 -d /home/rhome/liyi liyi
# useradd -g system -u 601 -d /home/rhome/lier lier
#passwd liyi
#passwd lier
8 接下來,執行:
# /usr/lib/yp/ypinit -m
按下Ctrl-D和回答Y執行下一步操作
# cd /var/yp
# make
(以上兩步為初始化資料庫)
9 現在執行
authconfig --update --enablenis
如果這步出現問題,請重新執行上面步驟8
11 如果9順利透過,現在執行下面的命令,並可以看到使用者口令表
# getent passwd
透過NFS共享/home/rhome目錄
1 首先禁用SeLinux,修改/etc/sysconfig/selinux
SELINUX=disabled
重啟伺服器
2 修改/etc/exports加入
/home/rhome 192.168.1.0/24(async,rw,no_root_squash)
3 然後重啟NFS
# /etc/init.d/nfs restart
4 現在在本機執行exportfs命令,應該可以看到下面的輸出
/home/rhome
如果執行完以上步驟一切正常,那麼NIS伺服器的NFS就配置好了
客戶端的配置
1 在客戶端上安裝ypbind軟體包
# yum install -y ypbind yp-tools
2 執行system-config-authentication.選擇Enable NIS然後點Configure按照我們剛才的設定填入NIS 域和NIS伺服器的地址然後點OK確定,並退出
3 現在在客戶端執行
getent passwd
應該可以輸出伺服器上的口令表
4 修改/etc/auto.master,註釋掉所有以前的配置,加入
/home/rhome /etc/auto.home
6 建立/etc/auto.home檔案,加入
* -rw,soft,intr 192.168.1.212:/home/rhome/&
8 重啟ypbind服務
# /etc/init.d/ypbind restart
# chkconfig ypbind on
9重啟autofs
# /etc/init.d/autofs restart
# chkconfig autofs on
到此,應該可以用伺服器上使用者名稱和密碼登入客戶端的系統了
如果在NIS伺服器上又增加了新的虛擬賬號,只需要重複以下2步即可,客戶端無需任何設定就可用新賬號登陸系統
# cd /var/yp
# make
另外有時候你可能登陸的賬號5分鐘不活動就會自動下線,這個影響的引數如下:
這些資源只有在你試圖訪問的時候才會去自動掛載,而在一段時間之後,如果你不再使用這些資源,autofs會自動解除安裝這些資源。預設時間為5分鐘(300秒),此選項由/etc/sysconfig/autofs定義,根據需要可以修改。/etc/sysconfig/autofs的內容如下
DEFAULT_TIMEOUT=300 (修改自動掛載時間)
在客戶端還可以使用yppasswd命令修改個人密碼
[nisuser@client ~]$ yppasswd
Changing NIS account information for nisuser on server.
Please enter old password: 此處要輸入舊密碼
Changing NIS password for nisuser on server.
Please enter new password: 新密碼
Please retype new password: 確認新密碼
The NIS password has been changed on server. 修改的確認資訊
NIS伺服器一臺是不夠的,如果當機了,那麼將所有客戶機都不能登陸系統了,這是件很糟糕的事情,為了防止單點故障,所以我們還需要配置一臺從NIS伺服器的,配置如下:
1、參照主伺服器安裝ypserv包
2、編輯主配置檔案/etc/ypserv.conf,新增如下行:
127.0.0.0/255.255.255.0 : * : * : none
192.168.1.0/255.255.255.0 : * : * : none
* : * : * : deny
3、編輯主伺服器上的/var/yp/Makefile檔案,使其能在更改maps後主動將更改push至從伺服器
#vim /var/yp/Makefile
找到如下行:
NOPUSH=true
更改為:
NOPUSH=false
4、編輯主伺服器上的/var/yp/ypservers檔案,指明伺服器將maps可以push到的目標從伺服器
#vim /var/yp/ypservers
新增如下行:
192.168.1.213 (注:此處最好使用從伺服器名稱,前提是此從伺服器名能被主伺服器解析,你可以透過編輯主伺服器的/etc/hosts檔案實現)
5、開啟主伺服器的資料傳送程式
#service ypxfrd start
6、啟動從伺服器的portmap、ypserv和yppasswdd程式
#service portmap start
#service ypserv start
#service yppasswdd start
7、從主伺服器獲得maps資料
#/usr/lib/yp/ypinit -s 192.168.1.212 (也可以指定主伺服器的名稱,前提是你的從伺服器可以解析些名稱)
We will need a few minutes to copy the data from server.
Transferring rpc.bynumber...
Trying ypxfrd ... success
Transferring protocols.bynumber...
Trying ypxfrd ... success
Transferring hosts.byaddr...
Trying ypxfrd ... success
Transferring ypservers...
Trying ypxfrd ... success
Transferring hosts.byname...
Trying ypxfrd ... success
……………………………………
……………………………………
success,表明資料庫已同步完畢!
個人操作部分總結:
8005可能會感覺不安全,但是透過netstat來檢視,發現只有本地才可以訪問該埠,透過telnet一訪問該埠,tomcat就會掛掉 telnet 127.0.0.1:8080
yellow page(nis)賬號集中驗證
步驟
1)做nfs,在1.250機器下,
vim /etc/exports
/data/www/wwwroot 192.168.1.0/24(rw,async,no_all_squash) async為不同步,因為會慢
重啟nfs
在1.250上,mkdir /data/www/wwwroot
在1.258上,檢查,showmount -e 192.168.1.250
/etc/init.d/portmap start
mount 192.168.1.250:/data/www/wwwroot /mnt 測試一下
因為需要自動掛載,則要配置autofs
rpm -qa | grep autofs
vim /etc/auto.master 這個檔案提供掛載是什麼
/
vim /etc/auto.misc
kkkk 192.168.1.250:/data/www/wwwroot
家目錄
vim /etc/auto.master
/home
1.2:
[root@client01 wwwroot]# cat /etc/exports
/data/www/wwwroot 192.168.1.0/24(rw,async,no_all_squash)
[root@client01 wwwroot]#
[root@client01 wwwroot]# /etc/init.d/nfs start
[root@client01 wwwroot]#
[root@client01 wwwroot]# !mkdir
mkdir -p /data/www/wwwroot
[root@client01 wwwroot]#
1.3:
[root@client02 etc]# cat /etc/auto.master | grep '^[^#]'
/home /etc/auto.misc
[root@client02 etc]#
[root@client02 etc]# cat /etc/auto.misc | grep '^[^#]'
nis 192.168.1.2:/data/www/wwwroot
[root@client02 etc]#
[root@client02 etc]# !/etc
/etc/init.d/autofs restart
停止 automount: [確定]
啟動 automount: [確定]
[root@client02 etc]# /etc/init.d/portmap restart
停止 portmap: [確定]
啟動 portmap: [確定]
[root@client02 etc]#
[root@client02 etc]# df -TH
檔案系統 型別 容量 已用 可用 已用% 掛載點
/dev/sda2 ext3 72G 9.9G 58G 15% /
/dev/sda1 ext3 104M 12M 87M 12% /boot
tmpfs tmpfs 65M 0 65M 0% /dev/shm
[root@client02 etc]# cd /home/nis 觸發掛載點,自動掛載
[root@client02 nis]# !df
df -TH
檔案系統 型別 容量 已用 可用 已用% 掛載點
/dev/sda2 ext3 72G 9.9G 58G 15% /
/dev/sda1 ext3 104M 12M 87M 12% /boot
tmpfs tmpfs 65M 0 65M 0% /dev/shm
192.168.1.2:/data/www/wwwroot
nfs 72G 10G 58G 15% /home/nis
[root@client02 nis]#
2)在158 nis伺服器,裝包
yp-tools
#nisdomainname nis-uplooking.com
#nisdomainname
在network中添nisdomain
127.0.0.1/255.255.255.0 :*(能加入我所有的域) :*(能map我) :none
192.168.1.0/255.255.255.0 :* :* :none
修改一下yp的配置檔案
useradd -u 601 -g
authconfig-tuicvi
yppasswd -p
* 192.168.1.158:/rhome/nizhener 所有使用者登陸後,都用同一家目錄
新步驟:
ypserv裝包
進入其配置檔案
vim hosts
/ypxfrd restart
ypserv start
yppasswdd start
portmap
問老師的論壇,看tomcat,做其他的一些實驗,mylinux.5d6d.com 裡面有個apache板塊的最佳化措施
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23168012/viewspace-1052664/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 安裝npm 解除安裝npm 安裝apidocNPMAPI
- BiocManager安裝,devtools安裝dev
- Linux安裝解除安裝MySQLLinuxMySql
- linux 安裝yum 安裝phpLinuxPHP
- Ubuntu解除安裝和安裝Ubuntu
- 02 安裝git、安裝TortoiseGitGit
- cocoapods安裝/解除安裝/使用
- JDK安裝和解除安裝JDK
- ffmpeg安裝之mac安裝Mac
- docker安裝及解除安裝Docker
- [ 安裝 ] Zeppelin安裝步驟!
- win10安裝版怎麼安裝_安裝版win10安裝教程Win10
- ElasticSearch的安裝和使用,Postman的安裝,Kibana的安裝,EShead外掛的安裝ElasticsearchPostman
- Mac Redis安裝與解除安裝MacRedis
- 安裝了IDLE後安裝tensorflow
- kratos安裝及依賴安裝
- Linux 解除安裝openjdk 安裝oraclejdkLinuxJDKOracle
- debian安裝和解除安裝vmware
- JDK的安裝與解除安裝JDK
- linux 解除安裝jdk和安裝LinuxJDK
- 【推薦 - glibc安裝】MySQL - 安裝MySql
- linux下安裝snap安裝工具Linux
- [雲原生]Docker - 安裝&解除安裝Docker
- Ubuntu安裝和解除安裝mongodbUbuntuMongoDB
- window下安裝並使用nvm(含解除安裝node、解除安裝nvm、全域性安裝npm)NPM
- 安裝
- air安裝win10怎麼解除安裝_air安裝win10如何解除安裝AIWin10
- Centos Docker安裝、升級、解除安裝CentOSDocker
- Webpack學習 – Webpack安裝及安裝Web
- Linux-Ubuntu-mysql-安裝&解除安裝LinuxUbuntuMySql
- Centos7.9安裝解除安裝DockerCentOSDocker
- Centos7安裝安裝部署dockerCentOSDocker
- Linux系統安裝——Centos 7.6安裝LinuxCentOS
- PostgreSQL 10.12 安裝系列 - 原始碼安裝SQL原始碼
- PostgreSQL 10.12 安裝系列 - 本地RPM安裝SQL
- 【 Linux 軟體安裝 】- 1 JDK安裝LinuxJDK
- Python pip的安裝及解除安裝Python
- CentOS7安裝php、安裝MySqlCentOSPHPMySql
- vs2015解除安裝和安裝