Add languages to PHP Docker Container

Recently I have noticed that the output of the following code shows the month in the wrong language (English instead of German):

This can be solved by installing the required language in the docker container. Unfortunately there is a bug which prevents that the languages can be easy activated by locale-gen <lang-code>. So you have to enable them in /etc/locale.gen first and then generate them with locale-gen. This code solves the problem:

Or you could install all available languages:

If you perform a dry run in the container, you must restart Apache for see the changes.

Preparing a Root-Server and install Docker-CE

This is my personal note list for preparing a root server. The list is not complete and may contain errors.

Network setup

  • Install OS as usual or use image from Control Panel

Network setup

  • Set/check fixed ip
  • Set the “Reverse DNS” entry in Control Panel
  • Add local user
    useradd <username>
    usermod -aG sudo <username>
  • Set hostname
    sudo hostnamectl set-hostname <hostname>
  • Edit the /etc/hosts file
  • Edit the /etc/cloud/cloud.cfg file if exists (preserve_hostname: false to true)

SSH

  • Add pubkey to ~/.ssh/authorized_keys
  • Disable SSH login with password and permit root login in /etc/ssh/sshd_config file

  • Restart SSH Daemon
    service sshd restart

VIM

  • VIM Color open ~/.vimrc and add
    colo desert
    syntax on

Docker

  • Install docker-cd here
  • Install docker-compose here
  • Install docker-compose command completion here
  • add username to docker group (source)
    sudo usermod -aG docker $USER

Traefik

  • TBD

fail2ban

  • Update repos and upgrade system
    sudo apt-get update
    sudo apt-get upgrade
  • Install fail2ban with sudo apt-get install fail2ban
  • Create config file /etc/fail2ban/jail.local and add a jail for the SSH Deamon

How to easily clone a (encrypted hard) disk over network (with dd and netcat)

The task was simple: two computers (notebooks). One – we call it A – with a working operating system (Xubuntu) and a new one – we call it B – without operating system. This is how I proceeded:

  1. Create bootable flash drive with in my case Arch-Linux
  2. In the Arch-Linux boot loader, press [TAB] and add “copytoram” to the boot command to load the squashfs image into ram. I needed this because in this case I only had a flash drive at hand. If you have two, you don’t need this.
  3. List network devices:
  4. Assign a IP adress to computer A with:

  5. To identify source disk, list all block devices with:

  6. Prepare the copy operation (do not execute yet!) with

  7. Boot machine B from the same or different flash drive
  8. Assign different IP adress
  9. Identify target device
  10. Prepare the receiving copy operation with

  11. Execute the command on Machine B
  12. Then execute the command on Machine A
  13. Wait until the copying process is completed.
  14. Use at least the Sync command to synchronize corresponding file data in volatile storage and permanent storage
  15. Restart the machine, you are done

How it works/remarks
dd reads the source drive bit by bit into the normal output stream. The output stream is piped to netcat, which sends it over the network to a receiving netcat process (server with -l). Therefore the server must be started first. The server receives the bits and piped them back to dd, which writes them to the target on machine B.

Maybe this is not the best and/or most efficient way, but transfer speed in my case of 75MB/s (poor performance on screenshots is from a setup with two vm’s) is in IHMO very good for this simple setup.

Thanks to pmenke for his support.

Useful Linux/Unix commands

  • How do I find all files containing specific text?

  • How i change the default file permissions (mask that controls file permissions)

  • Untar (unzip) file

  • Copy files via rsync from one host to another

  • nslookup missing? Install dig

  • find without “Permission denied”

Write zeros to a hard drive – Wipe/Erase unused or free space

Windows: Format and write zeros to every sector of the drive.

Windows: Format and write zeros to every sector of the drive. After the first pass write randome numbers.

Windows: Fill free space.

Unix: Fill free space.

Unix: Fill free space on FAT32 drive (4GB limit per file).

To run the process in background see Run command in background on a Synology NAS with nohup

Bugzilla checksetup.pl stops with segmentation fault

After upgrading an openSUSE machine, the Bugzilla installation no longer works. Each run of the checksetup.pl crashes with “segmentation fault”. After updating perl with cpan and some research the solution for the problem was very simple:

  1. Rename the lib folder in the Bugzilla directory
  2. Run ./install-modules –all
  3. Run ./checksetup.pl again

pfSense ipfw rules

Lists zones:

Show rules (Zone ID 2 for example):

Show all tables

Show authenticated/allowed clients (in)

Show authenticated/allowed clients (out)

pfSense 2.2.5 CaptivePortal Patch

Patch for pfSense 2.2.5 to redirect proxy users to the authentification portal.

Diff created with WinMerge.

Install IPKG on a Synology DS415play

I search for a easy guid to install ipkg on my Synology DS415play with Intel Atom CPU. I found a guid by Edward P:

Connect to your NAS as root through SSH
Go to a temporary folder, for example:

Download the bootstrap script:

Make the downloaded script file executable:

Execute the bootstrap script:

Installation should now be completed. To test it, run:

Enjoy.