Tuesday 22 May 2018

How to Install and Use Docker on Ubuntu

How to Install and Use Docker on Ubuntu


In the last few years, server virtualisation has become very popular. We cannot imagine cloud computing without virtualisation. But the explosive growth in computing demands more efficient virtualisation solutions. This is where containers come into play. Docker is one of the most popular container solution available today. In this article we will do hands-on with Docker.
Containers are lightweight virtualisation solutions. They provide OS-level virtualisation without any special support from the underlying hardware. Namespaces and control groups form the backbone of the container in the GNU/Linux kernel. Container solutions are built on top of these features. Namespaces provide isolation for processes, the network, mount points and so on, while control groups limit access to available hardware resources.
Sometimes, newbies get confused and think that server virtualisation and containerisation are the same thing. But, in fact, they are significantly different from each other. In server virtualisation, the OS in not shared; each VM instance has its own OS, whereas containers share the underlying OS. This approach has some advantages as well as disadvantages. The advantage is that the VM provides better isolation and security but performance is compromised. Whereas a container compromises on isolation but delivers a performance that’s as good as bare hardware.
Containers have been around since quite a long time. Their roots can be found in UNIX’s chroot program. After this release, many UNIX flavours have implemented their own container versions, like BSD jails and Solaris zones. On the GNU/Linux platform, LXD, OpenVZ and LXC are alternatives to Docker. However, Docker is much more mature and provides many advanced functionalities. We will discuss a few of them in the later sections of this article.
Setting up the environment
In this section, let’s discuss how to install Docker on an Ubuntu distribution, a task that is as simple as installing other software on GNU/Linux. To install Docker and its components, execute the following commands in a terminal:
sudo apt-get update
 
sudo apt-get install docker docker.io docker-compose
That’s it! The installation can be done by executing just two commands.
Now, let us verify the installation by printing the Docker version. If everything is fine, then it should display the installed Docker version. In my case, it was 1.13.1, as shown below:
$ docker --version
 
Docker version 1.13.1, build 092cba3
Now that we are done with the installation, let us briefly discuss a few important Docker components.
Docker Engine: This is the core of Docker. It runs as a daemon process and serves requests made by the client. It is responsible for creating and managing containers.
Docker Hub: This is the online public repository where Docker images are published. You can download as well as upload your custom images to this repository.
Docker Compose: This is one of the most useful components of Docker, which allows us to define its configuration in a YAML file. Once we define the configuration, we can use it to perform the deployment in an automated and repetitive manner.
In the later sections of this tutorial, we will discuss all these components briefly.
Getting hands-on with Docker
Now, that’s enough of theory! Let’s get started with the practical aspects. In this section, we’ll learn about containers by creating them and performing various operations on them, like starting, stopping, listing and finally destroying them.
Creating a Docker container: A container is a running instance of a Docker image. Wait, but what is a Docker image? It is a bundled package that contains the application and its runtime. To create a ‘busybox’ container, execute the following commands in a terminal:
# docker run busybox
 
Unable to find image ‘busybox:latest’ locally
 
latest: Pulling from library/busybox
 
d070b8ef96fc: Pull complete
 
Digest: sha256:2107a35b58593c58ec5f4e8f2c4a70d195321078aebfadfbfb223a2ff4a4ed21
 
Status: Downloaded newer image for busybox:latest
Let us understand what happens behind the scenes. In the above example, we are creating a ‘busybox’ container. First, Docker searches for the image locally. If it is present, it will be used; otherwise, it gets pulled and the container is created out of that image. But from where does it pull the image? Obviously, it pulls it from the Docker Hub.
Listing Docker containers: To list all Docker containers, we can use the ps command, as follows:
# docker ps -a
The -a switch lists all containers, including those running as well as those destroyed. This command shows various important attributes about the container like its ID, image name, creation date, running status and so on.
Running a Docker container: Now, let us run the ‘busybox’ container. We can use Docker’s ‘run’ command to do this.
# docker run busybox
As expected, this time the Docker image is not downloaded; instead, the local image is reused.
Docker detached mode: By default, a Docker container runs in the foreground. This is useful for debugging purposes but sometimes it is annoying. Docker provides the detach mode, using which we can run the container as follows:
# docker run -d busybox
 
240eb2570c9def655bcb94 c489435137057729c 4bad0e61034f5f9c6fb0f8428
In the above command, the -d switch indicates detached mode. This command prints the container ID on stdout for further use.
Attaching to a running container: Once the container is started in the detached mode, we can attach to it by using the attach command. We have to provide the container ID as an argument to this command. For instance, the command below attaches to a running container.
# docker attach 240eb2570c9def655b cb94c489435137057 729c4bad0e61034f5f9c6fb0f8428
Note: We can obtain the container ID by using the docker ps -a command.
Accessing containers: If you observe carefully, the docker run command starts and stops the container immediately. This is not at all useful. We can go inside the container environment using the following command:
# docker run -it busybox sh
In the above command, we have used the -it option and sh as an additional argument. This will provide us access to a container through the shell terminal. This is like a normal terminal, where you can execute all the supported commands. To exit from this, type ‘exit’ or press Ctrl+D.
Display information about a container: By using the inspect command, we can obtain useful information about a container, like its ID, running state, creation date, resource consumption, networking information and much more. To inspect a container, execute the following command:
# docker inspect <container-ID>
Destroying a container: Once we are done with the container, we should clear it off the system; otherwise, it’ll consume hardware resources. We can destroy a container using the rm command, as follows:
# docker rm <container-ID-1> <container-ID-2> ... <container-ID-N>
Working with Docker images
A Docker image is a blueprint for the container. It contains the application and its runtime. We can pull images from a remote repository and spawn containers using them. In this section, we will discuss various operations related to it.
To check Docker images, visit the official repository located at https://hub.docker.com. It hosts many images and provides detailed information about them, like their description, supported tags, Docker files and much more.
Listing images: To list all downloaded images, use the following command
# docker images
Pull image: As the name suggests, this command downloads the image from a remote repository and stores it on the local disk. To download the image, we have to provide the image’s name as an argument. For instance, the commands given below pull the busybox image:
# docker pull busybox

Using default tag: latest ----------------------------->
latest: Pulling from library/busybox
d070b8ef96fc: Pull complete
Digest: sha256:2107a35b58593c58ec5f4e8f2c4a70d195321078aebfadfbfb223a2ff4a4ed21
Status: Downloaded newer image for busybox:latest
Using tags: If we don’t provide any additional option, then the pull command downloads an image tagged with the latest tag. We can see it in the previous command’s output, where it has printed Using default tag: latest. To pull an image with a specific tag, we can provide the tag name with the pull command. For instance, the command given below pulls an image with the tag 1.28.1-uclibc:
# docker pull busybox:1.28.1-uclibc
 1.28.1-uclibc: Pulling from library/busybox ----------------------------->
Digest: sha256:2c3a381fd538dd732f20d824f87fac1e300a9ef56eb4006816fa0cd992e85ce5
Status: Downloaded newer image for busybox:1.28.1-uclibc
We can get image tags from the Docker Hub located at https://hub.docker.com.
Getting the history of an image: Using the history command, we can retrieve historical data about the image like its ID, creation date, author, size, description and so on. For instance, the following command shows the history of the ‘busybox’ image:
# docker history busybox
Deleting an image: Like containers, we can also delete Docker images. Docker provides the ‘rmi’ command for this purpose. In this command, ‘i’ stands for image. For instance, to delete a ‘busybox’ image, execute the following command:
# docker rmi f6e427c148a7
Note: We have to provide an image ID to it, which we can obtain using the docker images command.
Advanced Docker topics
So far we have explored only the basics of Docker. This can be a good start for beginners. However, the discussion does not end here. Docker is a feature-rich application. So let’s now briefly discuss some advanced Docker concepts.
Docker Compose: Docker Compose can be used to deploy and configure an entire software stack using automated methods rather than using the docker run command, followed by manual configuration. We can define the configuration in a YAML file and use that to perform deployment. Shown below is a simple example of configuration:
version: ‘2.0’

services:

database:

image: “jarvis/acme-web-app”

web:

image: “mysql”
In the above ‘docker-compose.yaml’ file, we have defined the configuration under the ‘services’ dictionary. We have also provided the images that should be used for deployment.
To deploy the above configuration, execute the following command in a terminal:
# docker-compose up
To stop and destroy a deployed configuration, execute the following commands in the terminal:
# docker-compose stop

