How to mount Windows shared folder to Linux via Samba

Assuming you have shared the windows folder to local nerwork.

To permanently mount Samba folder into Linux Machine located on the same network. You need:

1.Install CIFS drivers in Linux

sudo apt install -y cifs-utils

2. Creare mount point

sudo mkdir /media/samba

3. Add mount config to fstab

sudo nano /etc/fstab

Add this line to the fstab file:

//<ip addresss of windows machine>/<share name> /media/samba cifs user=<user>,pass=<password>,nofail 0 0

That’s it, not just mount it by running:

sudo mount -a

Install Docker on Debian 9

Here is a simple script to install docker on Debian 9

  1. Create the script text file with nano
sudo nano install_docker.sh

2. Copy this code to the file and save it

#!/bin/bash 
# Run this script to install Docker on Debian 9

#Install prerequisites
sudo apt update
sudo apt -yes install apt-transport-https ca-certificates curl gnupg2 software-properties-common

# Add the GPG key for the official Docker repository to your system:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

# Add the Docker repository:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

# Istall Docker
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose

# Show from which repository DOCKER will be installed
echo "--- We are goint to install DOCKER from below repo ---
apt-cache policy docker-ce

echo "---------------- INSTALLATION FINISHED ---------------"

# Check docker status
sudo systemctl status docker

3. Make it executable:

chmod +x install_docker.sh

4. Run the script

sudo ./install_docker.sh

P.S. it might work on other systems aside fro Debian 9, but tested on Debian 9. This script is intended to simplify Docker setup in case I need it in the future.

Run Docker inside XLC container in Proxmox

  1. Create (preferrably unpriviliged) container
  2. Add the below configs to the container conf file:
cat <<EOT >> /etc/pve/lxc/101.conf
    #insert docker part below
    lxc.apparmor.profile: unconfined
    lxc.cgroup.devices.allow: a
    lxc.cap.drop:
    EOT

3. Install following apps inside container:

apt install wget apparmor

Thats It.

Optionally, enable overlay file system (on the PVE host):

# add the those lines in /etc/modules-load.d/modules.conf :
aufs
overlay

Getting Thing Done, really doing it

I have come across multinple approaches and systems to help you get through the work efficinetly and reach your goals.

And the main conclusion: any system is better when exececude well, than looking for a better system.

GTD, Kanban, Agile etc… Try any of those, but you need to pick one and implement it 100% to become efficint before trying something else

Interesting article

LeanKit tool website, looks promising

Lean blogs list

Time Machine alternative for linux: automate your backups

Introduction

MacOS has a good backup system which allows you to recover any files that have beed deleted or to restore previous versions of the files. I works like you can literally come back into a certain moment back in time.

Now that I have set up Raspberry Pi based home NAS, I found a solution that achieves the same results on linux: incrental backups with rsync.

Instruction: how to automate backups on Linux

Step 1. Set up rsync backup script, with instructions and settings on how to run the backup

sudo mkdir /usr/local/scripts      #to make folder to store scripts
sudo touch /usr/local/scripts/backup.sh # to create the script
sudo chmod +x  /usr/local/scripts/backup.sh  # make it executable
sudo nano /usr/local/scripts/backup.sh  #THEN EDIT THE SCRIPT:

Copy this code into the script:

# This script makes backups from DATADIR to BACKUPDIR and puts in 
# date-named folders corresponding to date of each backup
# SYNTAX:  $ ./backup.sh </DATADIR/ ($1)> </BACKUPDIR/ ($2)>
# Example: $ ./backup.sh /media/data/ /media/backup/

# To be able to use CTRL+C to exit script:
trap "exit" INT 

# Define the directories for backup
DATA=$1
LAST_BACKUP_PATH=$2/$(ls $2 | tail -n 1)
THIS_BACKUP_PATH=$2/backup_in_progress

# Make the backup
rsync -av --link-dest ${LAST_BACKUP_PATH} ${DATA} ${THIS_BACKUP_PATH}

# Move the backup to date-named folder after it's finished
mv $2/backup_in_progress $2$(date +%Y-%m-%d)

Step 2. Set up cron job to run the backup script on a schedule

sudo crontab -e

To backup DATA_DIR to BACKUP_DIR at 3am every night, add this to your cron file:

# BACKUP SCRITPS
# WHEN       SCRIPT DIR                    DATA_DIR     BACKUP_DIR
  0 4 1 * *  /usr/local/scripts/backup.sh  /data/dir/  /backup/dir
  0 3 * * *  /usr/local/scripts/backup.sh  /data2/dir/ /backup2/dir
# - - - - -  CRON SYNTAX explained below:
# | | | | |
# | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
# | | | ------- Month (1 - 12)
# | | --------- Day of month (1 - 31)
# | ----------- Hour (0 - 23)
# ------------- Minute (0 - 59)

Useful Links

More on cron read here, or crontab calculator here

Bash scripts 101