#Linux

Vagrant – Failed to mount folders in Linux guest

I usually use Vagrant in Development Environment.  I need Vagrant to create Ubuntu Server on Windows 10 Desktop. Everthing work fine until one day, I met an error “Failed to mount folders in Linux guest”.

So I fixed it by command below:

Education is the most powerful weapon which you can use to change the world

Education is the most powerful weapon which you can use to change the world

If you meet an error as below

You have to change Vagrant Home Directory to a path without spaces.

 

Install Docker and Docker Swarm on CentOS7

This tutorial will show you how to install Docker and Docker Swarm on CentOS7. This tutorial is for Docker Version 1.11 and I use Vagrant and VirtualBox to create CentOS 7 in Virtual Machine.

Stop worrying about what you have to loose and start focusing on what you have to gain

Stop worrying about what you have to loose and start focusing on what you have to gain

Create a Vagrantfile for CentOS7

Turn on your Virtual Machine with command:

After finishing creating CentOS server, you access the server via SSH by command:

Docker

Go to root account:

In the next step, we will install Docker Engine following the official tutorial of Docker.

Add Docker Repository  into CentOS

Running the installation

Start Docker Service

Enable Docker run on OS Start

Docker Swarm

Installing Docker Swarm via Docker Pull

Open Docker Service Configuration file

In the line contains ExecStart, we add text as below

And now, reload Docker Service

Now we can run Swarm Node

And running Swarm Manage

Finally, verify your work

Video

Thanks for your reading!!!

Delete a commit from branch in Git

I sure that there is at least once time in the life of a programmer, they need to delete a commit in the history of a branch. So I write this post to share you the way to delete a commit from branch in Git.

My example is we have a git log tree as below:

And you are working on branh DEV, you need to remote “Commit C” from branch DEV. So you should use command git rebase -i

In there, “ea61baa” is the hash key of “Commit C”. After entering the command, a editor will be opened with the content below:

You have to remove line

After that, save it.

You are done, just re-check by git log command

You can see that “Commit C” now is not in branch dev.

OpenSSL generates keys

Sometimes, you have to generate the keys for your projects. You can use the coomand below:

Create a Private CA

Public CA

Sign Keys

CSR

Certs

 

PostgreSQL Command Line

There are many different between MYSQL and PostgreSQL. One of them is PostgreSQL is Command Lines.  I write as below for the reference as needed.

70f45f89-72f1-456a-a952-86e2910d04f2-medium

What motivates me? The fear of being average

Show databases

Connect to database

List all tables

Show table schema

Dump a table

Import a table or database:

Time comparison:

 

Backup Cassandra to S3 SWS

This post is just a small post. I would like to show you a way to incremental backup Cassandra to S3. In my case, I use a opensource named Cassandra_Snapshorter.

To know how to install it in your machine, you can refer to https://github.com/tbarbugli/cassandra_snapshotter

Now, we create a backup script

After that, We will create a job in Crontab to run backup every night.

Convert WMV to MP4 in Ubuntu

Sometime, I use EZVID to create a video. The size of the file created by EZVID usually is bigger than my expectation. So I have to use avconv command to convert that video.

To install avconv in Ubuntu Server, we use command:

To convert the file, we use the command below:

 

Install Kamailio in Debian/Ubuntu

Actually, I am not a guy works in telecommunication  technology. But I know about SIP when I was a student in University. Recently,  I had a task install Kamailio for Mobile Team can make a test call via SIP.  I would like to record the steps here.

Kamailio

The first step, we add apt-key with command:

Add the package to source.list file (I am using Debian Jessie)

For the other version: https://www.kamailio.org/wiki/packages/debs

f2ef325b-7c5c-477a-bc87-e344f64f6d5b-original

Install:

 

After finishing the installation, you have to edit  /etc/default/kamailio file:

Restart Kamailio:

Kamailio and Mysql

In my case, I used Mysql DB with Kamailio. So I install mysql:

And you have change /etc/kamailio/kamctl to setup Kamailo connect with Mysql

And you should initiate database for Kamailio on Mysql now:

Add the first SIP account with command:

Show the list of the subscribers:

Now,  you can install a SIP client to test your SIP server. I suggest you use Jitsi

To troubleshoot your calls, you can use tcpdump, lsof command. And show Kamailio logs (tail -f /var/log/syslogs)

TLS

At the first, we should change /etc/kamailio/kamailio.cfg by adding a line:

And restart Kamailio.

To verify, we can use lsof command:

Thanks for your reading!!!