mohammad-rahmani-1VW6HLOQE5A-unsplash

How to setup Docker-Compose in Ubuntu 20.04

Docker Compose is an open-supply field device for running a multi-field Docker utility. Docker Compose makes use of a YAML syntax structure, this is normally used for configuration documents and to outline and run fieldprimarily based totally applications. Compose additionally guide to outline and configure utility‘s offerings in YAML format. The principal benefit of Docker Compose is that you could outline a multi-field utility in one single file, in an effort to spin up the utility with only a single command which does want to be finished to get it jogging. With Compose you could control the entire lifecycle of utility: Managing offerings with start, stop, or rebuild View the popularity of running services Output the log of running services Run a one-off command on a service In this tutorial, we discover ways to set up Docker-compose on Ubuntu 20.04, and a way to run the sample-container app.

Install Docker Compose on Ubuntu

For successful installation of Docker Compose, need to have Docker installed on Ubuntu 20.04.

Read Now: How to setup Docker in Ubuntu 20.04

After installing Docker, you can verify that docker is installed and version with following command:

$ docker version

Output:

Client: Docker Engine - Community
  Version:           20.10.6
  API version:       1.41
  Go version:        go1.13.15
  Git commit:        370c289
  Built:             Fri Apr  9 22:47:17 2021
  OS/Arch:           linux/amd64
  Context:           default
  Experimental:      true
 Server: Docker Engine - Community
  Engine:
   Version:          20.10.6
   API version:      1.41 (minimum version 1.12)
   Go version:       go1.13.15
   Git commit:       8728dd2
   Built:            Fri Apr  9 22:45:28 2021
   OS/Arch:          linux/amd64
   Experimental:     false
  containerd:
   Version:          1.4.4
   GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
  runc:
   Version:          1.0.0-rc93
   GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
  docker-init:
   Version:          0.19.0
   GitCommit:        de40ad0

Since we now have a Docker, we are ready to install Docker compose.

To install docker compose from the Official Ubuntu repository, run:

$ sudo apt install docker-compose
This option will not guarantee that you downloading the latest docker-compose version.

Instead of downloading Docker Compose from the Ubuntu repository, we are suggesting downloading the binary package using an URL with the curl command:

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

This command saves the file in: /usr/local/bin directory, under the name docker-compose.

Output:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
100       633   100      633    0     0     5456      0 --:--:-- --:--:-- --:--:--   5456
100  12.1M   100  12.1M    0     0  40.0M      0 --:--:-- --:--:-- --:--:-- 40.0M

Next, we need to change the file permission, making the downloaded file executable with the following command:

$ sudo chmod +x /usr/local/bin/docker-compose

Verify installation, and check Docker Compose version:

$ docker–compose –version

Output:

docker-compose version 1.29.2, build 5becea4c

Test Docker Compose with Sample Container

Create new directory for your sample container example:

$ mkdir docker-compose-test

Change directory that you just created:

$ cd docker-compose-test

From there, create a YAML configuration file:

$ sudo nano docker-compose.yaml

And copy the following configuration into docker-compose.yaml file that you just opened:

version: '2' 
services:
     hello_world:
          image: ubuntu
          command: [/bin/echo, 'Hello world']

Save this, and run:

$ docker-compose up 

You need to see steps for:

  • pulling hello_world(ubuntu)
  • Downloaded picture for ubuntu:latest
  • Creating docker-compose-test_hello_world_1
  • Attaching to docker-compose-test_hello_world_1
  • Docker-compose the use of folder call because the venture call to prefix boxes and networks.


This created the box from the ubuntu picture, and run instructions that have been particular at the docker-compose.yaml.

Conclusion

In this tutorial, we discovered the way to deployation Docker-compose on Ubuntu 20.04, and the way to run the sample-box app. Docker-compose permits you to run more than one docker boxes on only a unmarried host, in case you want to run more than one boxes on more than one nodes, please check with answers which include Kubernetes or Swarm.

Tags:

docker compose, docker compose up, installing docker compose, docker compose command, docker compose file, dockercompose yml, docker compose example, docker compose env file, docker compose environment, docker compose env, docker compose ubuntu, docker compose network_mode
ben-griffiths-4wxWBy8Jo1I-unsplash

How to setup PhpPgAdmin in CentOS

PostgreSQL is an open-supply relational database control system that has helped to form the sector of software improvement with advanced, SQL-compliant. The fundamental gain of the use of PostgreSQL is that it calls for very minimal preservation efforts due to its stability. The programs primarily based totally on PostgreSQL have a low value of possession in assessment with different database control systems. It’s designed to be extensible in a manner that you could outline your very own records types, index types, functional languages, etc. PhpPgAdmin is a web-primarily based totally GUI software that makes it easy for administering your PostgreSQL databases. phpPgAdmin will allow you to add, cast off and manipulate databases, tables, and entries; run particular SQL queries, backup the database, search and import record, and lots more. In this educational we discover ways to deploy phpPgAdmin on CentOS 7.

Prerequisites

Before beginning the set up of PotgreSQL and phpPgAdmin ensure which you have root get entry to in your CentOS server and your are linked to the internet for downloading the packages. After login in your server, run the command under to replace your centos 7 server with the state-of-the-art patches.

# yum update

If you going to install PostgreSQL and phpPgAdmin on a production surroundings with firewall and SELinux enabled, then ensure to permit the subsequent default ports in order to be used for postgreSQL and apache.

# firewall-cmd --permanent --add-port=5432/tcp
# firewall-cmd --permanent --add-port=80/tcp
# firewall-cmd --reload
# setsebool -P httpd_can_network_connect_db 1

Let’s begin the Installation

By default Centos 7 comes with PostgreSQL Version 9.2.1 that may be set up with the aid of using the usage of the easy yum command whilst the contemporary latest PostgreSQL Version is 9.4.5. So, on this tutorial, we are able to be putting in the latest model of PostgreSQL by the usage of the PostgreSQL Yum Repository. To get the latest yum repository for the latest PostgreSQL package deal open the PostgreSQL Download Page or copy the hyperlink and run the under wget command.

# wget http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-redhat94-9.4-1.noarch.rpm

Now install the rpm file with below commands

# rpm -i pgdg-redhat94-9.4-1.noarch.rpm
# yum install postgresql94-server postgresql94-contrib

After jogging the above command there might be variety of the subsequent package might be established consisting of few dependencies. To continue the set up technique press the “Y” key to maintain as shown.

Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
postgresql94-contrib x86_64 9.4.5-1PGDG.rhel7 pgdg94 610 k
postgresql94-server x86_64 9.4.5-1PGDG.rhel7 pgdg94 3.8 M
Installing for dependencies:
libxslt x86_64 1.1.28-5.el7 base 242 k
postgresql94 x86_64 9.4.5-1PGDG.rhel7 pgdg94 1.0 M
postgresql94-libs x86_64 9.4.5-1PGDG.rhel7 pgdg94 209 k

Transaction Summary
=======================================================================================
Install 2 Packages (+3 Dependent packages)

Total download size: 5.9 M
Installed size: 25 M
Is this ok [y/d/N]: y

run the below command to initialize the database

# /usr/pgsql-9.4/bin/postgresql94-setup initdb
Initializing database ... OK

Start the Database service

To begin the PostgreSQL provider and to configure it for auto-permit at boot up run the subsequent commands after which test the status, it must be up and enabled.

# systemctl start postgresql-9.4
# systemctl enable postgresql-9.4

Now install the phpPgAdmin

Run the below command to install phpPgAdmin and http

yum install phpPgAdmin httpd

Type Y to install the required packages

Dependencies Resolved
=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Installing:
httpd x86_64 2.4.6-31.el7.centos.1 updates 2.7 M
phpPgAdmin noarch 5.1-2.rhel7 pgdg94 658 k
Installing for dependencies:
apr x86_64 1.4.8-3.el7 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd-tools x86_64 2.4.6-31.el7.centos.1 updates 79 k
libzip x86_64 0.10.1-8.el7 base 48 k
mailcap noarch 2.1.41-2.el7 base 31 k
php x86_64 5.4.16-36.el7_1 updates 1.4 M
php-cli x86_64 5.4.16-36.el7_1 updates 2.7 M
php-common x86_64 5.4.16-36.el7_1 updates 563 k
php-pdo x86_64 5.4.16-36.el7_1 updates 97 k
php-pgsql x86_64 5.4.16-36.el7_1 updates 84 k

Transaction Summary
=======================================================================================
Install 2 Packages (+10 Dependent packages)

Total download size: 8.5 M
Installed size: 30 M
Is this ok [y/d/N]:y

Configure PhpPgAdmin

Now don’t think too much and do as I say. But be careful if you are on production server

