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、启动从服务器的portmapypservyppasswdd进程


#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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23168012/viewspace-1052664/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值