youtube-dl Troubleshooting: ERROR: This video is unavailable

When you want to download some video from youtube with favorite tool youtube-dl, but this error shows up. That means the youtube-dl version that you’re using needs to be updated.

This is how to install the latest version of youtube-dl :

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl 

Or if you installed with pip, you just upgrade it

sudo pip install --upgrade youtube_dl
youtube-dl --version

Setup Kubernetes on Ubuntu 16.04

Summary

This setup is supposedly to install the kubernetes on ubuntu machine with version 16.04 (64bit). I did this in the cloud and have worked perfectly.

# whoami && pwd
root
/root
# apt-get update
# apt-get install -y apt-transport-https
# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
# echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
# apt-get update -y
# apt install docker.io
# apt-get install -y kubelet kubeadm kubernetes-cni

Check the swaps, if there any, swith them off

# /proc/swaps

Init kubernetes for the first time using kubeadm:

# kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=<private IP>

*Note: Change <private IP> to <public IP>, if you run the kubernetes master on single node and wish to publicly open.

# cp /etc/kubernetes/admin.conf $HOME/
# export KUBECONFIG=$HOME/admin.conf
# echo "export KUBECONFIG=$HOME/admin.conf" | tee -a ~/.bashrc

Check pods status, wait until all running

# kubectl get pods --all-namespaces

When their status are RUNNING, moving forward install the network/flannel. Please choose between these two below, I prefer to use the calico one (the second).

# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml

# or

# kubectl apply -f https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml

Continue to taint the nodes:

# kubectl taint nodes --all node-role.kubernetes.io/master-

Install kubernetes dashboard

# kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

Create user dashboard

create-user.yml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kube-system

create-role.yml

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kube-system
# kubectl create -f create-user.yml
# kubectl create -f create-role.yml
# kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

How to set the kubernetes dashboard to publicly accessible with public IP

Read this : https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard—1.7.X-and-above

References

Get rid of “Another update is currently in progress” in WordPress

When you updating one of your resources in wordpress, accidentally you close the window (that’s what I did).

Then when you try to update it again, there is still another process already running. You need to get rid of this before you continue.

Use wp-cli:

wp option delete core_updater.lock

How to convert putty ppk file to pem file

Basically when you working on windows, you most likely use putty to connect to the server. Putty generates the ppk file as the private key.

But the ppk file cannot be using to connect classic linux server or ec2 in AWS. You need to convert this ppk file to pem first in order to use it.

for ubuntu:

$ sudo apt install putty-tools

for centos and other linux:

$ sudo yum install putty

Start converting the ppk to pem

$ puttygen key.ppk -O private-openssh -o key.pem

And you might want to set the permission

$ chmod 600 key.pem

Now the key.pem is ready to use.

Setup read and write samba share in vagrant centos

Tested on vagrant centos 6.9
In your vagrant machine:

$ sudo yum install samba samba-common samba-client

Setup samba config, place this config at the bottom of the file:

$ sudo vim /etc/samba/smb.conf
...
...
[foobar]
browseable = yes
path = /srv/foobar
guest ok = yes
public = yes
read only = no
create mask = 0644
directory mask = 0755
force user = foobar
valid users = foobar
writable = yes
$ sudo /etc/init.d/smb restart

Setup your samba user password, this password will be used for mount the directory from your local machine:

$ sudo smbpasswd -a foobar

In your local machine:

Mount the foobar project directory, enter your samba password here:

$ sudo mount -t cifs -o username=foobar,uid=1003,gid=1003 //10.10.10.1/foobar /tmp/foobar

Explanations command line above:

1003 is the user local id, you can check it by type:

$ id
uid=1003(mylocaluser) gid=1003(mylocaluser)

10.10.10.1 is the vagrant ip address

tmp/foobar is a mounted folder from original directory in vagrant