https://padlet.com/yerim999/tgf0wzcq63foh5vc/wish/2231877018
- 서버 종류
- Linux 파일 공유
1) NFS(Network File System) : Linux Client 용
2) Samba : Windows Client 용.
3) FTP
----------NFS-----------
- 파일 공유 과정(서버)
- mkdir /공유 directory/
2. 해당 디렉토리에 permission 부여
- chmod 777 /공유 directory경로/
- yum install nfs-utils -y
4. NFS 서버 구성 설정 후 수정 내용 반영, 재시작
- vi /etc/exports
- exportfs -a
- systemctl restart nfs
5. 방화벽 off
- systemctl disable firewalld
↑↑↑↑↑↑
- 접속
- yum install nfs-utils -y
2. 원격 컴퓨터의 공유된 폴더 확인
- showmount -e "서버주소"
3. mount 하기
로컬 directory 이용(기본적으로 /mnt나 /media 디렉토리 사용)
- mount -t nfs "서버주소":/"서버의 공유폴더주소" "공유폴더주소"
4. cd "공유폴더주소"
<centos1이 가운데 / centos2&3이 1의 /public/share에 접속하여 파일 공유하는 구조>
centos2 IP주소 : 10.0.2.6
centos3 IP주소 : 10.0.2.7
centos1의 공유폴더 주소 : /public/share
centos2&3의 공유폴더 주소: /mnt/centos1
먼저, NFS 설치하기
- (centos1&2&3)yum install nfs-utils -y
- (centos1) mkdir -p /public/share : 공유 파일 설정
- (centos1) chmod 777 /public/share
- (centos1) vi /etc/exports : 서버 구성 설정 파일
/public/share 10.0.2.0/24(rw,sync,no_root_squash) : 10.0.2.0 네트워크에만 공유하겠다.
- (centos1) exportfs -a : 수정내용 적용
- (centos1) exportfs : nfs 서버가 공유하는 내용 확인
- (centos1&2&3) systemctl restart nfs : nfs 서버 재시작
- (centos1&2&3) systemctl disable firewalld : 방화벽 설정 x
- (centos2&3) mkdir /mnt/centos1
- (centos2&3) showmount -e 10.0.2.101
- (centos2&3) mount -t nfs 10.0.2.101:/public/share /mnt/centos1 : nfs 서버에 마운트
centos1에서는 /public/share에서, centos2&3에서는 /mnt/centos1에서 공유 진행 상황 확인 가능
---------------------------
+) 윈도우에서 공유 폴더 확인하는 명령어
- net share
마운트 해제
- umount -a
클라이언트 마운트 후 reboot 하면 마운트 해제가 됨
따라서 이를 항상 유지하기 위해
- vi /etc/fstab
10.0.2.101:/public/share /mnt/centos1 nfs defatult 0 0
---------Samba----------
0. Samba? Linux File Server for Windows
1. (centos2 as 서버) Samba설치
- yum install samba -y
2. 구성
- vi /etc/samba/smb.conf
[homes]에다가 hosts allow = 10.0.2. 와 security = user 추가
- vi /etc/sysconfig/selinux : selinux off
- smbpasswd -a adminuser : 애플리케이션에서 사용. samba 접속 사용자 생성. samba 들어올때만 쓰는 비밀번호
3. 디렉토리 생성
- mkdir /home/samba
4. 재시작
- systemctl restart smb
- cd /home/adminuser : 여기에서는 adminuser만 보이는 폴더
- cd /home/samba : 여기는 public
(centos3 as 클라이언트)
- su adminuser
- smbclient -L 10.0.2.6 : 확인
- smbclient //10.0.2.6/public
- smbclient //10.0.2.6/adminuser -U adminuser
'Study > Cloud' 카테고리의 다른 글
라우터 이해하기 (0) | 2022.07.04 |
---|---|
vi, yum, file system, permission 이해 (0) | 2022.07.04 |
FTP서버 운영 (0) | 2022.07.04 |
NFS, Samba 운영-2 (0) | 2022.07.04 |
Linux 기본 (0) | 2022.07.04 |