
地 址:上海市闵行66号
电 话:17709881867
网址:dsesh.com
邮 箱:47375261@qq.com
阿里云挂载云盘是阿里指将阿里云的对象存储服务(OSS)挂载到本地文(wen)件系统,使得用(yong)户可以像访问本地文件一样(yang)访问OSS中的云挂数据,这样可以方便地在本地和OSS之间进行(xing)数据迁移、盘用备份和共享,阿里本文将介绍如(ru)何在Linux系统中挂载(zai)阿里云OSS,云挂并提供一些常见问题的(de)解答。
1. 确保已(yi)安装了阿里(li)云OSS客户端工具`aliyun-oss-cli`,阿里(li)可以通过以下命令安装:


pip install oss2 2. 创建(jian)一个阿里云账号(hao),云挂并登录,盘用在控制台中开通OSS服务,阿里获取`AccessKey ID`和`AccessKey Secret`。云挂

3. 创建一个OSS存(cun)储空间(jian)(Bucket),盘用用于存储文件。
1. 安装NFS服务器
在Linux系统中,云挂需要安装NFS服务器以支持文件共享,盘用以Ubuntu为例,可以使用以下命令安装(zhuang)NFS服务器:
sudo apt-get update sudo apt-get install nfs-kernel-server 2. 配置NFS服务器
编辑`/etc/exports`文件,添加以下内容(假设Bucket名称为(wei)`mybucket`,本地目录为`/mnt/oss`,IP地址段为`192.168.1.0/24`):
exportfs -a echo "/mnt/oss *(rw,sync,no_subtree_check)" >> /etc/exports systemctl restart nfs-kernel-server
3. 将OSS挂载到本地目录
在本地终端中执行以下命令,将OSS挂载到本地目录:
mount --t ossfs mybucket.oss-cn-hangzhou.aliyuncs.com:/ mnt/oss
4. 使挂载生效
为了使挂载在系统重启后依然(ran)生效,需要(yao)修改`/etc/fstab`文件,在文件末尾添加以下内容(假设Bucket名称为`mybucket`,本地目录为`/mnt/oss`,IP地址段为`192.168.1.0/24`):
mybucket.oss-cn-hangzhou.aliyuncs.com:/ mnt/oss ossfs _netdev,ossfsvers=3,rw,relatime,tcp,actimeo=1800,minproto=TCP,maxproto=TCP,port=8888,sec=sys,clientaddr=192.168.1.%d,local_lock=none,private_key_provider=file://~/.ssh/id_rsa_oss_aliyun_cn_hangzhou_mybucket_user name=root:password@ip_address_of_server:port number of IP addresses=20000000000000000000000000000000000000000000000000 blocksize=4k,vers=3,rsize=4096,hard,inode64bit,appendonly=false,directio=true,fallocate=false,ioengine=libaio,relatime,inodeflate=auto,compress=zlib@9,aclmode=private,uid=1000::1777:10056::1777:10275::1777:19954::1777:19955::1777:19956::1777:19957::1777:19958::1777:19959::1777:19963::1777:19964::1777:19965::1777:19966::1777:19968::1777:19969::1777:19972::1777:19983::1777:19984::1777:2268::1777:2269::1777:2283::1778:2283::1783::2283::2283::2283::2283::2283::2333::5432:4646 :::: nfs ip_address_of_server port=8888,version=3 proto=tcp timeout=60 sec=sys,fsck=yes,soft,nfsv3 intr=no,intraddr=none actimeo=1800,mountaddr=none local_lock=none private_key_provider=file://~/.ssh/id_rsa_oss_aliyun_cn_hangzhou_mybucket_user name=root:password@ip_address_of_server:port number of IP addresses=200000000000000000000000000000000000问题1:`mount –t ossfs mybucket.oss-cn-hangzhou.aliyuncs.com:/ mnt/oss`命令无法执行。
“`
sudo apt-get install ossfsutils linux-headers-$(uname -r) libc6 libc6-dev zlib1g zlib1g-dev build-essential git python python-pip python-dev python-setuptools python-wheel python-virtualenv python-cryptography python-jinja2 python-click python-click-plugins python-click-ext python-pycurl rsync curl ca-certificates wget tar bzip2 xz-utils unzip psmisc netcat open=""bsd-netcat subversion git mercurial ant libxml2-utils xmlstarlet zip jq nano sshpass expect screen screenlog fping nmap bindbison flex bison gperf grep sed seddoc make patch texinfo man findutils gettext intltool autoconf automake libtool libtoolize autopoint libtoolize autoconf automake autopoint docbook xmlto textmate gedit gnome-tweak-tool gparted gnome-system-monitor gnome-terminal nautilus gnome-icon-viewer seahorse seahorse-ng tor torbrowser torify transmission-cli transmissionrpc transmissionweb torrenttool transmissiondaemon transmissiongui transmissioncommon transmissionremote transmissiondownloader transmissionuploader transmissionsearch transmissionpause transmissionresume transmissionstop transmissionstart transmissionrename transmissionrm torrentblock torrentblocker transmissionstatus transmissionqueue transmissionpeering transmissionupnp transmissionproxy transmissionsearch torrentedit torrentgen torrenthash torrentmetadroid torrentpaste transmissionpastebin transmissionremotetransmission torrential torrentplus torrentpro torrentrapid torrentripper utorrent utorrentapi vlc vlc media player xdg-open='open' audacity audacity-gnome audacity-plugin-vamp audacity-plugin-steinberg audacity-plugin-equalizer audacity-plugin-filter audacity-plugin-effect audacity-plugin-loop='loop' audacity-plugin-mixer audacity-plugin-multitrack audacity-plugin-projector audacity-plugin-sequencer audacity-plugin-soundfont audacity-plugin-spectrogram audacity-plugin-tageditor audacity-plugin-timestretch audacityscripting audacityscriptingbundle audacityscriptingextras alsa-utils pulseaudio pulseaudioconf alsa-utils pavucontrol pavucontrolgtk pavucontrolqt pavucontrolgstreamer pavucontroljack pavucontrolalsa pavucontrolalsawrapper pavucontrolgst alsaaudiosink alsaaudiosource alsadocumentation alsaexamples alsaextralibs alsainitconf alsainitfiles alsainitscript alsainstallers alsamanpages alsamodules alsaprofiles alsaregistry alsasessionconf alsasessionfiles alsasessionscript alsasettings alsastateconf alsastatefiles alsastatescript alsautils alsavolumeconf alsavolumefiles alsavolumescript alsawidgets pulseaudioconf pulseaudiodevices pulseaudiosinkpulseaudiosrc pulseaudioutils pulseaudiowidgets pulseaudiox kbd module configuration tools emacs e