Skip to content

HOW TO: VirtualBox Alpine Linux + rclone + samba share #2

@ajkis

Description

@ajkis

Download & Install Virtualbox host: https://www.virtualbox.org/wiki/Downloads
Download Alpine Linux Standard: https://www.alpinelinux.org/downloads/

Open Virtualbox and create new virtual machine:

Type: Linux
Version: Other Linux (64 bit)
Base Memory ( 1024MB + i would recomment at least 2048 )
Storage: 1GB dynamically allocated ( after rclone+samba etc it would still be bellow 500MB)
Storage Optical: Connect alpine ISO image.
Network: Bridged Adapter ( so you can assign your own static IP )
Disable Audio, Serial ports

Boot created virtual machine and once in terminal mode setup your hostname, ip, dns by typing::
setup-hostname
setup-interfaces
setup-dns
After restart network:
/etc/init.d/networking restart

Setup the Alpine Linux on your HDD
setup-alpine

Update Alpine:
apk update
apk upgrade

Install fuse
apk add fuse

Optional
apk add unionfs-fuse

Install Samba
apk add samba samba-common-tools

Before setting up rclone install certificates

mkdir -p /etc/ssl/certs/
curl -o /etc/ssl/certs/ca-certificates.crt https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt
ntpclient -s -h pool.ntp.org

Setup rclone and mount folders

Share rclone mount in samba by adding special samba user and creating smb.conf

Create new user:
adduser --no-create-home --disabled-password --disabled-login mysambauser
smbpasswd -a mysambauser

Create config
vi /etc/samba/smb.conf

[global]
   workgroup = WORKGROUP
   dos charset = cp850
   unix charset = ISO-8859-1

[cloud]
  comment = TV backup
  path = /path to rclone mount /
  browsable = yes
  writable = yes
  read only = no
  guest ok = no
  write list = mysambauser
  read list = mysambauser
  valid users = mysambauser

Add samba to run at startup
rc-update add samba
Start samba;
rc-service samba start

You may consider adding your rclone mount script to boot in local.d so add it to boot by:
rc-update add local default

Now you can make new rclone mount script in
vi /etc/local.d/rclonemount.start

#!/bin/bash
rclone mount
--read-only
--allow-non-empty
--allow-other
--max-read-ahead 14G
--acd-templink-threshold 0
--checkers 16
--quiet
--stats 0
rcloneremote:/ /path to mount/ &
exit

vi /etc/local.d/rclonemount.stop

#!/bin/bash
fusermount -uz /path to mount/
exit

You can read more about local.d : cat /etc/local.d/README

Optionally you can enable SSH and run virtualbox in headless mode

To enable SSH
vi  /etc/ssh/sshd_config
Set : PermitRootLogin yes
restart SSH
/etc/init.d/sshd restart �

To start your virtalmachine in headless mode, create new batch file with content bellow:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "alpine" --type "headless"
exit

To stop or better yet stop and save last state you can make batch:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "alpine" savestate
exit

Once your virtalbox machine is running you can access it by typing in windows explorer:
\THE IP\NameOfShare ( in our case cloud )
use username and password you set for samba.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions