How to move a Docker image to another system

If you have created your own Docker image locally and want to move it to another docker host without first uploading it to a docker or private local repository you can use docker’s save command to save your image locally as ordinary tar archive archive and the copy and re-deploy it on another docker system. For example here we first make a backup of our docker image eg. linuxconfig:

# docker save linuxconfig > linuxconfig.tar

The above command have created a tarball of our local docker image linuxconfig which we now can move to another system and re-deploy it with Docker’s command load:

# docker load -i linuxconfig.tar

Read more

How to extract files from RPM package archive

This short article will show you how to extract a single or multiple files from a RPM package archive. To begin we first download a sample package hello.

$ wget ftp://rpmfind.net/linux/opensuse/factory/repo/oss/suse/x86_64/hello-2.9-4.3.x86_64.rpm
$ ls
hello-2.9-4.3.x86_64.rpm

Now we have an option extract all or a single file from the above RPM package archive. The following linux command will extract all file into our current working directory:

$ rpm2cpio hello-2.9-4.3.x86_64.rpm | cpio -id
525 blocks
$ ls
hello-2.9-4.3.x86_64.rpm  usr

Read more

Serving a content out of directory other than the DocumentRoot directory with Apache2

This config will show a basic example on how to server a content out of directory other that the DocumentRoot directory using Apache2 web server. Let’s begin with a simple virtual host configuration.

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

<VirtualHost>

Read more

How to obtain information about network devices and their configuration on Linux

This config will show few tricks on how to obtain a hardware information about the network devices and their relevant configuration on Linux system.

General information

First, let’s start the simple lspci command to obtain a bus-id, manufacturer and model of all available network cards:

# lspci | grep Network
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)

Read more

How to convert IP to Country location using Perl and Geo::IPfree

This config will provide you with a simple perl script which can be used to lookup country name from IP address. First we need to install libgeo-ipfree-perl perl library:

UBUNTU/DEBIAN
# apt-get install libgeo-ipfree-perl

Next, create a script eg. ip2location.pl with a following code:

#!/usr/bin/env perl

use Geo::IPfree;

        my $geo = Geo::IPfree->new;
        my( $code, $country ) = $geo->LookUp( $ARGV[0] );

        print "Country: $country\n" . "Country Code: $code\n"

Read more

ownCloud file sync and share server Docker image deployment and usage

About

The automated build docker ownCloudfile sync and share server image “linuxconfig/owncloud” can be used to instantly deploy ownCloud on docker hosts.

Configuration

The ownCloudfile sync and share server runs on Debian GNU/Linux system featuring Apache web server, MariaDB ( MySQL ), database and PHP5. A new docker container based on “linuxconfig/owncloud” will expose port 80 which can be linked to the docker host port for an immediate ownCloud web site access.

Configured MySQL users:passwords:

  • root:”empty password”
  • admin:”pass”

Configured MySQL databases:

  • owncloud

Exposed ports:

  • 80

Deployment

Below command will download and create a new docker container called owncloud and link local host system port 80 with container’s exposed port 80.

# docker run -d --name=owncloud -p 80:80 linuxconfig/owncloud

Read more

How to list all currently enabled apache2 modules on Linux server

Question:

How can I list all currently enabled modules using Apache2 webserver?

Answer:

Using apache2ctl command with a combination of -M you can list all loaded apache modules on your system. For example the following linux command will list all loaded modules on separate lines:

# apache2ctl -M
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 geoip_module (shared)
 mime_module (shared)
 mpm_event_module (shared)
 negotiation_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 status_module (shared) 

Another alternative to the above command is:

# apache2ctl -t -D DUMP_MODULES

Read more

Installation and getting started guide with Amazon Glacier storage on the Linux system

Glacier is a low cost cloud storage provided by Amazon Web Services. There are certain time limitation when retrieving your data so be sure that this is a right service for you before you decide to use Amazon Glacier service. Generally Amazon Glacier service is great for all digital archiving and backup needs, where the archived files do not need to be retrieved instantly. In this short how-to I will show how to install Amazon Glacier command interface on Linux, configuration and basic usage. Before you continue make sure that you have already signed up for AWS and you posses a valid
AWS access and secret key.

Installation of Amazon Glacier command interface

Let’s begin with Amazon Glacier command interface installation on Linux system. First, we need to install all prerequisites:

Redhat/CentOS/Fedora

# yum install git wget

Next, we need to install setuptools:

# wget https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz --no-check-certificate
# tar xzf setuptools-7.0.tar.gz
# cd setuptools-7.0
# python setup.py install

Ubuntu/Debian

# apt-get install git python-setuptools python

Read more

Getting started guide to server management using Puppet

Introduction

Puppet is an open source configuration management utility allowing the user to automatically and if required also remotely manage multiple systems and its configuration. Puppet is declarative, which means that user needs to only request a state of the service or resource a do not really have think about how this state will be achieved.

In other words imagine that you are a system administrator managing hundreds of systems and need to make sure that that certain resource like hello package is installed. In order to achieve this in a traditional way of system administration the admin user will need to undergo multiple checks such as current state of the package installation, type of the operating system platform, installation command to be used before the actual package installation takes place. Being puppet a declarative, user only needs to define the state of the desired package and puppet will take care of the rest. In an event that our package “hello” is installed puppet will take no action, whereas if package is not installed it will install it.

Scenario

In our scenario we are not going to run hundreds of operating systems and attempt to manage them. Our goal will be much simpler than that. In fact we are going to run only two separate systems running puppet master and puppet agent. Thus through the master puppet server we will attempt to configure a remote node and install “hello” package using puppet agent. This will be done with a bare minimum configuration possible.

Terminology

  • puppet master – central server that hosts and compiles all of agent configuration manifests
  • puppet agent – a service which runs on node and periodically check a configuration status with master puppet server and fetches a current up to date configuration manifest
  • manifest – configuration file which is exchanged between puppet muster and puppet agent
  • node – an operating system that puppet service runs on

Scenario Settings

Throughout this tutorial I will refer to both hosts simply as master and node1. Operating system used on both master and node1 instances is Debian 8 Jessie. Ubuntu Linux can also be used as an alternative to follow this tutorial. The underlying network configuration is irrelevant. However, it is expected that node1 can resolve the master host by its name and both hosts are connected and proper firewall settings are applied to allow puppet master and node1 agent to communicate:

root@node1:/# ping -c 1 master
PING master (172.17.0.1): 56 data bytes
64 bytes from 172.17.0.1: icmp_seq=0 ttl=64 time=0.083 ms
--- master ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.083/0.083/0.083/0.000 ms

Read more