Pular para o conteúdo principal

Criando NFS Server

Primeiro passo, instalar o NFS (salvo se você utilizar uma distribuição baseada no RedHat EL, que já vem com o pacote instalador por default).
Para instala-lo, basta digitar no terminal:
$sudo apt-get install nfs-server nfs-kernel-server nfs-client nfs-common
Feito isso, vamos as configurações:
Edite o arquivo: /etc/exports (este arquivo é onde você ira definir o que será compartilhado e com quem)
Um exemplo de um exports:
/home/SEU+USUARIO/PONTO+COMPARTILHADO 192.168.0.3(rw,root_squash,sync)
Entendendo a configuração:
o primeiro parâmetro a ser passado é o diretório que você deseja compartilhar pelo NFS
o segundo parâmetro é o IP/HOST que terá direito de montar este compartilhamento
o terceiro, são as opções de montagem, no exemplo acima temos:
rw - permite que tanto o cliente como o servidor escrevam no ponto de montagem
root_squash - mapeia as requisições do UID/GID 0 para o UID/GID anonimo
sync - responde as requisições somente após as mudanças serem enviadas.
Outros parâmetros de configuração, podem ser encontrados na man page do exports.
Uma vez configurado, para iniciar o servidor NFS faça:
$sudo /etc/init.d/nfs start
Jump of the cat
Já tive casos de lentidão com paginas php dentro de um NFS. Isso se da devido a má performance do gerenciador de lock do php.
Para resolver isso, basta iniciar o gerenciador de lock do próprio NFS
$sudo /etc/init.d/nfslock start
NFS Server inciado, vamos ao lado cliente.
No cliente, você possui duas opções de montagem. A primeira via mount e a segunda, pelo /etc/fstab.
Vamos supor que você pretenda montar o NFS Server no diretório NFS, que esta dentro do seu $HOME.
Faça:
$sudo mount -t nfs IP-DO-SERVIDOR-NFS:CAMINHO-DO-PONTO-DE-MONTAGEM LOCAL-DE-MONTAGEM
Algo como:
$sudo mount -t nfs 192.168.0.2:/home/usuario/ponto_de_montagem /home/usuario/NFS
Agora pelo /etc/fstab
Edite este arquivo, adicionando a montagem da seguinte maneira:
IP-DO-SERVIDOR-NFS:CAMINHO-DO-PONTO-DE-MONTAGEM LOCAL-DE-MONTAGEM nfs
Ex:
192.168.0.2:/home/usuario/ponto_de_montagem /home/usuario/NFS nfs
Uma vez salvo o arquivo, execute:
$sudo mount -a (este comando irá ler o arquivo /etc/fstab e irá montar as partições que não estão montadas)
Existe uma gama de opções de otimizações que podem ser utilizadas dentro do fstab. Estas otimizações / especificações podem ser encontradas na manpage do mount

Fonte:  http://www.dominiodesconhecido.com.br/ti/2010/04/28/criando-um-nfs-server-e-conectando-clientes-nele/

Comentários

Postagens mais visitadas deste blog

Upgrading Iomega ix2-200 to Cloud Edition

You just got your ix2-200 from eBay and there are no disks inside the NAS. Or you have a brand new ix2-200 -yet you could not afford Cloud Edition. No problem. With just a USB stick and a SATA adapter or desktop PC, you will easily upgrade your ix2-200 to ix2-200 Cloud Edition. Not only your ix2-200 will have a brand new interface and Cloud options, but also will become Mac OS X Lion compatible! What do we need? Decrypted! ix2-200 Cloud Edition Firmware 3.1.12.47838 S endSpace or RapidShare * USB Flash Drive with at least 2 GB capacity and LED indicator** SATA to USB adapter or desktop PC Toothpick or paperclip Preparing Hard Drives Preparing hard drives is the first step because you have to wipe all the data inside the hard drives and make them just like brand new. We used 2 x Seagate 2 TB 5900 RPM Drives. Backup any files if you have and then remove both disks from ix2-200 and attach them to SATA to USB adapter or your desktop PC's SATA port. Using ...

How to Fix sub-process /usr/bin/dpkg returned an error code (1)

Introduction The error message “Sub-process /usr/bin/dpkg returned an error code (1)” indicates a problem with the package installer. This can happen in Ubuntu after a failed software installation, or if the installer becomes corrupted. The key phrase in this error is /usr/bin/dpkg. This refers to the dpkg package installer for Linux. A package installer is an application that tracks software, updates, and dependencies. If it is damaged, any new software installation will cause this error message. We cover several possible solutions, from easily-solved and straightforward solutions to more complex processes. This guide will help you resolve the dpkg returned an error code 1 on an Ubuntu operating system. Prerequisites A user account with sudo privileges A terminal window/command-line ( Ctrl - Alt - T ) Options to Fix sub-process /usr/bin/dpkg returned an error code (1) Method 1: Reconfigure dpkg Database ...

Installing and Configuring Snorby on CentOS 7

Snorby is a ruby on rails web application for network security monitoring that interfaces with current popular intrusion detection systems (Snort, Suricata and Sagan). The basic fundamental concepts behind Snorby are simplicity, organization and power. The project goal is to create a free, open source and highly competitive application for network monitoring for both private and enterprise use. Set up your system with the follow script to ensure that nothing will be missing http://wiki.douglasqsantos.com.br/doku.php/confinicialcentos7_en The Snorby will use the follow ip: 192.168.1.251 Let's install the development tools yum groupinstall "Development Tools" -y Let's install the dependencies for Snorby. yum install openssl-devel readline-devel libxml2-devel libxslt-devel mariadb mariadb-devel mariadb-server urw-fonts libX11-devel libXext-devel git \ fontconfig-devel libXrender-devel unzip wget xorg-x11-server-Xvfb libyaml libyaml-devel gdbm-de...