Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use NFS in a Ubuntu16 environment

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Ubuntu16 environment how to install and use NFS, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Through the NFS service, we can easily read and write files on the server, and work together to install and use NFS in the Ubuntu16 environment.

Environmental information

Two Ubuntu16 machines are used in this actual combat, as shown in the following figure:

Install the NFS service

Do the following on the 192.168.119.128 machine:

Create a folder as a shared file directory: / usr/local/work/nfs

Add read and write permissions to the folder:

Chmod a+rw / usr/local/work/nfs

Apt updates:

Apt-get update

Install the NFS service application:

Apt-get install nfs-kernel-server

Configure the NFS service directory, open the file / etc/exports, and add a new line at the end, as follows:

/ usr/local/work/nfs * (rw,sync,no_subtree_check)

This line means to open / usr/local/work/nfs to the client as a service folder, * indicates that any IP can be accessed, rw is read and write permission, sync is synchronization permission, no_subtree_check means that if the output directory is a subdirectory, the nfs server does not check the permissions of its parent directory. 6. Execute the following command to restart the service for the configuration to take effect:

/ etc/init.d/nfs-kernel-server restart

At this point, the NFS service is ready, and then let's prepare the NFS client

Install the NFS client

Do the following on the 192.168.119.155 machine:

Install the client application:

Apt-get install-y nfs-common

Create a folder / usr/local/work/nfs-mount with the mkdir command

Mount the / usr/local/work/nfs directory of the NFS server to the / usr/local/work/nfs-mount directory of the NFS client, and execute the following command:

Mount 192.168.119.128:/usr/local/work/nfs / usr/local/work/nfs-mount

Execute the command / usr/local/work/nfs to see the mount information, as follows:

Root@maven:~# dfFilesystem 1K-blocks Used Available Use% Mounted onudev 480820 0 480820 / devtmpfs 99828 4856 94972 5% / run/dev/sda1 59732092 12798824 43876016 23% / tmpfs 499136 0 499136 / dev/shmtmpfs 5120 0 5120 0 / run/locktmpfs 499136 0 499136 0% / sys/fs/cgroup/dev/loop5 12288 12288 0% / snap/kubectl/328/dev/loop3 83328 83328 0 per cent / snap/core/3887/dev/loop0 12288 12288 0 per cent / snap/kubectl/303/dev/loop4 83712 83712 0 per cent / snap/core/4017/dev/loop1 12288 12288 0% / snap/kubectl/346/dev/loop2 83584 83584 0% / snap/core/4110tmpfs 99828 0 99828 0% / run/user/0192.168.119.128:/usr/local/work/nfs 59732224 3238912 534359046% / usr/local/work/nfs-mount

Note the content of the bottom line: 192.168.119.128:/usr/local/work/nfs 59732224 3238912 53435904 / usr/local/work/nfs-mount, the remote folder has been mounted to the local folder

At this point, the NFS client has been installed and mounted successfully

Verify the NFS service

Do the following on the 192.168.119.155 machine:

On the NFS client, execute the following command to output the native IP address information to the test.txt file in the NFS directory:

Ip addr > / usr/local/work/nfs-mount/test.txt

Execute commands on the NFS server

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report