ubuntu18.04.1 fuse文件系统的安装

参考:https://www.jianshu.com/p/040bb60aa468

1. 下载fuse库

https://github.com/libfuse/libfuse.git   //git仓库地址

2. 编译需要的模块安装

apt install meson
apt install ninja-build
pip3 install pytest  //如果失败,是因为源的问题,替换成国内源就行了。 pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pytest

3. 编译安装fuse

cd libfuse
mkdir build
cd build
meson ..		

出现以下内容编译成功:

Checking for function "fork": YES
Checking for function "fstatat": YES
Checking for function "openat": YES
Checking for function "readlinkat": YES
Checking for function "pipe2": YES
Checking for function "splice": YES
Checking for function "vmsplice": YES
Checking for function "posix_fallocate": YES
Checking for function "fdatasync": YES
Checking for function "utimensat": YES
Checking for function "copy_file_range": YES
Checking for function "fallocate": YES
Checking for function "setxattr": YES
Checking for function "iconv": YES
Checking whether type "struct stat" has member "st_atim": YES
Checking whether type "struct stat" has member "st_atimespec": NO
Configuring config.h using configuration
Message: Compiler warns about unused result even when casting to void
Dependency threads found: YES
Library iconv found: NO
Library dl found: YES
Library rt found: YES
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Native dependency udev found: YES 237
Program install_helper.sh found: YES (/mnt/hgfs/libfuse/util/install_helper.sh)
Build targets in project: 26
Found ninja-1.8.2 at /usr/bin/ninja

然后继续:

cd ..		//libfuse
python3 -m pytest test/
cd build
ninja install

到这里fuse的编译安装就完成了。
接下来进行一个简单的测试:

cd libfuse/example
gcc -Wall hello.c `pkg-config fuse3 --cflags --libs` -o hello  //编译hello.c 编译方式在文件的注释中有
cd /mnt
mkdir hello_test  //建立挂载目录
cd libfuse/example
./hello /mnt/hello_test/ 		//挂载

若显示:

./hello: error while loading shared libraries: libfuse3.so.3: cannot open shared object file: No such file or directory

是因为没有配置ldconfig:

vim /etc/ld.so.conf.d/fuse.conf

输入:

/usr/local/lib

执行:

ldconfig

重新挂载:

./hello /mnt/hello_test/ 

现在挂载成功啦!!!

进入hello_test目录,可以看到hello文件:

cat hello 		
Hello World!		//显示结果
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值