생성하는서버 아이피는 192.168.0.111이라고 가정함.
root 계정은 sudo 안 붙여도됨
네트워크 설정
$ su - root
# sudo nmcli con mod {nic} ipv4.address 192.168.0.111/24
# sudo nmcli con mod {nic} ipv4.dns 8.8.8.8
# sudo nmcli con mod {nic} ipv4.gateway 192.168.0.1
# sudo nmcli con up {nic}
# sudo nmcli con mod {nic} connection.autoconnect yes
서버 업데이트
# sudo yum -y update
↓ 선택사항
# sudo hostnamectl set-hostname server.example.com --static
nfs서버 설치
# sudo yum -y install nfs-utils
# sudo systemctl enable --now nfs-server rpcbind
# sudo systemctl status nfs-server
방화벽 설정
# sudo firewall-cmd --permanent --add-service=nfs
# sudo firewall-cmd --permanent --add-port=111/tcp
# sudo firewall-cmd --permanent --add-port=111/udp
# sudo firewall-cmd --reload
# sudo firewall-cmd --list-all
저장 폴더 및 nfs경로 설정 파일 생성
# sudo mkdir -p /nfs/data
# sudo chmod 777 -R /nfs
# sudo touch /etc/exports
경로 파일 설정
# sudo vi /etc/exports
# ↓ 아래 내용이 exports파일 안에 들어감.
/nfs/data 192.168.0.0/24(rw,sync)
경로 내보내기
# sudo exportfs -rav
nfs연결 가능 폴더 확인
# sudo showmount --exports 192.168.0.111
# ↓ 아래와 같은 결과가 나옴
Export list for 192.168.0.211:
/nfs/data 192.168.0.0/24
보안 컨텍스트 설정
# sudo setsebool -P nfs_export_all_rw 1
nfs 클라이언트 설치
# sudo yum -y install nfs-utils
연결
# sudo mount -t nfs 192.168.0.111:/nfs/data ./nfs-test
728x90
'OS > centOS' 카테고리의 다른 글
KVM | 스냅샷 (0) | 2023.05.17 |
---|---|
centOS 8 stream | python3.9 설치 (0) | 2023.05.04 |
centos7 | https 적용, 유료 인증서 (0) | 2023.02.05 |
centos7 | ping 테스트 차단 (0) | 2023.02.05 |
centOS7 | Let's Encrypt (0) | 2022.11.30 |