Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Friday, September 14, 2018

Nextcloud, VirtualBox and Shared Folders

Update 10/1/2019 - Getting rc.local to work

I've had trouble getting rc.local to work on VMs with newer versions of ubuntu.  My best efforts are to install samaba, smbclient, run through this, then to actually execute rc.local (running rc.local seems to be critical to get it to run on startup).

Original Post -

This might not be how you're supposed to do it, but it's what worked for me.

Install ubuntu server

Install VirtualBox guest additions

Install Nextcloud

Setup your shared folder of choice in VirtualBox.  I'm not going to talk about doing that, it's pretty straight forward.  I checked automount, though that doesn't seem to help.

I made a directory within /var/snap/nextcloud/common/nextcloud/data/ called share.  You might have to sudo su to do it.

Mount your shared folder to that directory:

  1. sudo mount -t vboxsf share /var/snap/nextcloud/common/nextcloud/data/share/



Auto mounting at startup
  1. Edit /etc/rc.local
    sudo -H nano /etc/rc.local
    
  2. Before exit 0 type:
    mount.vboxsf share /var/snap/nextcloud/common/nextcloud/data/share/ vboxsf
  3. Save and exit, please and thank you.
If you restart your VM, that folder should now be mounted persistently.

If you want to see that folder in Nextcloud, you need to enable External Storage Support in Apps, then in settings, direct the path to the Local share directory you created above, /var/snap/nextcloud/common/nextcloud/data/share/ in my case.

Looks like the Nextcloud community knows that samba doesn't work with the snap installer, however I couldn't successfully install Nextcloud without snap.  It's discussed here, I'm not sure what the downside is to adding shares in your data directory other than accidentally writing files directly to /var/snap/nextcloud/common/nextcloud/data/share/ , instead of to your shared folder.  Maybe a security risk?  I'm not sure.

But I don't really want a huge VM taking up gigs of space, and I'd like to get to the shared files directly, without using the web UI sometimes.  AND I can leave a tiny VM running on my server's boot SSD, rather than having it on a spinning disk, that may or may not be spun up at any given point (would probably even stop it from spinning down).

I got SSL running with my own certs too, based on this.

I used SSL For Free and DNS verification to authenticate the subdomain I'm running this on.

I renamed the files to be: certificate.crt to cert.pem,   ca_bundle.crt to chain.pem, and  privkey.pem to privkey.pem.

I ran sudo nextcloud.enable-https custom -s cert.pem privkey.pem chain.pem and got an error, but it made a directory that I need.

Then I coppied my three files into /var/snap/nextcloud/current/certs/custom/

Than reran sudo nextcloud.enable-https custom -s cert.pem privkey.pem chain.pem

BINGO!!!

This is my next project, except hosted locally:


and

Saturday, January 23, 2016

Symbolic Link on QNAP (Linux)

The Qsync folder on a QNAP NAS is a hidden directory, so it's hard to add to things like Plex.

Luckily, the solution is a Linux one, rather than a QNAP one.

I like using Qsync because I hate sorting through hundreds of files to make sure things are backed up between two directories.  I'd much rather manage one directory than two.

Before you try anything on your NAS, understand that you are operating outside the safety of the QNAP interface.  You could really mess things up if you aren't careful.  Therefore no warranty is part of this whatsoever!  Proceed at your own risk!

A symbolic link is nice because it doesn't make a copy of your files, it just points to them.  You can put those pointers in a convenient place.

So... download Putty and SSH into your QNAP.

After you login with your QNAP's IP address, and your credentials, enter the following command to create a symbolic link between the admin's Qsync folder and a new symbolic folder called "movielink".  Of course you can name it anything you want.  This can also be done with other user's Qsync data, just change "admin" to whatever their username is.  Keep in mind that these folders are fully linked, read and write.  So only make sure you link with users that won't wipe out your data!

[~] # ln -s /share/homes/admin/.Qsync/ /share/homes/admin/movielink

Ta Da!  Now if you go to the Filestation you can see your new folder

If you make a bad link, or want to remove the one you created, enter this command:

[~] # rm /share/homes/admin/movielink

That's all there is to it.  Now my Plex server can access Qsynced content!