# docker-compose down
Mapping ports: Like any other application, we can run Web applications inside a container. But the challenge is how to allow access to outside users. For this purpose, we can provide port mapping using the ‘-p’ option, as follows:
# docker run -p 80:5000 jarvis/acme-web-app
In the above example, Port 80 from the host machine is mapped to Port 5000 for the ‘acme-web-app’ container. Now, users can access this Web application using the host machine’s IP address.
Mapping storage: The application’s data is stored inside a container and, hence, when we destroy the container, data is also deleted. To avoid this, we can map volumes from the container to a local directory on a host machine. We can achieve this by using the -v option, as follows:
# docker run -v /opt/mysql-data:/var/lib/mysql mysql
In the above example, we have mapped the container’s /var/lib/mysql volume to the local directory /opt/mysql-data.Because of this, data can be persisted even when the container is destroyed.
Mapping ports and volumes with Docker Compose: To map ports and volumes as a part of the Docker Compose process, add the attributes of the ports and volumes in the ‘docker-compose.yaml’ file. After doing this, our modified file will look like what follows:
version: ‘2.0’

services:

database:

image: “jarvis/acme-web-app”

ports: ----------------------------->

- “80:5000” ----------------------------->

web:

image: “mysql”

volumes: ----------------------------->

- “/opt/mysql-data:/var/lib/mysql” ----------------------------->
Docker cluster: So far, we have worked with a single Docker host. This is a bare-minimal setup and is good enough for development and testing purposes. However, this is not enough for production, because if the Docker host goes down, then the entire application will go offline. To overcome this single point of failure, we can provide high availability to the container by using a Swarm cluster
A Swarm cluster is created with the aid of multiple Docker hosts. In this cluster, we can designate one of the nodes as a master and the remaining nodes as workers. The master will be responsible for load distribution and providing high availability within the cluster, whereas workers will host the Docker container after co-ordinating with the master.
In this article, we have discussed the basics of Docker as well as touched upon some advanced concepts. The article is a good starting point for absolute beginners. Once you build a strong foundation in Docker, you can delve deep into individual topics that interest you. By: efy.in

Thursday 3 September 2015

How to update Ubuntu server from 9.04 to 10.04

Step 1: install update-manager-core
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install update-manager-core

Step 2: Update Jaunty 9.04 to Karmic 9.10

edit /etc/apt/sources.list to replace "jaunty" with "karmic"
$ sudo apt-get update
$ sudo do-release-upgrade

Step 3: Update Karmic 9.10 to Lucid 10.04 

edit /etc/apt/sources.list to replace "karmic" with "lucid"
$ sudo apt-get update
$ sudo do-release-upgrade
To check your server version:
$ lsb_release -a

Saturday 22 November 2014

Windows Is Now Completely Banned In China


By 2020, China aims to remove Windows OS completely and the country will have its own 'more' secure operating system by that time.

There will be no Windows operating system in China from now onwards as a complete wipe-out is in the pipeline very soon. It's obviously not going to happen overnight but over next few years Windows operating system will become non-existent in Chinese computers.

SoftPedia report claims that China has announced a complete ban on Windows OS as Microsoft is accused of spying on China government and businesses. Microsoft Windows OS is going to be replaced by Linux all across China. By 2020, China aims to remove Windows OS completely and the country will have their own more secure operating system by that time. Well, this ban has not been imposed only on the software section but in the hardware section too. Alternative solutions are sought to replace all servers and chips, based on Windows.

The country has declared Windows 8 as a spyware tool. All Chinese government computers are set to be replaced by NeoKylin, which is quite a good OS to be installed on Dell computers which are manufactured for the Chinese market. Windows computers in China are to be replaced at a rate of 15 per cent per year and the process is set to be completed in five years.

Friday 31 October 2014

How to install nagios server in Ubuntu 16.04 LTS

How to install server in Ubuntu 16.04 LTS. Nagios is one the robust and very good monitoring server which is highly used in corporate network either it is Small business Unit or big corporate.

Monday 23 June 2014

Top 9 Amazing Linux Distros for System Administrator

Being a part of the open source eco-system, Linux distros have had the advantage of regular upgrades something that is in an instant attention grabber. 

