segunda-feira, 28 de novembro de 2016

Install Docker and Docker Composer on CentOs 7

1. Introduction

This post only gathers references to others posts that install Docker on CentOs 7


2. References




sábado, 15 de outubro de 2016

Installing Docker on CentOs 6

1. Introduction

This post shows how to install "Docker" on a CentOS 6.x system.


2. Step-by-Step

2.1. Check if processosr suports Docker

  • Docker does not support 32 bits processors
  • Docker is supported by Kernel 3.8 or higher


[root@localhost install-docker]# uname -a
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost install-docker]#


2.2. Install Docker using official scripts from official 

[root@localhost ~]# mkdir install-docker
[root@localhost ~]# cd install-docker/
[root@localhost install-docker]# wget -qO- https://get.docker.com | sh
+ sh -c 'sleep 3; yum -y -q install docker-engine'

warning: rpmts_HdrFromFdno: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY
Importing GPG key 0x2C52609D:
 Userid: "Docker Release Tool (releasedocker) <docker@docker.com>"
 From  : https://yum.dockerproject.org/gpg

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

[root@localhost install-docker]#


2.3. Start Docker service and configure to startup

[root@localhost install-docker]# service docker status
docker is stopped
[root@localhost install-docker]# service docker start
Starting cgconfig service:                                 [  OK  ]

Starting docker:                                           [  OK  ]

[root@localhost install-docker]# chkconfig docker



2.4. Using Docker basic commands

  • Docker version
[root@localhost install-docker]# docker --version
Docker version 1.7.1, build 786b29d



  • Is there any container running? And what about created containger but not running?
[root@localhost install-docker]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost install-docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost install-docker]#


  • Searching images from containers of 'centos' and 'debian'
[root@localhost install-docker]# docker search centos
NAME                            DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                          The official build of CentOS.                   2733      [OK]
ansible/centos7-ansible         Ansible on Centos7                              89                   [OK]
jdeathe/centos-ssh              CentOS-6 6.8 x86_64 / CentOS-7 7.2.1511 x8...   41                   [OK]
jdeathe/centos-ssh-apache-php   CentOS-6 6.8 x86_64 / Apache / PHP / PHP M...   21                   [OK]
nimmis/java-centos              This is docker images of CentOS 7 with dif...   16                   [OK]
million12/centos-supervisor     Base CentOS-7 with supervisord launcher, h...   12                   [OK]
gluster/gluster-centos          Official GlusterFS Image [ CentOS7 +  Glus...   12                   [OK]
torusware/speedus-centos        Always updated official CentOS docker imag...   8                    [OK]
nickistre/centos-lamp           LAMP on centos setup                            7                    [OK]
kinogmt/centos-ssh              CentOS with SSH                                 6                    [OK]
nathonfowlie/centos-jre         Latest CentOS image with the JRE pre-insta...   4                    [OK]
centos/mariadb55-centos7                                                        3                    [OK]
consol/sakuli-centos-xfce       Sakuli end-2-end testing and monitoring co...   2                    [OK]
centos/tools                    Docker image that has systems administrati...   2                    [OK]
timhughes/centos                Centos with systemd installed and running       1                    [OK]
harisekhon/centos-java          Java on CentOS (OpenJDK, tags jre/jdk7-8)       1                    [OK]
harisekhon/centos-scala         Scala + CentOS (OpenJDK tags 2.10-jre7 - 2...   1                    [OK]
darksheer/centos                Base Centos Image -- Updated hourly             1                    [OK]
centos/redis                    Redis built for CentOS                          1                    [OK]
blacklabelops/centos            CentOS Base Image! Built and Updates Daily!     1                    [OK]
grayzone/centos                 auto build for centos.                          0                    [OK]
repositoryjp/centos             Docker Image for CentOS.                        0                    [OK]
smartentry/centos               centos with smartentry                          0                    [OK]
ustclug/centos                   USTC centos                                    0                    [OK]
januswel/centos                 yum update-ed CentOS image                      0                    [OK]
[root@localhost install-docker]#
[root@localhost install-docker]#
[root@localhost install-docker]#
[root@localhost install-docker]# docker search debian
NAME                           DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
debian                         Debian is a Linux distribution that's comp...   1724      [OK]
neurodebian                    NeuroDebian provides neuroscience research...   29        [OK]
jesselang/debian-vagrant       Stock Debian Images made Vagrant-friendly ...   9                    [OK]
armbuild/debian                ARMHF port of debian                            8                    [OK]
eboraas/debian                 Debian base images, for all currently-avai...   6                    [OK]
frekele/debian                 docker run --rm --name debian frekele/debian    2                    [OK]
reinblau/debian                Debian with usefully default packages for ...   2                    [OK]
datenbetrieb/debian            minor adaption of official upstream debian...   1                    [OK]
1maa/debian                    Debian base image                               1                    [OK]
servivum/debian                Debian Docker Base Image with Useful Tools      1                    [OK]
maxexcloo/debian               Base image built on Debian with init, Supe...   1                    [OK]
lephare/debian                 Base debian images                              1                    [OK]
webhippie/debian               Docker images for debian                        1                    [OK]
eeacms/debian                  Docker image for Debian to be used with EE...   1                    [OK]
lucasbarros/debian             Basic image based on Debian                     1                    [OK]
smartentry/debian              debian with smartentry                          0                    [OK]
konstruktoid/debian            Debian base image                               0                    [OK]
mariorez/debian                Debian Containers for PHP Projects              0                    [OK]
fike/debian                    Debian Images with language locale installed.   0                    [OK]
vcatechnology/debian           A Debian image that is updated daily            0                    [OK]
visono/debian                  Docker base image of debian 7 with tools i...   0                    [OK]
nimmis/debian                  This is different version of Debian with a...   0                    [OK]
icedream/debian-jenkinsslave   Debian for Jenkins to be used as slaves.        0                    [OK]
ustclug/debian                 debian image for docker with rustic mirror      0                    [OK]
pl31/debian                    Debian base image.                              0                    [OK]



  • My first containers
Run ( launch ) your 'debian' container, and at first update your SO (this may takes a while on first time you run this image), check your IP, and exit or loggof or ctrl+d. Notice that when you exit container, this does not exist anymore!!! 





3. References




sexta-feira, 3 de junho de 2016

Install SVN 1.8 on CentOS

1. Introduction


This post shows how to install SVN 1.8 into CentOS 6.5.


2. Pre-conditions

2.1. Install Apache HTTP Server

# echo "Check if httpd (Apache Server) is installed and running ..."
# service httpd status
httpd (pid  1665) is running...
#
# echo "Install httpd (apache server) if needed ..."
# yum install httpd
# service httpd restart
# chkconfig httpd on


2.2. Setup Yum Repository for SVN Subversion

# vim /etc/yum.repos.d/wandisco-svn.repo
[WandiscoSVN]
name=Wandisco SVN Repo
baseurl=http://opensource.wandisco.com/centos/$releasever/svn-1.8/RPMS/$basearch/
enabled=1
gpgcheck=0

2.3.  Install Subversion Package

Before installing latest package remove existing subversion
# yum remove subversion*
# yum clean all
# yum install subversion
# svn --version
svn, version 1.8.16 (r1740329)
   compiled Apr 26 2016, 13:16:01 on x86_64-unknown-linux-gnu
Copyright (C) 2016 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/
                                                                     
The following repository access (RA) modules are available:
                                                                     
* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.7
  - handles 'http' scheme
  - handles 'https' scheme


2.4.  Install Subversion with Apache - Mod_Dav_SVN

# yum install subversion mod_dav_svn
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.globo.com
 * epel: mirror.globo.com
 * extras: mirror.globo.com
 * updates: mirror.globo.com
Setting up Install Process
Package subversion-1.8.16-1.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package mod_dav_svn.x86_64 0:1.8.16-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package             Arch           Version           Repository           Size
================================================================================
Installing:
 mod_dav_svn         x86_64         1.8.16-1          WandiscoSVN          77 k
Transaction Summary
================================================================================
Install       1 Package(s)
Total download size: 77 k
Installed size: 216 k
Is this ok [y/N]: y
Downloading Packages:
mod_dav_svn-1.8.16-1.x86_64.rpm                          |  77 kB     00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mod_dav_svn-1.8.16-1.x86_64                                  1/1
Stopping httpd: [  OK  ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[  OK  ]
  Verifying  : mod_dav_svn-1.8.16-1.x86_64                                  1/1
Installed:
  mod_dav_svn.x86_64 0:1.8.16-1
Complete!


2.5. Configure Subversion with Apache - MOD_DAV_SVN

# vim /etc/httpd/conf.d/subversion.conf
+------------------------------------------------------------+
| LoadModule dav_svn_module     modules/mod_dav_svn.so       |
| LoadModule authz_svn_module   modules/mod_authz_svn.so     |
|                                                            |
| Alias /svn /var/svn                                        |
|                                                            |
| <Location /svn>                                            |
|   DAV svn                                                  |
|   SVNPath  /var/svn/myrepo/                                |
|   AuthType Basic                                           |
|   AuthName "SVN Repo"                                      |
|   AuthUserFile /etc/svn-users                              |
|   Require valid-user                                       |
| </Location>                                                |
+------------------------------------------------------------+


2.6. Create First SVN Repository

# cd /var
# mkdir /var/svn
# cd /var/svn
# svnadmin create myrepo

# echo "don't forget to give permission to apache"
don't forget to give permission to apache

# chown apache:apache -R /var/svn


2.7. Create SVN Users ( /etc/svn-users )

# touch /etc/svn-users
# htpasswd -m /etc/svn-users admin
# htpasswd -m /etc/svn-users user1
# htpasswd -m /etc/svn-users user2


2.8. Create SVN Authorizations ( /etc/svn-users )

vim /etc/svn-authz
#
# Define groups
#
[groups]
admins = admin
users = user1, user2
devteams = user1, user2

#
# Default access rule for ALL repositories: 
# - Everyone can read, admins can write, hacker is excluded.
#
[/]
* = r
@admins = rw
hacker =

# echo "restart httpd service"
restart httpd service
# service httpd stop; service httpd start
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

2.9. Create your first project on SVN repository

# svn mkdir http://localhost/svn/_templateSvnProject -m "Creating default _templateSvnProject"
Committed revision 1.
#
# echo "You don't need to execute following commands! It's only for demo purpose"
You don't need to execute following commands! It's only for demo purpose
#
svn mkdir http://localhost/svn/testing-remove -m "Creating project only for testing remove project"
Committed revision 2.
#
svn delete http://localhost/svn/testing-remove -m "Deleting a created project only for testing"
Committed revision 3.

2.9. Create your project structure using best practices

# cd ~
# mkdir my-svn-working-copy
# mkdir my-svn-working-copy/_templateSvnProject
# mkdir my-svn-working-copy/_templateSvnProject/branches
# mkdir my-svn-working-copy/_templateSvnProject/tags
# mkdir my-svn-working-copy/_templateSvnProject/trunk
# echo "Project Template using SVN best practices" > my-svn-working-copy/_templateSvnProject/trunk/README.txt
# ls -R my-svn-working-copy/
my-svn-working-copy/:                            
_templateSvnProject                              
                                                 
my-svn-working-copy/_templateSvnProject:         
branches  tags  trunk                            
                                                 
my-svn-working-copy/_templateSvnProject/branches:
                                                 
my-svn-working-copy/_templateSvnProject/tags:    
                                                 
my-svn-working-copy/_templateSvnProject/trunk:   
README.txt                                       


2.10. Import your project structure and contents to repository

# echo "Go to working directory"
Go to working directory
cd ~/my-svn-working-copy
echo "Go to project directory"
Go to project directory
cd _templateSvnProject
# pwd
/root/my-svn-working-copy/_templateSvnProject
ls
branches tags trunk
#
svn import -m "First Check-in" --username  admin  --password  admin  http://localhost/svn/_templateSvnProject
Adding         branches        
Adding         tags            
Adding         trunk           
Adding         trunk/README.txt
                               
Committed revision 4.          


2.11. Access repository in your browser

  • Access  http://127.0.0.1/svn/myrepo/
+--------------------------------------------+
| URL:  http://127.0.0.1/svn/myrepo/    |GO| |
+--------------------------------------------+
|                                            |
|      +----------------------------+        |
|      | Autenticacao obrigatória   |        |
|      |        +------------+      |        |
|      |  Nome: | admin      |      |        |
|      |        +------------+      |        |
|      | Senha  | admin      |      |        |
|      |        +------------+      |        |
|      +----------------------------+        |
|                                            |
+--------------------------------------------+

  • Subversion shows repository
+--------------------------------------------------------------+
| svn - Revision 4: /                                          |
|                                                              |
|  _templateSvnProject/                                        |
|                                                              |
|                                                              |
| Powered by Apache Subversion version 1.8.16 (r1740329).      |
+--------------------------------------------------------------+


  • Click on link "_templateSvnProject"
+--------------------------------------------------------------+
svn - Revision 4: /_templateSvnProject                       |
|                                                              |
|  ..                                                          |
|  branches/                                                   |
|  tags/                                                       |
|  trunk/                                                      |
|                                                              |
|                                                              |
| Powered by Apache Subversion version 1.8.16 (r1740329).      |
+--------------------------------------------------------------+


  • And after on link "trunk"
+--------------------------------------------------------------+
svn - Revision 4: /_templateSvnProject/trunk                 |
|                                                              |
|  ..                                                          |
|  README.txt                                                  |
|                                                              |
|                                                              |
| Powered by Apache Subversion version 1.8.16 (r1740329).      |
+--------------------------------------------------------------+


2.12. Check out your project from repository

Now you must have faith. You will remove all your local files and check project out from repository in your SVN local copy

echo "Go to working directory"
Go to working directory
cd ~/my-svn-working-copy
# ls
drwxr-xr-x 5 root root 4096 Sep 12 15:13 _templateSvnProject
# rm -rf ./_templateSvnProject
# ls -la
drwxr-xr-x 2 root root 4096 Sep 12 15:26 .
dr-xr-x---. 7 root root 4096 Sep 12 15:13 ..
# echo "Oh my God! Be calm. You believe in repository, don't you?"
echo "Oh my God! Be calm. You believe in repository, don't you?"
# svn checkout --username admin --password admin http://localhost/svn/_templateSvnProject
A _templateSvnProject/trunk
A _templateSvnProject/branches
A _templateSvnProject/tags
A _templateSvnProject/trunk/README.txt
Checked out revision 4.
cd ~/my-svn-working-copy
# ls -lR
.:                                                          
total 4                                                     
drwxr-xr-x 6 root root 4096 Sep 12 15:31 _templateSvnProject
./_templateSvnProject:                                      
total 12                                                    
drwxr-xr-x 2 root root 4096 Sep 12 15:31 branches           
drwxr-xr-x 2 root root 4096 Sep 12 15:31 tags               
drwxr-xr-x 2 root root 4096 Sep 12 15:31 trunk              
./_templateSvnProject/branches:                             
total 0                                                     
./_templateSvnProject/tags:                                 
total 0                                                     
./_templateSvnProject/trunk:                                
total 4                                                     
-rw-r--r-- 1 root root 42 Sep 12 15:31 README.txt           




2.13. Import your project using TortoiseSVN

  • #1 - Create your project best practice structure

  • #2 - Create a _READ-ME.txt file under 'trunk'

  • #3 - Positioned into your project structure, Right Click on Windows Explorer and choose menu option TortoiseSVN Import

  • #4 - Define repository URL

  • #5 - Authenticate with 'admin'

  • #6 - Check import finished message

  • #7 - Check browsing HTTP

3. References