Ubuntu上nfs的安装配置

来源:互联网 发布:方可销售单打印软件 编辑:程序博客网 时间:2024/04/19 17:32
OS: Ubuntu 7.04

NFS Advantages

• Local workstations use less disk space because commonly used data can be stored on a single machine and still remain accessible to others over the network.

• There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network.

• Storage devices such as floppy disks, CDROM drives, and Zip® drives can be used by other machines on the network. This may reduce the number of removable media drives throughout the network.

Install NFS Server in Ubuntu

sudo apt-get install nfs-kernel-server nfs-common portmap

When configuring portmap do =not= bind loopback. If you do you can either edit /etc/default/portmap using the following

sudo vi /etc/default/portmap

or use the following command

sudo dpkg-reconfigure portmap

Restart Portmap using the following command

sudo /etc/init.d/portmap restart

NFS Server Configuration

NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients.

You need to edit the exports file using the following command

sudo vi /etc/exports

Here are some quick examples of what you could add to your /etc/exports

For Full Read Write Permissions allowing any computer from 192.168.1.1 through 192.168.1.255

/files 192.168.1.1/24(rw,no_root_squash,async)

Or for Read Only from a single machine

/files 192.168.1.2 (ro,async)

save this file and exit

A client can be specified either by name or IP address. Wildcards (*) are allowed in names, as are netmasks (e.g. /24) following IP addresses, but should usually be avoided for security reasons.

A client specification may be followed by a set of options, in parenthesis. It is important not to leave any space between the last client specification character and the opening parenthesis, since spaces are intrepreted as client seperators.

Now you need to restart NFS server using the following command

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

If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command

sudo exportfs -a

Install NFS client support in Ubuntu

sudo apt-get install portmap nfs-common

This will install all the required packages for nfs client

Mounting manually

Example to mount server.mydomain.com:/files to /files. In this example server.mydomain.com is the name of the server containing the nfs share, and files is the name of the share on the nfs server

The mount point /files must first exist on the client machine.

Create files directory using the following command

sudo mkdir files

You need to mount the share using the following command

sudo mount server.mydomain.com:/files /files

sudo mount  -t   nfs  hostname:/file   /flle2

/file2是本地挂载目录

Now you may need to restart services using the following command

sudo /etc/init.d/portmap restart

sudo /etc/init.d/nfs-common restart

Mounting at boot using /etc/fstab

If you want to mount using fstab file

sudo vi /etc/fstab

In this example my /etc/fstab was like this

server.mydomain.com:/files /files nfs rsize=8192,wsize=8192,timeo=14,intr

Change “servername.mydomain.com:/files”, and “/files” to match your server name,share name, and the name of the mount point you created.

Testing Your Configuration

Use the following command in terminal to test

mount /files

the mount point /files will be mounted from the server

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 渭南市住房公积金管理中心 连云港住房公积金 临沂住房公积金查询个人账户 南充住房公积金 住房公积金密码 运城住房公积金查询 住房公积金查询电话 住房公积金热线 昆明市住房公积金管理中心 乌鲁木齐住房公积金查询 玉林市住房公积金管理中心 南宁住房公积金网 宜宾市住房公积金管理中心 重庆住房公积金 银川住房公积金查询个人账户 洛阳住房公积金查询 住房公积金卡 东莞住房公积金查询 南京住房公积金管理中心 成都住房公积金 广西住房公积金查询 广西区直住房公积金查询入口 哈尔滨住房公积金管理中心 武汉住房公积金查询个人账户 重庆市住房公积金管理中心 渭南住房公积金查询 咸阳市住房公积金管理中心 宁德住房公积金查询 苏州住房公积金管理中心 太原住房公积金 萍乡市住房公积金个人查询 深圳住房公积金查询余额 长春市住房公积金网 潍坊市住房公积金管理中心 阜阳市住房公积金查询 赣州住房公积金 太原住房公积金查询个人账户 郑州市住房公积金查询 杭州住房公积金管理中心 乐山市住房公积金管理中心 长春住房公积金查询