Ubuntu 16.04镜像源:
# deb cdrom:[Ubuntu 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801)]/ xenial main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
#deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
一、服务器端:
1.1安装NFS服务:
sudo apt install nfs-kernel-server
1.2编写配置文件:
vi /etc/exports
#/etc/exports文件的内容如下:
/tmp *(rw,sync,no_subtree_check,no_root_squash)
/data *(rw,sync,no_subtree_check,no_root_squash)
/logs *(rw,sync,no_subtree_check,no_root_squash)
1.3重启nfs服务
sudo service nfs-kernel-server restart
1.4查询命令
showmount -e localhost
#将配置文件中的目录全部重新export一次!无需重启服务。
sudo exportfs -rv
#查看NFS的运行状态
sudo nfsstat
#查看rpc执行信息,可以用于检测rpc运行情况
sudo rpcinfo
#查看网络端口,NFS默认是使用111端口。
sudo netstat -tu -4
二、客户端:
2.1安装客户端工具:
#在需要连接到NFS服务器的客户端机器上,
#需要执行以下命令,安装nfs-common软件包。
#apt会自动安装nfs-common、rpcbind等12个软件包
sudo apt install nfs-common
2.2查看NFS服务器上的共享目录
#显示指定的(192.168.3.167)NFS服务器上export出来的目录
sudo showmount -e 192.168.3.167
2.3创建本地挂载目录
sudo mkdir -p /mnt/data
sudo mkdir -p /mnt/logs
2.4挂载共享目录
#将NFS服务器192.168.3.167上的目录,挂载到本地的/mnt/目录下
sudo mount -t nfs 192.168.3.167:/data /mnt/data
sudo mount -t nfs 192.168.3.167:/logs /mnt/logs
#注:在没有安装nfs-common或者nfs-kernel-server软件包的机器上,
#直接执行showmount、exportfs、nfsstat、rpcinfo等命令时,
#系统会给出友好的提示,
#比如直接showmount会提示需要执行sudo apt install nfs-common命令,
#比如直接rpcinfo会提示需要执行sudo apt install rpcbind命令。
转载:https://blog.youkuaiyun.com/csdn_duomaomao/article/details/77822883
本文详细介绍了如何在Ubuntu16.04系统中配置阿里云镜像源,以及如何搭建和使用NFS服务进行文件共享。包括安装NFS服务、编写配置文件、重启服务、查询命令、客户端工具安装、查看共享目录和挂载共享目录的具体步骤。
524

被折叠的 条评论
为什么被折叠?



