一、准备工作
1、在用户目录下建立一个工作目录
dwg-ubuntu@ubuntu:~$ mkdir linux
dwg-ubuntu@ubuntu:~$ cd linux
二、安装NFS服务
1、安装NF服务
dwg-ubuntu@ubuntu:~/linux$ mkdir nfs
dwg-ubuntu@ubuntu:~/linux$ ls
nfs
dwg-ubuntu@ubuntu:~$ sudo apt-get install nfs-kernel-server portmap
2、修改/etc/exports文件
该文件的内容每行都是 :[共享的目录] [主机名或者IP(参数1,参数2)]
其中参数是可选的,当不指定参数时,nfs将使用默认选项。默认的共享选项是 (sync,ro,root_squash,no_delay)。
dwg-ubuntu@ubuntu:~/linux$ sudo vi /etc/exports
将下面代码放在文件最后一行
/home/dwg-ubuntu/linux/nfs *(rw,sync,no_root_squash)
//这里的相当于: /home/用户名/上面创建的linux目录/nfs
重启NFS服务
dwg-ubuntu@ubuntu:~/linux$ sudo /etc/init.d/nfs-kernel-server restart
三、安装SSH服务
dwg-ubuntu@ubuntu:~/linux$ sudo apt-get install openssh-server
四、常见问题
在安装SSH或者NFS等服务时,出现的依赖问题,举例子:
dwg-ubuntu@ubuntu:~$ sudo apt-get install nfs-kernel-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
//这里提示出现依赖问题
nfs-kernel-server : Depends: nfs-common (= 1:1.3.4-2.1ubuntu5.5) but it is not going to be installed
Depends: keyutils
E: Unable to correct problems, you have held broken packages.
解决方法:
其实很简单,在安装NFS服务时,他安装所需要的依赖未安装,那自然就安装失败了,我们只需要将它所需要的依赖安装上就好
dwg-ubuntu@ubuntu:~$ sudo apt-get install keyutils
dwg-ubuntu@ubuntu:~$ sudo apt-get install nfs-common=1:1.3.4-2.1ubuntu5.5
//这里的 nfs-common=? 需要根据上面提示的依赖进行更改