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 in Ubuntu 14.04

Docker is a platform of developer and sysadmins .  With Docker, you will be able to push whole your virtual machines  to cloud.  So you could easily use it everywhere and every time, or share to other people. I will share you the details of Docker installation in Ubuntu 14.04

Install Docker via apt-get:

Run bash completion:

Install Apt Transport Https:

Then, add the Docker repository key to your local keychain.

Open /etc/apt/sources.list.d/docker.list and add text:

And now, install lxc-docker package:




Add user to group Ubuntu

This article to show you some commands that are usually used to moderate user and group in Ubuntu.

Create new user with home directory:

Remove user with related files:

Show groups of user:


And supplementary group to user:

Change user default groups:


htaccess htpasswd Ubuntu

In this example, I assume that you want to all user have to input username/password when access http://localhost/test. And web root directory is /var/www/test.

Make sure that your web server was enable mod_rewrite. And your virtual host allow override all:

To use htpasswd command , you need install apache2-utils:

To implement it, firstly, you create .htpassword file by command:

And then, create .htaccess file:

With content:

Please make note that you have to use absolute path for .htpasswd file.

Done, try a test: http://localhost/test

Add new hard disk in ubuntu

You are using linux on virtual machine (e.g VMWARE) or real PC. I will show you the way how to add new hard disk in ubuntu

Check new device:

/dev/sdb is new hard disk that you needed. In case, you do not see new devive, it means that the OS system does know about new device. So you should reboot your system, If still not, you need install driver software for new device (read device specification and download drivers from device provider)

Be so busy improving yourself that you have no time to criticize others

Be so busy improving yourself that you have no time to criticize others

Start with command:

Follow the guide to add a new partition

And build Linux file sytem in new hard disk (I chose ext4)

And try to mount new hard disk to directory

Test with df command

Finally, add the mount to fstab to automatically mount disk when system start.

Add line:

To apply the new change of fstab file. We use command:

In case the automation fails, you can troubleshoot with command:

A error case:


Install Memcached, PHP Memcache and PHP Memcached in Ubuntu 14.04

As you know, Memcached is great cache system for your web application. Use correctly Memcached will speed up your application so much. So now is how to install memcached, PHP Memcache and PHP Memcached

Install Memcached, PHP Memcache and PHP Memcached in Ubuntu 14.04

In Ubuntu 14.04, the installation is very simple, just need one command:

Please remember restart apache2:

Finally, test your works by writing some PHP scripts.

Add php script to test.php:

Successful result:



Send email with Postfix in Ubuntu

As you know, to install a email server, you should install both Postfix and Dovecot, in this case it is quite complicated.  In case you just need run sendmail function of Postfix, you should install PostFfix and config to relay to a SMTP server that you have.  So in this article, I will show you steps to install and config it.

The scenario of this example as below:

You have a smtp server with configuration information as below

Firstly, install Postfix:

Open /etc/postfix/main.cf change some parameters as below:

And create /etc/postfix/sasl_passwd file and add content below

Type below comand to create sasl_passwd.db:

Restart Postfix:

Finally, test send email (make sure that you installed mail client):

You are done.

In case having errors, you can check log with command:

And now,  you can write a php script, use Swiftmailer library to test send email via transport sendmail

Send mail in Ubuntu server with Gmail SMTP

In a web project, email function is quite important thing.  For sending email you can use a free SMTP server or sendmail function in your server. So how to send mail in Ubuntu server? The answer is Postfix or SSMTP.  But SSMTP is simper way. Because all we have a free smtp server (e.g Gmail SMTP), and also SSMTP is easier to install.

A wise man never knows all, only fools know everything

A wise man never knows all, only fools know everything

Now, you install SSMTP packet:

And open the config file:

Add new content as below (do not forget change your_emal and your_gmail_password, your_gmail_username):

(It seems that Gmail is more secure, so you have to enable less secure to use SMTP Gmail https://www.google.com/settings/security/lesssecureapps)

To test, you need install send mail client:

Finally, do a test:

You are a PHP developer, the server now can run mail php function. However, you are using Swiftmailer Library, you will got a error message as below:

Because Swiftmailer always try to telnet to localhost to check mail server before sending mail. But SSMTP does not support telnet.

So It is time to use Postfix, I will have a article to so you some tips to install it.