1.Debian
Debian is an operating system composed of free software mostly carrying the GNU General Public License. Debian systems can use either the Linux kernel (known as the Debian GNU/Linux distribution), the FreeBSD kernel (known as the Debian GNU/kFreeBSD distribution) or, more recently, the GNU Hurd kernel (more precisely, the GNU Mach microkernel and its servers; known as the Debian GNU/Hurd distribution). Debian GNU/Linux is one of the most popular Linux distributions for personal computers and network servers.

Target Users: System Administrators and Advanced users. 

2.Gentoo
Gentoo Linux is a computer operating system based on the Linux kernel and built using the Portage package management system. It is distributed as free and open source software. Gentoo package management is designed to be modular, portable, easy to maintain, and flexible.

Target Users: For those who already know their way in Linux

3.Ubuntu
Ubuntu is a Debian-based Linux operating system, with Unity as its default desktop environment (GNOME was the previous desktop environment). The Ubuntu project is publicly committed to the principles of open source development; people are encouraged to use free software, study how it works, improve upon it, and distribute it.

Target Users: Newbies

4.Red Hat Enterprise Linux
Red Hat Enterprise Linux (RHEL) is a Linux distribution developed by Red Hat and targeted toward the commercial market. Red Hat Enterprise Linux is released in server versions for x86, x86-64, Itanium, PowerPC and IBM System z, and desktop versions for x86 and x86-64. 

Target Users: System administrators

5.CentOS
CentOS is a Linux distribution that attempts to provide a free enterprise class computing platform which has 100 per cent binary compatibility with its upstream source, Red Hat Enterprise Linux (RHEL).

Target Users: Anyone who wants to test the working of server on Desktop

6.Fedora
Fedora is an operating system based on the Linux kernel, developed by the community-supported Fedora Project and owned by Red Hat. Fedora contains software distributed under a free and open source license and aims to be on the leading edge of such technologies.

Target Users: For those who want to taste bleeding-edge technology and can’t wait for the program to get stable

7.Kali Linux
Kali Linux is a Debian-derived Linux distribution designed for digital forensics and penetration testing. Kali Linux is preinstalled with numerous penetration-testing programs, including nmap (a port scanner), Wireshark (a packet analyser), John the Ripper (a password cracker), and Aircrack-ng (a software suite for penetration-testing wireless LANs).

Target Users: For penetration testers or ethical hackers

8.Arch Linux
Arch Linux is a Linux-based operating system for i686 and x86-64 computers. It is composed predominantly of free and open source software, and supports community involvement. The design approach of the development team focuses on elegance, code correctness, minimalism, and simplicity, and expects the user to be willing to make some effort to understand the system's operation.

Target Users: geeky distro

9.OpenSuse
openSUSE is a general purpose operating system built on top of the Linux kernel, developed by the community-supported openSUSE Project and sponsored by SUSE and a number of other companies. It comes in several editions for the x86 and x86-64 architectures.

Target Users: System Administrators

Saturday 21 June 2014

What is Wireless Network Security. Learn The Basics

Keep your wireless network safe from prying eyes at all times

Hackers are becoming more and more sophisticated each day and making use of some of the most thought-bred effective tools that guarantee complete attack and kill! While everyone can't be a tech-buff so as to know all about protecting yourself, there are some basics that you should know so you don't end up in trouble anytime soon.

Basic Terminology

1.Service Set Identifier (SSID)

Case sensitive, 32 alphanumeric character unique identifier attached to the header of packets sent over a wireless local-area network (WLAN) that acts as a password when a mobile device tries to connect to the basic service set (BSS); a component of the IEEE 802.11 WLAN architecture.

2.Wireless Access Point (WAP)
A wireless Access Point (AP) is a device that allows wireless devices to connect to a wired network using Wi-Fi, or related standards. The AP usually connects to a router (via a wired network) as a standalone device, but it can also be an integral component of the router itself.

3.Basic Service Set Identifier (BSSID)
A unique 48 bit key that forms the MAC address of WAP or wireless router.

4.Beacon frame
One of the management frames in IEEE 802.11 based WLANs that contains all the information about the network. Beacon frames are transmitted periodically to announce the presence of a Wireless LAN. Beacon frames are transmitted by the Access Point (AP) in an infrastructure BSS. In IBSS network beacon generation is distributed among the stations.

