Centos6.4和Centos5.8混合实例
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos6.4和Centos5.8混合实例相关的知识,希望对你有一定的参考价值。
Centos6.4和Centos5.8混合实例:
服务器系统 | 角色 | IP |
CentOS-64-121-server1 | NFS服务器端 | 192.168.1.121 |
CentOS-5.8-119-client | NFS客户端 | 192.168.1.119 |
共享CentOS-64-121-server1中/data/bbs目录,使192.168.1.1 IP段所有主机都可以访问
Centos6.4配置服务端:
首先创建实验环境目录
[[email protected] ~]# mkdir /data/bbs –p [[email protected] bbs]# chown -Rnfsnobody.nfsnobody /data/bbs [[email protected] bbs]# ls -ld /data/bbs drwxr-xr-x. 2 nfsnobody nfsnobody 4096 Jan19 17:08 /data/bbs
检查服务器系统信息
[[email protected] ~]# cat /etc/redhat-release CentOS release 6.4 (Final) [[email protected] ~]# uname -n 64server1 [[email protected] ~]# uname -r 2.6.32-358.el6.x86_64 [[email protected] ~]# uname -m x86_64 [[email protected] ~]# uname -a Linux 64server1 2.6.32-358.el6.x86_64 #1SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux [[email protected] ~]# [[email protected] ~]# ifconfig eth0 Link encap:Ethernet HWaddr00:0C:29:03:A5:40 inet addr:192.168.1.121 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe03:a540/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:163 errors:0 dropped:0 overruns:0 frame:0 TX packets:126 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:14926 (14.5 KiB) TXbytes:13877 (13.5 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0b)
分别查看服务端的相关信息,如ip,主机名等等
检查NFS软件
[[email protected] ~]# rpm -aq|egrep"nfs-utils|rpcbind" nfs-utils-1.2.3-36.el6.x86_64 nfs-utils-lib-1.1.5-6.el6.x86_64 rpcbind-0.2.0-11.el6.x86_64
查看服务器的centos中5.8 portmap、6.4 rpcbind服务有没有启动和检查nfs、启动nfs
[[email protected] ~]# /etc/init.d/rpcbindstatus rpcbind (pid 1100) is running... [[email protected] ~]# /etc/init.d/nfs status rpc.svcgssd is stopped rpc.mountd is stopped nfsd is stopped rpc.rquotad is stopped [[email protected] ~]# /etc/init.d/nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS mountd: [ OK ] Stopping RPC idmapd: [ OK ] Starting RPC idmapd: [ OK ] Starting NFS daemon: [ OK ] [[email protected] ~]# /etc/init.d/nfsstatus rpc.svcgssd is stopped rpc.mountd (pid 1606) is running... nfsd (pid 1671 1670 1669 1668 1667 16661665 1664) is running... rpc.rquotad (pid 1602) is running...
配置NFS及portmap(Centos6.4下为rpcbind)服务开机自启动
[[email protected] ~]# echo "#NFS6.4Server start at dingjian to2014.01.19">>/etc/rc.local [[email protected] ~]# echo "/etc/init.d/rpcbindstart" >>/etc/rc.local [[email protected] ~]# echo"/etc/init.d/nfs start" >>/etc/rc.local [[email protected] ~]# tail -3 /etc/rc.local #NFS6.4 Server start at dingjianto2014.01.19 /etc/init.d/rpcbind start /etc/init.d/nfs start
配置NFS服务
[[email protected] ~]# echo "#NFS shared/data/bbs 2014.01.19">>/etc/exports [[email protected] ~]# echo "/data/bbs/192.168.1.1/24(rw,sync)">>/etc/exports [[email protected]rver1 ~]# tail -2 /etc/exports #NFS shared /data/bbs 2014.01.19 /data/bbs/ 192.168.1.1/24(rw,sync)
六、/etc/init.d/nfs reload 或exportfs -rv进行nfs重新加载
七、showmount -e localhost show一下自己,看服务端有没有配置好
[[email protected] bbs]# showmount -elocalhost Export list for localhost: /data/bbs 192.168.1.1/24
Centos5.8配置客户端:
检查系统环境
[[email protected] ~]# cat /etc/redhat-release CentOS release 5.8 (Final) [[email protected] ~]# uname -n 58client [[email protected] ~]# uname -r 2.6.18-308.el5 [[email protected] ~]# uname -a Linux 58client 2.6.18-308.el5 #1 SMP TueFeb 21 20:06:06 EST 2012 x86_64 x86_64 x86_64 GNU/Linux [[email protected] ~]# uname -m x86_64
2.检查和启动portmap(6.4rpcbind)服务(注意无需启动NFS服务)
[[email protected] ~]# rpm -aq|grep portmap portmap-4.0-65.2.2.1 [[email protected] ~]# /etc/init.d/portmapstatus portmap is stopped [[email protected] ~]# /etc/init.d/portmapstart Starting portmap: [ OK ] [[email protected] ~]# /etc/init.d/portmapstatus portmap (pid 22949) is running...
3.把portmap加入开机自启动
[[email protected] ~]# echo "#NFS Clientstart at dingjian to 2014.01.19">>/etc/rc.local [[email protected] ~]# echo"/etc/init.d/portmap start">>/etc/rc.local [[email protected] ~]# tail -2 /etc/rc.local #NFS Client start at dingjian to 2014.01.19 /etc/init.d/portmap start
4扫描NFS服务器的文件共享例表
[[email protected] ~]# showmount -e 192.168.1.121 Export list for 192.168.1.121: /data/bbs 192.168.1.1/24
5.挂载NFS服务器共享目录到本地系统
[[email protected] ~]# mount -t nfs192.168.1.121:/data/bbs /mnt [[email protected] ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 17981340 2124724 14928464 13% / /dev/sda1 295561 16842 263459 7% /boot tmpfs 60136 0 60136 0% /dev/shm 192.168.1.121:/data/bbs 18375552 1526656 15915456 9% /mnt
6.配置开机自动挂载NFS共享目录
[[email protected] ~]# echo "mount -t nfs192.168.1.121/data/bbs /mnt" >>/etc/rc.local [[email protected] ~]# tail -1 /etc/rc.local mount -t nfs 192.168.1.121/data/bbs /mnt
7.测试数据
[[email protected] ~]# cd /data/bbs [[email protected] bbs]# touch aa [[email protected] ~]# ls /mnt aa
提示: 1.配置NFS服务端后,不用重启NFS服务,只要使用exportfs -rv或/etc/init.d/nfs reload重新加载就可以了
2.rpc主程序Centos5.8下为portmap 、Centos6.4下为rpcbind
3.NFS共享目录不要授权于777权限,可以改所属主和组为nfsnobody,因为nfsnobody权限不是很大,也不能登陆
本文出自 “Mr.Xiong`s 运维日志” 博客,请务必保留此出处http://mrxiong2017.blog.51cto.com/12559394/1932246
以上是关于Centos6.4和Centos5.8混合实例的主要内容,如果未能解决你的问题,请参考以下文章
linux(centos5.8)下如何修改服务器的IP和DNS?求详细的代码和解释