Điều kiện tiên quyết
Phân vùng bạn muốn sử dụng phải được gắn ở đâu đó trong /media/hoặc /mnt/. Đây là những vị trí duy nhất mà snap có thể truy cập trong phạm vi hạn chế bằng removable-media để cấp quyền truy cập nhanh vào các ổ đĩa ngoài.Bạn cần cấp quyền truy cập nhanh để truy cập phương tiện di động bằng câu lệnh kết nối sau:
sudo snap connect nextcloud:removable-mediasudo mount --bind /mnt/dir_with_contents /media/nextcloud_local_dir
Để kểm tra xem snap đã kết nối chưa bạn chạy câu lệnh sau:
sudo snap connections nextcloudInterface Plug Slot Notes
network nextcloud:network :network -
network-bind nextcloud:network-bind :network-bind -
network-observe nextcloud:network-observe :network-observe manual
removable-media nextcloud:removable-media :removable-media manual Nếu bạn vừa cài đặt snap và chưa tạo người dùng quản trị
Quyết định nơi bạn muốn dữ liệu mới tồn tại. Chúng tôi sẽ sử dụng
/media/nextcloud/data. Đảm bảorootcó quyền ghi, nhưng người khác không thể truy cập, ví dụ:sudo mkdir -p /media/nextcloud/data sudo chown -R root:root /media/nextcloud/data sudo chmod 0770 /media/nextcloud/dataCập nhật cấu hình Nextcloud để sử dụng thư mục dữ liệu mới bằng cách chỉnh sửa
/var/snap/nextcloud/current/nextcloud/config/autoconfig.phpvà đảm bảodirectorycài đặt được trỏ đến đúng nơi, ví dụ:// ... 'directory' => '/media/nextcloud/data', // ...sudo nextcloud.occ config:system:set --value='/media/nextcloud/data' directoryBây giờ, khởi động lại dịch vụ PHP:
sudo snap restart nextcloud.php-fpmNếu bạn đã truy cập Nextcloud trước đây, hãy làm mới để đánh giá lại cấu hình đã thay đổi (nếu không, cấu hình
directorysẽ không thay đổi so với mặc định).Đặt làm người dùng quản trị của bạn như bình thường và tiếp tục, Nextcloud đang sử dụng dữ liệu bên ngoài.
Câu lệnh đặt quản trị viên:
sudo nextcloud.manual-install admin P@ssword
Nếu bạn đã tạo người dùng quản trị
Quyết định nơi bạn muốn dữ liệu mới tồn tại. Chúng tôi sẽ sử dụng
/media/nextcloud/data, nhưngdatathư mục sẽ được tạo bằng cách di chuyển dữ liệu hiện có vào vị trí, vì vậy chúng tôi chỉ cần thiết lập/media/nextcloudngay bây giờ:sudo mkdir -p /media/nextcloudCập nhật cấu hình Nextcloud để sử dụng thư mục dữ liệu mới bằng cách chỉnh sửa
/var/snap/nextcloud/current/nextcloud/config/config.phpvà đảm bảodatadirectorycài đặt được trỏ đến đúng nơi, ví dụ:// ... 'datadirectory' => '/media/nextcloud/data', // ...sudo nextcloud.occ config:system:set --value='/media/nextcloud/data' datadirectoryNgừng chạy nhanh trong giây lát:
sudo snap disable nextcloudDi chuyển (hoặc sao chép) thư mục dữ liệu hiện tại đến vị trí mới:
sudo mv /var/snap/nextcloud/common/nextcloud/data /media/nextcloud/Bật lại snap:
sudo snap enable nextcloud
Và bạn nên thiết lập và chạy bằng bộ nhớ ngoài cho dữ liệu của Nextcloud.
THAM KHẢO THÊM:
Full walk-through from clean Ubuntu to Nextcloud with external (mounted) storage.
1. Install the nextcloud snap
sudo snap install nextcloud
2. Connect the removable-media plug as mentioned in the README in order to grant the snap permission to access external drives.
sudo snap connect nextcloud:removable-media3. Plug in your external media, and locate its drive name. You will likely have a bunch of /dev/loopX drives (where X is a number), ignore those. You are looking for (probably) /dev/sdb, or whichever drive matches the size of your 8TB external. I assume the drive is partitioned, and you will be using /dev/sdb1 for the rest of this walk-through. If not, google how to partition the drive for Linux use and come back.
lsblk -o name,mountpoint,label,size,fstype,uuid | egrep -v "^loop"
sudo nextcloud.occ files_external:list
sudo fdisk -l
4. Create a directory to mount the drive, and mount it.
sudo mkdir /mnt/external && sudo mount /dev/sdb1 /mnt/external5. Create a bind mount (symlinks won't work and hard links are not allowed in /media) to where your data is. We have to use /media because that is the directory that the removeable-media plug allows the nextcloud snap to access.
sudo mount --bind /mnt/external /media/nextcloud6. In nextcloud enable the external storage app. Log into the web interface as admin and click the A in the top right corner and select + Apps. Then click Enable for External storage support.
external-enable
7. Click the A again and then click Settings. Under Administration, add a local storage with the path /media/nextcloud.
add-storage
8.Profit!
Nguồn:
https://github.com/nextcloud/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition
https://manandkeyboard.com/2018/01/07/nextcloud-snap-installation/comment-page-1/

0 Nhận xét