5.Wireless Equivalent Privacy (WEP)
An encryption scheme used to encrypt the WiFi data streams comprising of an encryption key and Initialisation Vector (IV). It uses a 64bit or 128bit key.

Securing Your Wireless Network


1.MAC filtering
MAC Filtering refers to a security access control method whereby the 48-bit address assigned to each network card is used to determine access to the network. MAC addresses are uniquely assigned to each card, so using MAC filtering on a network permits and denies network access to specific devices through the use of blacklists and whitelists.

2.Hiding SSID
Wireless devices can only connect to WAP via a known SSID. Therefore it's ideal you hide SSID. 

3.Encryption Keys
WEP is easily cracked within minutes even by the most mediocre of hackers out there. Those of you who were under the contention that WEP was really safe, well, think again! It is high time that you set your wireless routers up and change your wireless encryption from WEP to WPA2 security which is new and much stronger. 

4.Intrusion detection system
Intrusion detection system (IDS) is a device or software application that monitors network or system activities for malicious activities or policy violations and produces reports to a management station. IDS come in a variety of “flavors” and approach the goal of detecting suspicious traffic in different ways.


Best Online Data Backup & Synchronization Tools

Hard disks and flash drives are passe. This is the era of the cloud. Make full use of it.

Hard disks and flash drives are passe. This is the era of the cloud. Make full use of it! 

We live in the era of cloud technology and big data to say the least is the increasing talk of the town. Backing up your crucial files online is the way to go today with both the average user as well as bigger organisations making full use of technology. Here are 10 online data backup and synchronisation tools for you. 

1.CX.com
The CX storage infrastructure is designed to run from any datacenter and storage environment. CX uses the Amazon Simple Storage Service (S3) due to its carefully engineered design that meets our requirements for scalability, durability, speed, low-cost, and simplicity.

2.MyPC Backup
MyPCBackup takes the security and privacy of your data very seriously. All your files are encrypted with the same security as banks use.

3.iDrive
Online backup for unlimited PCs, Macs, iPhones, iPads, Android devices and Facebook pictures into a single account.

4.CloudMe
CloudMe is a free and open service to store and make all your files available in the cloud through an easy to use Blue Folder.

5.SugarSync
SugarSync's cloud storage works in the background so your most important data is always backed up online and available to you — regardless of your location or the computer you are using. 

6.Syncplicity
Syncplicity is an enterprise-grade online file sharing and mobile collaboration solution. Backed by EMC, it provides users with an experience they love and gives IT the security and control it needs.

7.Duplicati
Duplicati is a free backup client that securely stores encrypted, incremental, compressed backups on cloud storage services and remote file servers. 

8.BuddyBackup
BuddyBackup gives you unlimited online backups of your files for free, by allowing you to easily and securely backup your data onto your buddies.

9.CrashPlan
Only CrashPlan offers totally free local and offsite backup. A subscription to our cloud backup service gets you continuous backup, mobile file access and lots more. 

10.Comodo Backup
You can try 10 GB of highly secure, online storage which you can access from anywhere and sync between computers.



How to Dual-Booting With Windows 8 And Linux

Here are six ways to set up multi-booting with Windows 8 and Linux:

1. Install the Linux GRUB bootloader
-Install the Linux GRUB bootloader as the default boot object.

-The catch here is you need to have a UEFI-compatible Linux distribution (openSuSE, Fedora, Linux Mint and Ubuntu).

-When you install a UEFI-compatible Linux distribution and everything works well, you will get the GRUB boot menu after a reboot. You can then choose either Linux or Windows 8 to boot from it. 

2. Use the BIOS Boot Select Key
-There's a possibility that doing everything of the above still gets you nowhere, and you're still getting Windows rather than Linux after reboot.

-In that case you can use the BIOS Boot Selection option (activated by pressing a special key that varies between systems during the power-on or reboot process.) 

-Pressing the special key will interrupt the Windows boot process and you will get a list of available operating systems (Windows 8 and Linux).

3. Enable 'Legacy Boot'
-Some systems make it difficult to enable Legacy Boot. The option might be well hidden in the BIOS configuration, or require a BIOS password before they will let you change it. 

-Legacy Boot allows you to install more or less any Linux distribution, without worrying about UEFI compatbility.

4. Try a workaround
-There is a "next boot" option available, which specifices a one time boot configuration. 

