I encountered such a problem in practice. The author is an Ubuntu16.04 system. I want to connect to the centos server remotely, and I think I can share a folder on centos, so that I can copy the file to the shared file locally to realize the machine. File exchange with the server. Below are the detailed steps.
1. Clarify the needs
This machine: Ubuntu 16.04 ip address: xxx.xxx.xxx.1 (hereinafter referred to as ip address 1) This machine's shared folder usr/tomcat/here
Server side: centos ip address: xxx.xxx.xxx.2 (hereinafter referred to as ip address 2) The shared folder of the server is mnt/share
2. Implementation method
(1) First operate on the server side.
0. First check whether nfs has been installed on the server side
rpm -qa | grep nfs
1. If nfs is not installed, install nfs-utils on the server
yum install nfs-utils2. Modify /etc/exports on the server side
You can use vim /etc/exports to modify this file, the modification content is
/mnt/share xxx.xxx.xxx.1(rw,no_root_squash,async)
Note: The ip address here is the ip address in this machine.
3. Restart the nfs service on the server side
service nfs restart
At this point, the server-side operation is complete.
(2) Local operation
0. Check whether the server has been shared
showmount -e xxx.xxx.xxx.2Note: The ip address here is the server-side address. If mount is not installed, it needs to be installed
apt install mount
1. Create the shared folder directory mentioned above
mkdir -p /usr/tomcat/here
2. Run the following command
mount -t nfs xxx.xxx.xxx.2:/mnt/share /usr/tomcat/here
In the future, you can share files to the server in the usr/tomcat/here/ folder of this machine, and the server can view it in mnt/share/.
complete.