網頁

2015年9月27日 星期日

Docker 1.7.1 --- How to change the docker image installation directory in Ubuntu/Lubuntu 15.04

In general, the Docker will put all the data including images under /var/lib/docker after install the Docker package. It is easy to get the space problem so that need to move the docker default location to new place.  That is to mount docker default location /var/lib/docker to new mount point.
How to do it?

At first, we will prepare the new block storage for planning the moved docker folder
  1. Add a new disk about 20GB
# sudo fdisk -l
AS-IS
TO-BE
  1. Create a new partition by using the sudo fdisk /dev/sd?  
  1. with g option for creating a new empty GPT partition table
  1. with n option for adding a new partition
  1. with p option for printing the partition table and with w option for writing table to disk and exit

  1. Format the new block storage device with ext4 file system
# sudo mkfs.ext4 /dev/sd??

  1. Mount the new block storage device
    1. create a mount point
# sudo mkdir -p /mnt/diskX
    1. mount the file or do equivalent mount in /etc/fstab
# sudo mount -o bind /dev/sd?? /mnt/diskX
    1. create a new folder to house docker
# sudo mkdir /mnt/diskX/docker
# sudo chmod 700 /mnt/diskX/docker

When the new space is ready and mounted, we will move the docker image from the the original path to the new path.
How to do it?
  1. In Ubuntu/Lubuntu 15.04, check out system-wide information
# sudo docker info

  1. In Ubuntu/Lubuntu 15.04, stop containers and docker daemon
# sudo docker ps -q | xargs docker kill

# sudo service docker stop

  1. In Ubuntu/Lubuntu 15.04, if it exists /var/lib/docker/aufs/mnt
# sudo -s
# cd /var/lib/docker/aufs/mnt
# umount ./*
# exit

  1. In Ubuntu/Lubuntu 15.04, move /var/lib/docker to the new mounted storage device
# sudo -s
# mv /var/lib/docker/* /mnt/diskX/docker/
# exit

  1. In Ubuntu/Lubuntu 15.04, set the flag in /etc/default/docker & /etc/init.d/docker to
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 -g /mnt/diskX/docker"
/etc/default/docker

/etc/init.d/docker

  1. In Ubuntu/Lubuntu 15.04, bind mount instead of linking
# sudo mount -o bind /mnt/diskX/docker /var/lib/docker

  1. In Ubuntu/Lubuntu 15.04, periste on restart about mount new disk and bind mount by editing /etc/fstab file and adding the following content:
UUID /mnt/diskX ext4 defaults 0 0
/mnt/diskX/docker /var/lib/docker bind defaults,bind 0 0

  1. In Ubuntu/Lubuntu 15.04, restart docker daemon by using the sudo service docker start command

  1. test that when you create a container the hash appears in /mnt/diskX/docker/containers
After finishing the above step and starting a container, the available space will be extended now.
AS-IS
TO-BE


2015年9月20日 星期日

Pidgin 2.10.9 --- How to install Pidgin-Sipe 1.20.0 through source package on Ubuntu/Lubuntu 14.04

If we want to connect to the company's Lync server using Pidgin, we have to install a SIPE plugin because it can connect to a Lync server next to do text chat.
When the "pidgin" package is installed from the distribution repository,  we will download the latest package as version 1.20.2 from SIPE repository and extract it next to prepare for compiling SIPE from source code.


