您的位置:首页 > 编程语言 > Python开发

Python初学者的一些技巧

2015-09-18 00:16 671 查看
1.首先准备两台主机,一台做服务器,一台做客户机,保证两台能够相互通信
服务器IP地址:192.168.4.5
客户机IP地址:192.168.4.205
2.给服务器配置NFS服务
[root@ser5 /]# rpm -q nfs-utils rpcbind
nfs-utils-1.2.3-39.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
确定这两个软件包已经安装,如果没有安装需要安装
3.修改nfs的配置文件
新建共享目录
[root@ser5 /]# mkdir /public
修改配置文件
[root@ser5 /]# vim /etc/exports
/public 192.168.4.0/24(rw,sync,no_root_squash) #设置该目录192.168.4.0网段的所有主 机的root用户拥有读写权限
重启服务并设置为开机自启动
[root@ser5 /]# service rpcbind restart
[root@ser5 /]# service nfs restart
[root@ser5 /]# chkconfig nfs on
[root@ser5 /]# chkconfig rpcbind on
查看共享情况
[root@ser5 /]# showmount -e 192.168.4.5
Export list for 192.168.4.5:
/public 192.168.4.0/24
如果修改配置文件需要重新加载生效
[root@ser5 /]# exportfs -rv
exporting 192.168.4.0/24:/public
4.客户机验证
[root@pc205 /]# showmount -e 192.168.4.5
Export list for 192.168.4.5:
/public 192.168.4.0/24
新建测试文件夹
[root@pc205 /]# mkdir /test
挂载
[root@pc205 /]# mount 192.168.4.5:/public /test
[root@pc205 桌面]# mount | grep 192.168.4.5
192.168.4.5:/public on /test type nfs (rw,vers=4,addr=192.168.4.5,clientaddr=192.168.4.205)
确认能够访问
[root@pc205 /]# ls -l /test
总用量 8
-rw-rw-r--. 1 nobody nobody 0 8月 12 17:21 file
-rw-rw-r--. 1 nfsnobody nfsnobody 0 8月 12 17:23 file2
-rw-r--r--. 1 nfsnobody nfsnobody 0 8月 12 20:08 root
drwxrwxr-x. 2 nobody nobody 4096 8月 12 17:21 stu01
drwxrwxr-x. 2 nfsnobody nfsnobody 4096 8月 12 17:22 stu02
-rw-r--r--. 1 root root 0 8月 12 17:24 test
注明:最容易出现的问题就是客户机挂载是出现没有权限的问题,这时就要查看服务器共享目录本身的权限和在修改/etc/exports配置中配置的权限问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: