How to install ffmpeg in CentOS

Every now and then you will be required to read or analyse video files on a server that is running on CentOS or you may be using it docker container. Here are the steps to install ffmpeg on your linux machine:
sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
sudo yum update -y
sudo yum install ffmpeg ffmpeg-devel -y

Vault – Beginners Guide (Go)

If you haven’t used Hashicorp Vault till today, this post is for you.

So here are our tasks for this post:

  • Setup Vault Server
  • Add SSH keys to it
  • Get key from the vault via a Go program

Note: All secrets/keys generated during this setup are for demo only.

Vault Server Setup:
[[email protected] ~]# mkdir -p /opt/hashicorp/vault
[[email protected] ~]# cd /opt/hashicorp/vault/
[[email protected] vault]# wget https://releases.hashicorp.com/vault/0.6.5/vault_0.6.5_linux_amd64.zip
[[email protected] vault]# unzip vault_0.6.5_linux_amd64.zip

Download the sample config from and store it as config in current directory: https://www.vaultproject.io/docs/config/

In the config you can use several backend modes and they are all listed on the above page in detail for this setup we will use the file backend with no HA. This means that all the data will be stored on the file system in a directory structure.

So my config looks like this:

Now lets start the server and send it to background:

Initialize the vault, please note that if you are not using tls you will need to export the environment variable with http before using the vault binary as the client:

export VAULT_ADDR=http://127.0.0.1:8200

Unseal the vault and authenticate, by using the keys that were generated for you:

Add SSH Key to Vault:

Once the server is unsealed, we can add our secrets to it, Lets generate an SSH key and save it in the vault for later:

Retrieve the Key in a Program/Script
You can use Go Hashicorp api package to connect to vault:

Output of the program:

This was demonstration of basic vault server setup and client authentication. There are many more different aspects to it. For further information please refer to vault documentation https://www.vaultproject.io/docs/concepts/index.html

Quickly Improve Boot time with Systemd

Recently I upgraded to Ubuntu 16.04 on my machine and just for curiosity I wanted to improve the boot time.

So to identify the slow services I used:
jahans:~# sudo systemd-analyze blame
18.944s docker.service (I create containers on servers, don't need to start on boot)
12.833s dev-sda8.device (Root Parition)
11.523s teamviewerd.service (Just used it one off, dont create a service for it!)
8.943s ModemManager.service
8.273s NetworkManager-wait-online.service
7.828s postfix.service (Good to have, but I don't send emails with spoofed addresses)
7.203s apparmor.service
7.011s networking.service
6.936s apport.service
6.867s irqbalance.service
6.689s speech-dispatcher.service
6.450s cgroupfs-mount.service
6.360s snapd.autoimport.service
6.359s systemd-user-sessions.service
6.359s alsa-restore.service
6.355s gpu-manager.service
6.354s pppd-dns.service
6.352s rsyslog.service
5.946s bluetooth.service (Never used it)
5.940s thermald.service
5.938s avahi-daemon.service

I went through the list and identified the services that I didn’t use on daily basis and improved the boot time significantly. So to disable the services I didn’t use I ran:
systemctl disable docker
systemctl disable teamviewerd
systemctl disable postfix
systemctl disable bluetooth

To understand the dependencies of the services you can also use the following for a graphical view:

sudo systemd-analyze plot > srv.test ; eog srv.test

Vim – Putty Numpad Issue

– Do you use putty?
– Do you use vim?
– Do you “have to” use windows at times?

Well this post is for you. You must have found yourself in an annoying issue when you cant use num pad in vim. Fortunately you can fix that:

Open Putty window and in the configuration, go to Terminal->Features and check "Disable application keypad mode". Save the settings.

Now restart that session you were working with and enjoy vim!