Due to we want to compile Pidgin-Sipe from source code, we will specify the correct installation path in configure. Usually Pidgin-SIPE is installed in /usr so the following command should work
./configure --prefix=/usr
If we get errors(# 1) then there is missing some required package(# 2), we need to install the necessary libraries until the the configure procedure is successful.

When the configure complete, we will continue to run ‘make’ now.


After successful compilation we can install SIPE with ‘sudo make install’ now


So do that the Pidgin plugin for MS Office Communicator and MS Lync will be installed now.  


Reference:
(# 1)     If we get errors from configure or libtool about version conflicts then we need to regenerate the autoconf files. 
That is need these additional packages
autoconf
automake


Now we should be able to regenerate the files with “autoreconf --verbose --install --force” and go back to the configure step again.


(# 2)     In the README file of the extracted SIPE, we can refer to what is requried pacakge as follow:
===================================================================
Depending on your distribution you'll need to install one of the following packages
libpurple-dev
libpurple-devel


For the compilation you'll need to install a C compiler and some of the following packages
libtool
intltool


pkg-config
libglib2.0-dev
libxml2-dev
libgmime-2.4-dev  (optional)
libgmime-2.6-dev  (optional)


pkgconfig
libglib2-devel
libxml2-devel
gettext-devel
gmime-devel       (optional)


You have to choose between NSS or OpenSSL for the crypto backend. You'll need one of the following packages
for NSS:
libnss3-dev
nss-devel
mozilla-nss-devel


for OpenSSL:
libssl-dev
openssl-devel


If you want to enable Kerberos authentication support then you'll need one of the following packages
libkrb5-dev
krb5-devel


If you additionally want to disable the internal NTLM implementation and authenticate with NTLM via GSSAPI then you'll need one of the following packages
gssntlmssp-devel


If you want to enable Voice & Video features then you'll need some of the following packages
libnice-dev           (>= 0.1.0)
libgstreamer0.10-dev


libnice-devel         (>= 0.1.0)
gstreamer-devel
===================================================================

2015年8月30日 星期日

Docker 1.7.1 --- How to enable Non-root Users to run Docker command

Since Docker version 0.5.3, the docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo.
If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group because the docker group is equivalent to the root user.

To create the docker group and add a user or users to by using the sudo usermod -aG docker davidwa command.
To remember that you will have to log out and log back in to ensure this user is running with the correct permissions.

To verify its mechanism works by running docker with sudo as follows:
So do that we can execute Docker command without root right now.

Docker 1.7.1 --- How to change hostname on Docker Container in Ubuntu/Lubuntu 15.04

In general, we do any changes in a container and the result is not permanent. That is, if we log out and attach to it again, all changes will be lost so that get back the initial container.
Of course, we can avoid this problem by using the docker commit command so that the changes will be made permanent.

If we want to change hostname on one container, whether there is a alternative method to do it.  
Yes, we can directly edit config.json to adjust some parameter!

How to do it?
At first, we need to check the running container status by using the sudo docker ps | head command
To stop a container by using the sudo docker stop command
To stop Docker service by using the sudo service docker stop command
To edit config.json in the /var/lib/docker/containers// directory
and replace “Hostname”:”” with “Hostname”:””
AS-IS:

TO-BE:

To start Docker service by using the sudo service docker start command
To start a container by using the sudo docker start command
So does that the hostname on Docker container has already been changed now.
AS-IS:
TO-BE:

2015年7月25日 星期六

VirtualBox 5.x --- How to resolve a problem that cannot add VM machine by VirtualBox Manager

When I want to add the old VM into the VirtualBox Manager on Ubuntu/Lubuntu 14.04,

I get some error as “Could not find an open hard disk with UUID {...}”
I am not sure what happen and just want to resolve this problem quickly so that search some information by Google. To summary the related process for the interesting guys.
At first, the command “VBoxManage showhdinfo ”  will be executed for showing information about a virtual hard disk image.
We need to make a backup of the .vbox file before edit the .vbox file for recovery discussion. Leter, we will open the .vbox file next to find the "" line that references the UUID for the "missing" disk.
It should be inside of an section inside of a section.
Remove the entire section and save the file.
To do the same action for adding machine, the existing VM can be added now.
The UUID of the disk also is corrected now.
Although I think the problem has already been resolved, maybe need to double confirm the disk structure. After close the VirtualBox Manager and open it again, the fixed VM still be inaccessible.
The reason will be the disk with UUID doesn’t exit in the some configuration file with the extension as .vbox & .vbox-pre
To add this UUID record on .vbox & .vbox-pre as follows:
So does that the VM will be normal in the VIrtualBox Manager now.

2015年6月7日 星期日

Ubunut/Lubuntu --- Install the current or nearby release Wireshark version on Lubuntu 14.04

What is the popular network analyzer in the 'Open Source' world? I think the Wireshark will be best choose. 
Although the Wireshark package list in the most Linux distribution repositories, the current or nearby release version almost not exist in the default repositories. This is why we need to do other choice by finding the PPA or compiling the Wireshark source.

Install Wireshark via PPA 
(# 1)
In a terminal, we have to add the PPA to the Lubuntu 14.04 system by using the sudo add-apt-repository ppa:pi-rho/security command.
next to update the local repository index with the latest change by using the sudo apt-get update command. 

Finally, install the Wireshark package by using the sudo apt-get install wireshark command

In the installation process, we have to do other steps for the specific user to use wireshark if we choose the non-superusers can capture packets.
                              
To create a new group 'wireshark' by using the sudo groupadd wireshark command
To add a login user to a specific group by using the sudo usermod -G wireshark -a command
To change a group ownership of a file/files by using the sudo chgrp wireshark /usr/bin/dumpcap command
To set a file/directory permission by using the sudo chmod 750 /usr/bin/dumpcap command.
To grant the use of RAW/PACKET sockets(cap_net_raw) and various network-related operation(cap_net_admin) capabilities by using the sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap command. (# 2)
To verify this change by using the sudo getcap /usr/bin/dumpcap command.

At the moment, please log out and back in for the new group assignment to take effect and execute the wireshark command in the terminal. So do that we can see the full list of available adapters and can begin sniffing now.

Install Wireshark from Sources
Install the Wireshark required dependencies including tools/libs by using the sudo apt-get build-dep wireshark (# 3) 
and sudo apt-get install qt4-default command.

To download the Wireshark archive from Wireshark Official WebSite  or by using the wget https://2.na.dl.wireshark.org/src/wireshark-1.12.5.tar.bz2 --no-check-certificate command.

To unpack the Wireshark compressed file by using the tar -xjvf ./wireshark-1.12.5.tar.bz2 command and change directory to the extracted folder

To configure the build directory by using the ./autogen.sh script.

To compile the source for building correctly the Linux version by using the ./configure --enable-setcap-install script.
To build the sources by using the make command
To install the software by using the sudo make install command.

To run sudo ldconfig to properly update the shared library symbolic link.
Once the wireshark is installed, we can run it by using the wireshark command directly.

Reference :

(# 1).   Remove Wireshark by using the sudo apt-get remove wireshark command
(# 2).   eip indicate the capabilities list grants them in the effective, inheritable, and permitted bitmaps, respectively.
(# 3).   If we got the error message as follows:
            To resolve it by using the sudo apt-get install libjack0 command
            and sudo apt-get install libcap-dev command
Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.