-If it is set the system will try to boot that item first, and will also clear that setting so that on the next boot it goes back to using the default boot sequence list. 

-The next boot configuration can be set from Linux using efibootmgr -n XXXX, where XXXX is the item number from the boot list.

-Add the efibootmgr command to the Linux startup scripts. Every time you boot Linux, it would reset the value so that it would boot Linux again the following time.

5. Trick the default boot process
-Put the Linux shim.efi (or grubx64.efi) image where the Windows Boot Manager is normally located. This is a cleaver trick to trick the default boot process. 

6. Install a different Boot Manager 
-rEFInd has the advantage of being able to boot almost anything - Windows, Linux, MacOS. It automatically finds whatever might be on the disk and then presents you with a boot selection list. 

Source: ZDNet

Friday 20 June 2014

You Can Buy And Sell App Source Codes


Want to sell an app on Android or iOS? You don't always have to write your own source code

Here are 11 websites that will aid you in the transactions.

1. ChupaMobile
This is perhaps the top website for buying and selling of Android and iOS app source codes. It has a huge collection of games and apps and is very easy to navigate through. You can also sort the listings by frameworks.

2. Apptopia

This is amongst the best sources for buying completed apps. Moreover, you don't just purchase the source code, you purchase the entire app, which includes the intellectual property rights and others. 

3. CodeCanyon
If you have an Envato account then this website would be a good choice for you. They do not have a very huge collection yet, but being part of the Envato family makes payment processing etc. easier.

4. Bluecloud Solutions
This website is quite useful for anyone looking to start a business with the next app they buy. You of course do not want to buy something that's not up to the mark, so you will need to choose only the good ones. This website makes the choice for you and shows only the apps that have potential.

5. BinPress
This website hosts source code from open source projects on the internet, desktop PCs and for mobile devices. 

6. AppCoda
If you're looking to buy stuff only for iOS apps then this is the way to go. 

7. Sell My App
Although this website sells completed app source codes from the Android, iOS, BlackBerry and @ Windows apps, it is tilted towards iOS, with a bigger collection.

8. SellMyAppz.com
This website has a pretty large selection of apps for both Android and iOS operating systems.

9. CodeStore
Here you can purchase four types of app templates. These include comic book app template, a photo showcase app template, story book app template and coloring book app template.

10. AppSplit
This follows a practice similar to Ebay, but for app source codes. You have to bid on the app against others and the can win only if your bit is i

11. Sellfy
This is an ecommerce portal where you can setup your own shop and sell your apps, ebooks, software and other things.

10 Awesome Things You Can Do On Your Linux


Using Windows/Mac should not deter you from enjoying the finer things in life

Well, here are 10 such tricks only Linux can offer: 

1. Get malware free environment

-Rest assured your Linux-powered device will not be affected by viruses.

-Not every file found in the wild is executed in Linux.

-Does not allow auto-runs every time you plug a new disk.

2. Make upgrade without rebooting

-Every time you install software in Windows, it will ask you to reboot. However, with Linux you're saved the trouble!

3. You can also maintain the timestamp

-You can know when a file was last accessed with the help of 'touch' command.

-Prevents anyone from stealthily touching your files as it maintains a timestamp.

-Further, there is no limit in length for a filename.

4. You can search and install software easily

-Synaptic Package manager gives you access to most significant software packages from one source. Simply select your preference using drop down box to get the software that suits you best.

5. You can keep your system on for hundreds of hours and still have good processing speed

-Linux can clock several hours with multiple users using it and still runs at usual speed unlike Windows.

6. Move bootable drives between machines without re-installing them

-Each time you add RAM, Windows will always ask you to re-install. This is not the case with Linux.

7. Get software issues solved through forums

-If something goes wrong in Windows, you have to run to an expert to fix it. With Linux, you have discussion forums to help you achieve the same.

8. Get all your hardware supported

-Test all our hardware using live CD before installing the OS.

9. Choose your customised OS from hundreds of distributors

-Linux is just the engine and different operating systems are built around it. You can hand pick the one that suits your need.

10. Install Linux for “free” and keep your Windows

-You can install Linux in a separate drive and keep your Windows as well.

-Also you can run Windows applications on Linux platform using WINE.

Source: Silicon India