centos7 nis server client 설치
저번에 솔라리스 버전에 설치를 했는데 이번에 centos7 버전에 설치를 해보자
test1 장비에 centos7 설치 server 장비
test2 장비에 centos7 설치 clinet 장비
----------------------------------------------------------------------------------------------------------------------
- Server -
호스트네임
# vi /etc/hostname or hostnamectl set-hostname test1
nisdomain 변경
# vi /etc/sysconfig/network
NISDOMAIN=test.com
YPSERV_ARGS="-p 834" -->방화벽 포트설정
방화벽
# firewall-cmd --permanent --add-service=rpc-bind
# firewall-cmd --permanent --add-port=834/tcp
# firewall-cmd --permanent --add-port=834/udp
# firewall-cmd --reload
# vi /etc/selinux/config
SELINUX=enforcing 을
SELINUX=disable 로 변경
패키지 설치
# yum install ypserv rpcbind libtirpc -y
# systemctl enable ypserv yppasswdd
# systemctl start ypserv yppasswdd
# systemctl status ypserv yppasswdd
● ypserv.service - NIS/YP (Network Information Service) Server
Loaded: loaded (/usr/lib/systemd/system/ypserv.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2017-07-04 16:08:57 KST; 1h 46min ago
Main PID: 1125 (ypserv)
Status: "Processing requests..."
CGroup: /system.slice/ypserv.service
└─1125 /usr/sbin/ypserv -f -p 834
Jul 04 16:08:57 sm9 systemd[1]: Starting NIS/YP (Network Information Service) Server...
Jul 04 16:08:57 sm9 systemd[1]: Started NIS/YP (Network Information Service) Server.
● yppasswdd.service - NIS/YP (Network Information Service) Users Passwords Change Server
Loaded: loaded (/usr/lib/systemd/system/yppasswdd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2017-07-04 16:08:57 KST; 1h 46min ago
Process: 1129 ExecStartPre=/usr/libexec/yppasswdd-pre-setdomain (code=exited, status=0/SUCCESS)
Main PID: 1163 (rpc.yppasswdd)
Status: "Processing requests..."
CGroup: /system.slice/yppasswdd.service
└─1163 /usr/sbin/rpc.yppasswdd -f --port 836
정상적으로 구동되고 있으면 active 로 뜬다. 이상이 있다면 로그를 확인해보자.
nis 설정 및 설치
# vi /var/yp/securenets
255.255.255.255 127.0.0.1
255.255.255.0 192.168.1.0
자신의 사용할 대역대를 설정을 하자.
# /usr/lib64/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. test1 is in the list of NIS server hosts. Please continue to add
the names for the other hosts, one per line. When you are done with the
list, type a <control D>.
next host to add: test1
next host to add: test.com --> 자신의 가상 도메인입력
next host to add:
위와 같이 설치가 됐다.
이제 server 에 계정을 넣어서 테스트 해보자
# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.12 test1
192.168.0.13 test2
그리고 계정을 추가하자
# useradd -g 100 test2 --> -g 100은 users group으로 생성하는것이다.
# vi /etc/passwd
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
test:x:1001:100::/home/test:/bin/bash
위와 같이 등록되어 있다. 이걸 나중에 auto.master를 이용해서 automount를 하려면 수정을 해줘야 한다.
test:x:1001:100:test2:/user/test2:/bin/bash
auto.master 를 수정해주자.
# vi /etc/auto.master
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts -nouid,nobrowse
#
# Include /etc/auto.master.d/*.autofs
# The included files must conform to the format of this file.
#
#+dir:/etc/auto.master.d
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
/home /etc/auto.home
/xfn -nfn
/- auto_direct
nis 설정들을 업데이트 하자.
# cd /var/yp
# make
이제 서버에 설정은 끝이났다.
# yum install ypbind -y yp-tools autofs nfs-utils
# systemctl enable autofs
# systemctl enable nfs-client.target
# authconfig-tui
Use NIS 선택
next
Domain : test.com (아까 입력한 도메인)
Server : 192.168.1.12 (test1 장비 nis 서버 IP)
연결이 잘 됐는지 확인하려면
# ypwhich
test1
위와 같이 뜨면 된다.
계정 설정을 해주자.
# cd /
# mkdir /user/test2
# chown -R test2:users test/
export 수정
# vi /etc/export
/user 192.168.1.1/255.255.254.0(rw,sync)
설정이 다 끝났으면 재부팅
# ypcat passwd
test1:$6$d35EO5fJ$6!!!!!CIZFlej4LdSTtiHyl4iyJ.TjJHwF6P1:1001:100:test:1/user/test:/bin/bash
No such map passwd.byname. Reason: No such map in server's domain
정상적으로 /user/test 로 접속이 됐다.
이제 /net으로 들어가보자
# cd /net/test/
$ ls
user
export 에 설정한게 보인다.
혹시
# ypinit -m
The local host's domain name hasn't been set. Please set it.
라고 에러가 뜬다면
# domainname abc.com; domainname >/etc/defaultdomain
하고 해보면 정상적으로 작동 된다.
'Linux' 카테고리의 다른 글
centos 7.x meld 설치 (0) | 2017.07.25 |
---|---|
subversion(svn) log, author 수정 (0) | 2017.07.14 |
Can't create directory 'transactions/ txn': Permission denied (0) | 2017.07.03 |
subversion + ssl + viewvc 설치 방법 (0) | 2017.06.29 |
ImportError: No module named svn.core (0) | 2017.06.28 |