# vim /etc/httpd/conf.d/phpPgAdmin.conf
# vim /var/lib/pgsql/9.4/data/pg_hba.conf
# vim /var/lib/pgsql/9.4/data/postgresql.conf
# vim /etc/phpPgAdmin/config.inc.php
// Hostname or IP address for server. Use '' for UNIX domain socket.
// use 'localhost' for TCP/IP connection on this computer
$conf['servers'][0]['host'] = 'localhost';

// Database port on server (5432 is the PostgreSQL default)
$conf['servers'][0]['port'] = 5432;

$conf['owned_only'] = true;

Now restart the both services

# systemctl restart postgresql-9.4
# systemctl restart httpd

Access the web console

Let’s open the below URL to access the phpPgAdmin console as shown below.

http://your_servers_ip/phpPgAdmin/

Now login with your DB and password…

Conclusion

At the stop of this text, you discovered approximately the set up and configuration of PostgreSQL with phpPgAdmin on CentOS 7. Still, this changed into step one with inside the international of PostgreSQL as there are a variety of functions upon them you need to paintings on because it has a variety of tremendous functions like factor in time recovery, tablespaces, asynchronous replication, Multi-Version Concurrency Control (MVCC), and write-in advance logging for fault tolerance. So, we are hoping you discover this text a good deal beneficial so that you can begin database management with PostgreSQL.

Tags:

phppgadmin, php pg admin, phppgadmin centos, postgresql phppgadmin, postgresql, postgresql centos,

rubaitul-azad-HSACbYjZsqQ-unsplash

How to setup Docker in Ubuntu 20.04

Docker is a maximum famous, open-supply platform for builders and machine directors to build, run, and percentage packages with packing containers. Containerization (using packing containers to install packages) is turning into famous due to the fact containers are flexible, lightweight, portable, loosely coupled, scalable, and extra secure. This article is a superb place to begin for novices to discover ways to set up and use Docker on a Ubuntu 20.04 Linux machine with a few fundamental commands. For this guide, we can set up Docker Community Edition (CE).

Installing Docker on Ubuntu 20.04

To use the brand new version of Docker, we are able to set up it from the reputable Docker repository. So, begin with the aid of using including the GPG key for the reputable Docker repository in your system, after that upload the repository configuration to the APT supply with the subsequent commands.

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Now replace the APT bundle cache to consist of the brand new Docker programs to the device the use of the subsequent command

$ sudo apt update

Next, deploy the Docker bundle.

$ sudo apt install docker-ce

During the Docker bundle set up process, the bundle installer triggers the systemd (device and carrier manager) to mechanically begin and permit the docker carrier. Using the subsequent instructions to verify that the docker carrier is active and is enabled to automatically begin at device startup. Also, take a look at its status:

$ sudo systemctl is-active docker
$ sudo systemctl is-enabled docker
$ sudo systemctl status docker

To take a look at the model of Docker CE established to your system, run the subsequent command:

$ docker version

You can view available docker utilization instructions by running the docker command with none alternatives or arguments:

$ docker

Setup Docker as a Non-Root User

By default, the Docker daemon binds to a UNIX socket (as opposed to a TCP port) that is owned via way of means of the consumer root. Therefore the Docker daemon continually runs as the basis consumer and to run the docker command, you need to apply sudo. Besides, throughout the Docker package deal installation, a set referred to as docker is created. When the Docker daemon starts, it creates a UNIX socket reachable via way of means of participants of the docker organization (which presents privileges equal to the basis consumer). To run the docker command without sudo, upload all non-root users who’re alleged to access docker, in the docker organization as follows. In this example, the command provides the presently logged on user ($USER) or username to the docker organization:

$ sudo usermod -aG docker $USER
OR
$ sudo usermod -aG docker username

To spark off the modifications to groups, run the subsequent command:

$ newgrp docker 
$ groups

Next, affirm that you could run docker instructions with out sudo. The following command downloads a take a look at photo and runs it in a container. Once the container is running, it prints an informational message and exits. This is likewise some other manner to cross-test whether or not your set up is running fine.

$ docker run hello-world

That’s all! In this guide, we’veincludeda way toset up and use Docker CE in Ubuntu 20.04 Linux. If you’ve got got any questions, use the the comments to reminds us

Tags:

install docker ubuntu, docker ubuntu, install docker linux, docker ubuntu image, install docker compose ubuntu, install docker ubuntu 20.04, install docker on ubuntu 20.04, docker ubuntu 20.04, install docker in ubuntu, ubuntu docker container, install docker on amazon linux, ubuntu server docker