nfs-ganesha源码编译安装配置说明

一、概览

    nfs-ganesha是一个主要用于linux之间的网络文件共享软件,支持NFS (v3, 4.0, 4.1, 4.1 pNFS, 4.2) and for 9P from the Plan9 operating system. It can support all these protocols concurrently。samba则是主要用于windows和linux之间的网络文件共享软件,支持smb协议。

二、环境版本

系统及相关软件版本说明:

操作系统:CentOS 7

nfs-ganesha源码:V2.7-stable

目前在github上,最新的稳定版本为V2.7-stable,有兴趣的可以去尝试开发版本,但是在编译安装过程中可能会有很多的问题。

查看系统版本:

[root@bogon ~]# uname -a
Linux bogon 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@bogon etc]# cat redhat-release
CentOS Linux release 7.6.1810 (Core)

三、安装依赖


yum -y install centos-release-ceph-luminous

yum install gcc git cmake autoconf libtool bison flex doxygen openssl-devel  gcc-c++ libuuid-devel nfs-utils  uuid-dev krb5-dev -y
# 如果要生成 FSAL_RGW 模块,需要安装 librgw2-devel
yum install librgw2-devel -y 
# 如果要生成 FSAL_CEPH 模块,需要安装 libcephfs1-devel
yum install libcephfs1-devel -y

四、获取源码,一定要checkout该项目依赖的子项目,不然会存在各种问题

[root@bogon repositories]# git clone --recursive -b V2.7-stable  https://github.com/nfs-ganesha/nfs-ganesha.git

五、编译安装

cd nfs-ganesha

mkdir build

cd build

cmake ../src

cmake出错

出错1

        CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found,

原因:

        g++没装上,

解决办法:

        安装 gcc-c++.x86_64

出错2

        Could NOT find BISON (missing:  BISON_EXECUTABLE)

原因:

        bison没安装

解决办法

      yum install -y bison

make && make install

设置配置文件

[root@bogon repositories]# cd /etc/ganesha/
[root@bogon ganesha]# ls
ganesha.conf
[root@bogon ganesha]# vim ganesha.conf

EXPORT
{
        ## Export Id (mandatory, each EXPORT must have a unique Export_Id)
        Export_Id = 12345;

        ## Exported path (mandatory)
        Path = /mnt/oss;

        ## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)
        Pseudo = /user;

        ## Restrict the protocols that may use this export.  This cannot allow
        ## access that is denied in NFS_CORE_PARAM.
        Protocols = 3,4;
        ## Access type for clients.  Default is None, so some access must be
        ## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT block
        Access_Type = RW;

        ## Whether to squash various users.
        Squash = root_squash;

        ## Allowed security types for this export
        #Sectype = sys,krb5,krb5i,krb5p;

        # Exporting FSAL
        FSAL {
              Name = VFS;
        }
}

## Configure logging.  Default is to log to Syslog.  Basic logging can also be
## configured from the command line
LOG {
        ## Default log level for all components
        Default_Log_Level = WARN;

        ## Configure per-component log levels.
        #Components {
                #FSAL = INFO;
                #NFS4 = EVENT;
        #}

        ## Where to log
        Facility {
                name = FILE;
                destination = "/var/log/ganesha.log";
                enable = active;
        }
}

六、 启动ganesha
启动 Ganesha
ganesha.nfsd -f /etc/ganesha/ganesha.conf -L /var/log/nfs-ganesha.log -N NIV_DEBUG

七、 挂载 NFS
[root@node1 mnt]# mount -t nfs4 127.0.0.1:/mnt/oss /mnt/test

挂载成功之后可以看到在/mnt/test 中创建的文件在/mnt/oss中也会同步存在:

[root@bogon ~]# cd /mnt/test/
[root@bogon test]# ls
s2  testdir  x1  x3  xxx
[root@bogon test]# mkdir file
[root@bogon test]# cd /mnt/test/
[root@bogon test]# ls
file  s2  testdir  x1  x3  xxx
[root@bogon test]# mkdir testfile
[root@bogon test]# cd /mnt/oss/
[root@bogon oss]# ls
file  s2  testdir  testfile  x1  x3  xxx
发布了10 篇原创文章 · 获赞 5 · 访问量 4426

猜你喜欢

转载自blog.csdn.net/u010059204/article/details/89320807