First, since this is a lab environment at home and things tend to change around a good bit, I have all the hosts on DHCP for right now. In production you'd want to have your hosts, especially servers with some sort of static arrangement. I have long leases on my IP addresses on my internal router, and most of my gear is up at least once a day, so I don't tend to shuffle addresses often. My Fedora box is named shinigami and my pi is cliffjumper. This will be slightly confusing because shinigami, as a Fedora machine uses RPM (Redhat Package Manager) commands to install packages, and the Raspbian uses Debian's dpkg (Debian Package) commands. I'll try to keep it as straightforward as possible.
First, we need to determine what we're going to share, and how. For illustrative purposes, I'm going to make a space called /local on shinigami that will be shared on both hosts.
[jon@shinigami ~]$ sudo mkdir /local [jon@shinigami ~]$
Next we want to install the server packages on the Fedora box.
[jon@shinigami ~]$ sudo yum -y install nfs-utils
I happened to already have it installed, so there was nothing of note to do here. Edit the relevant configuration files and start the services. Use whatever editor works best for you, I happen to be a 'vi' guy:
[jon@shinigami ~]$ sudo vi /etc/exports /local 192.168.0.0/24(rw,sync,no_root_squash,no_all_squash) [jon@shinigami ~]$ sudo systemctl start rpcbind.service [jon@shinigami ~]$ sudo systemctl start nfs-server.service [jon@shinigami ~]$ sudo systemctl start nfs-lock.service [jon@shinigami ~]$ sudo systemctl start nfs-idmap.service [jon@shinigami ~]$ sudo systemctl enable rpcbind.service [jon@shinigami ~]$ sudo systemctl enable nfs-server.service ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/multi-user.target.wants/nfs-server.service' [jon@shinigami ~]$ sudo systemctl enable nfs-lock.service [jon@shinigami ~]$ sudo systemctl enable nfs-idmap.service ln -s '/usr/lib/systemd/system/nfs-idmap.service' '/etc/systemd/system/nfs.target.wants/nfs-idmap.service' [jon@shinigami ~]$
The server should be up and running at this point, so we're going to have to setup the client. The following commands are under the Raspbian box:
jon@cliffjumper:~$ sudo apt-get install -y nfs-common portmap
This will install the packages you need to mount the filesystem.
jon@cliffjumper:~$ sudo service rpcbind start Starting rpcbind daemon.... jon@cliffjumper:~$ sudo update-rc.d rpcbind enable update-rc.d: using dependency based boot sequencing jon@cliffjumper:~$ sudo mkdir /local jon@cliffjumper:~$ sudo mount -t nfs shinigami:/local /local jon@cliffjumper:~$ cd /local jon@cliffjumper:/local$ ls -lsa total 8 4 drwxrwxrwx 2 root root 4096 Jan 9 21:33 . 4 drwxr-xr-x 25 root root 4096 Jan 9 21:32 .. 0 -rw-rw-r-- 1 pi pi 0 Jan 9 21:33 foo jon@cliffjumper:/local$
At this point you probably have UID mismatches, but at least you're now mounting the fileserver. You'll have all that space now available to the raspberry, but use caution; this method is not particularly secure nor is it particularly robust.
No comments:
Post a Comment