MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Archive for the ‘Linux Developer’ tag

Docker on Fedora 27

without comments

This walks you through the steps to install the Community Edition of Docker on Fedora 27. If you’ve been living under a rock for a few years, Docker is an open source container virtualization software.

Docker or Docker Community Edition is a necessary step if you want to install something like Microsoft’s SQL Server on Fedora because only these are supported platforms:

  • Red Hat Enterprise Linux 7.3 or 7.4
  • SUSE Linux Enterprise Server V12 SP2
  • Ubuntu 16.04
  • Docker Engine 1.8+

The first step requires you to add the docker-ce repo to your instance with he curl utility, which should already be installed in most cases. You can check whether the curl utility is available with the which command, like:

which -a curl

If installed it should return the following:

/usr/bin/curl
/bin/curl

You add the docker-ce repo with the following curl command:

sudo curl -o /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/fedora/docker-ce.repo

You should see something like the following if it was successful:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2544  100  2544    0     0   2544      0  0:00:01 --:--:--  0:00:01 12913

Next, you can install docker-ce with the following yum command or if you prefer use the dnf utility:

sudo yum install -y docker-ce

It should produce a log file like the one provided, which you can see by clicking the Display detailed console link that expands the page to show you the console details.

After installing docker-ce, you can check it with the following systemctl command:

sudo systemctl status docker

It should show service is disabled (default) and inactive:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: https://docs.docker.com

This indicates everything installed correctly, now you need to enable the docker service with this systemctl command:

sudo systemctl enable docker

It should show that the docker service is enabled and inactive:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: https://docs.docker.com

You start the docker service with this systemctl command:

sudo systemctl start docker

It should show that the service is enabled and inactive:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2018-07-05 19:22:25 MDT; 4s ago
     Docs: https://docs.docker.com
 Main PID: 107768 (dockerd)
    Tasks: 16
   Memory: 35.8M
      CPU: 140ms
   CGroup: /system.slice/docker.service
           ├─107768 /usr/bin/dockerd
           └─107772 docker-containerd --config /var/run/docker/containerd/containerd.toml
 
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.350914727-06:00
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.352583385-06:00
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.352718174-06:00
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.353419088-06:00
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.632193965-06:00
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.823732094-06:00
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.893601936-06:00
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.894351396-06:00
Jul 05 19:22:25 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Jul 05 19:22:25 localhost.localdomain dockerd[107768]: time="2018-07-05T19:22:25.907087735-06:00
lines 1-22/22 (END)

A CNTL+C dismisses the open log file. As usual, I hope this helps those trying to accomplish the task for the first time.

Written by maclochlainn

July 5th, 2018 at 7:36 pm

Fedora Install PostgreSQL

without comments

The following shows you the install of PostgreSQL 9.6 on Fedora 27. You either use the sudoer privileges as a user in the sudoer group, or by using the su command to become the root user:

sudo yum install -y postgres*

It should display the following installation:

Last metadata expiration check: 2:22:55 ago on Sat 12 May 2018 02:48:53 PM MDT.
Package postgresql-libs-9.6.8-1.fc27.x86_64 is already installed, skipping.
Dependencies resolved.
================================================================================================
 Package                               Arch         Version                 Repository     Size
================================================================================================
Installing:
 postgresql                            x86_64       9.6.8-1.fc27            updates       1.4 M
 postgresql-contrib                    x86_64       9.6.8-1.fc27            updates       746 k
 postgresql-dbi-link                   noarch       2.0.0-16.fc27           fedora        617 k
 postgresql-docs                       x86_64       9.6.8-1.fc27            updates        11 M
 postgresql-ip4r                       x86_64       2.0.2-14.fc27           fedora         68 k
 postgresql-jdbc                       noarch       9.4.1212-4.fc27         fedora        494 k
 postgresql-jdbc-javadoc               noarch       9.4.1212-4.fc27         fedora        396 k
 postgresql-jdbc-parent-poms           noarch       9.4.1212-4.fc27         fedora         25 k
 postgresql-odbc                       x86_64       09.06.0410-1.fc27       fedora        386 k
 postgresql-odbc-tests                 x86_64       09.06.0410-1.fc27       fedora        100 k
 postgresql-pgpool-II-devel            x86_64       3.6.5-3.fc27            fedora         26 k
 postgresql-pgpool-II-extensions       x86_64       3.6.5-3.fc27            fedora         26 k
 postgresql-pgpoolAdmin                noarch       3.6.1-2.fc27            fedora        890 k
 postgresql-plperl                     x86_64       9.6.8-1.fc27            updates        97 k
 postgresql-plpython                   x86_64       9.6.8-1.fc27            updates       111 k
 postgresql-plpython3                  x86_64       9.6.8-1.fc27            updates       110 k
 postgresql-plruby                     x86_64       0.5.4-15.fc27           fedora        105 k
 postgresql-plruby-doc                 x86_64       0.5.4-15.fc27           fedora         22 k
 postgresql-pltcl                      x86_64       9.6.8-1.fc27            updates        77 k
 postgresql-static                     x86_64       9.6.8-1.fc27            updates        80 k
 postgresql-upgrade                    x86_64       9.6.8-1.fc27            updates       3.1 M
 postgresql_autodoc                    noarch       1.41-8.fc27             fedora         31 k
Installing dependencies:
 libmemcached-libs                     x86_64       1.0.18-10.fc27          fedora        134 k
 nginx-filesystem                      noarch       1:1.12.1-1.fc27         fedora         20 k
 perl-DBD-Pg                           x86_64       3.7.0-1.fc27            fedora        212 k
 perl-HTML-Template                    noarch       2.97-3.fc27             fedora         79 k
 perl-YAML                             noarch       1.23-4.fc27             fedora         91 k
 php                                   x86_64       7.1.17-1.fc27           updates       2.8 M
 php-cli                               x86_64       7.1.17-1.fc27           updates       4.2 M
 php-common                            x86_64       7.1.17-1.fc27           updates       1.0 M
 php-json                              x86_64       7.1.17-1.fc27           updates        73 k
 php-pdo                               x86_64       7.1.17-1.fc27           updates       138 k
 php-pgsql                             x86_64       7.1.17-1.fc27           updates       135 k
 postgresql-devel                      x86_64       9.6.8-1.fc27            updates       1.2 M
 postgresql-pgpool-II                  x86_64       3.6.5-3.fc27            fedora        571 k
 postgresql-server                     x86_64       9.6.8-1.fc27            updates       4.7 M
 postgresql-test                       x86_64       9.6.8-1.fc27            updates       1.5 M
 tcl-pgtcl                             x86_64       2.1.1-6.fc27            fedora         99 k
 unixODBC-devel                        x86_64       2.3.5-2.fc27            updates        62 k
 uuid                                  x86_64       1.6.2-39.fc27           fedora         61 k
Installing weak dependencies:
 php-fpm                               x86_64       7.1.17-1.fc27           updates       1.5 M
 
Transaction Summary
================================================================================================
Install  41 Packages
 
Total download size: 38 M
Installed size: 130 M
Downloading Packages:
(1/41): postgresql-ip4r-2.0.2-14.fc27.x86_64.rpm                128 kB/s |  68 kB     00:00    
(2/41): postgresql-jdbc-9.4.1212-4.fc27.noarch.rpm              650 kB/s | 494 kB     00:00    
(3/41): postgresql-dbi-link-2.0.0-16.fc27.noarch.rpm            803 kB/s | 617 kB     00:00    
(4/41): postgresql-jdbc-javadoc-9.4.1212-4.fc27.noarch.rpm      1.3 MB/s | 396 kB     00:00    
(5/41): postgresql-jdbc-parent-poms-9.4.1212-4.fc27.noarch.rpm  219 kB/s |  25 kB     00:00    
(6/41): postgresql-odbc-tests-09.06.0410-1.fc27.x86_64.rpm      679 kB/s | 100 kB     00:00    
(7/41): postgresql-pgpool-II-extensions-3.6.5-3.fc27.x86_64.rpm 206 kB/s |  26 kB     00:00    
(8/41): postgresql-plruby-0.5.4-15.fc27.x86_64.rpm              840 kB/s | 105 kB     00:00    
(9/41): postgresql-plruby-doc-0.5.4-15.fc27.x86_64.rpm          241 kB/s |  22 kB     00:00    
(10/41): postgresql-pgpoolAdmin-3.6.1-2.fc27.noarch.rpm         3.5 MB/s | 890 kB     00:00    
(11/41): postgresql_autodoc-1.41-8.fc27.noarch.rpm              336 kB/s |  31 kB     00:00    
(12/41): perl-YAML-1.23-4.fc27.noarch.rpm                       616 kB/s |  91 kB     00:00    
(13/41): postgresql-pgpool-II-3.6.5-3.fc27.x86_64.rpm           5.4 MB/s | 571 kB     00:00    
(14/41): perl-DBD-Pg-3.7.0-1.fc27.x86_64.rpm                    1.4 MB/s | 212 kB     00:00    
(15/41): perl-HTML-Template-2.97-3.fc27.noarch.rpm              774 kB/s |  79 kB     00:00    
(16/41): libmemcached-libs-1.0.18-10.fc27.x86_64.rpm            1.5 MB/s | 134 kB     00:00    
(17/41): postgresql-contrib-9.6.8-1.fc27.x86_64.rpm             807 kB/s | 746 kB     00:00    
(18/41): postgresql-upgrade-9.6.8-1.fc27.x86_64.rpm             2.7 MB/s | 3.1 MB     00:01    
(19/41): postgresql-9.6.8-1.fc27.x86_64.rpm                     4.5 MB/s | 1.4 MB     00:00    
(20/41): postgresql-server-9.6.8-1.fc27.x86_64.rpm              3.5 MB/s | 4.7 MB     00:01    
(21/41): postgresql-test-9.6.8-1.fc27.x86_64.rpm                6.4 MB/s | 1.5 MB     00:00    
(22/41): postgresql-pltcl-9.6.8-1.fc27.x86_64.rpm               324 kB/s |  77 kB     00:00    
(23/41): postgresql-plpython3-9.6.8-1.fc27.x86_64.rpm           693 kB/s | 110 kB     00:00    
(24/41): postgresql-plpython-9.6.8-1.fc27.x86_64.rpm            519 kB/s | 111 kB     00:00    
(25/41): postgresql-plperl-9.6.8-1.fc27.x86_64.rpm              515 kB/s |  97 kB     00:00    
(26/41): uuid-1.6.2-39.fc27.x86_64.rpm                          197 kB/s |  61 kB     00:00    
(27/41): postgresql-devel-9.6.8-1.fc27.x86_64.rpm               6.0 MB/s | 1.2 MB     00:00    
(28/41): postgresql-static-9.6.8-1.fc27.x86_64.rpm              608 kB/s |  80 kB     00:00    
(29/41): tcl-pgtcl-2.1.1-6.fc27.x86_64.rpm                      450 kB/s |  99 kB     00:00    
(30/41): postgresql-pgpool-II-devel-3.6.5-3.fc27.x86_64.rpm     295 kB/s |  26 kB     00:00    
(31/41): postgresql-docs-9.6.8-1.fc27.x86_64.rpm                 18 MB/s |  11 MB     00:00    
(32/41): php-7.1.17-1.fc27.x86_64.rpm                           8.5 MB/s | 2.8 MB     00:00    
(33/41): php-cli-7.1.17-1.fc27.x86_64.rpm                        13 MB/s | 4.2 MB     00:00    
(34/41): postgresql-odbc-09.06.0410-1.fc27.x86_64.rpm           662 kB/s | 386 kB     00:00    
(35/41): php-common-7.1.17-1.fc27.x86_64.rpm                    4.6 MB/s | 1.0 MB     00:00    
(36/41): php-json-7.1.17-1.fc27.x86_64.rpm                      409 kB/s |  73 kB     00:00    
(37/41): php-pgsql-7.1.17-1.fc27.x86_64.rpm                     607 kB/s | 135 kB     00:00    
(38/41): php-pdo-7.1.17-1.fc27.x86_64.rpm                       1.0 MB/s | 138 kB     00:00    
(39/41): unixODBC-devel-2.3.5-2.fc27.x86_64.rpm                 316 kB/s |  62 kB     00:00    
(40/41): nginx-filesystem-1.12.1-1.fc27.noarch.rpm              214 kB/s |  20 kB     00:00    
(41/41): php-fpm-7.1.17-1.fc27.x86_64.rpm                       4.1 MB/s | 1.5 MB     00:00    
------------------------------------------------------------------------------------------------
Total                                                           7.1 MB/s |  38 MB     00:05     
warning: /var/cache/dnf/fedora-cba4cf65782eccda/packages/postgresql-dbi-link-2.0.0-16.fc27.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f5282ee4: NOKEY
Importing GPG key 0xF5282EE4:
 Userid     : "Fedora 27 (27) <fedora-27@fedoraproject.org>"
 Fingerprint: 860E 19B0 AFA8 00A1 7518 81A6 F55E 7430 F528 2EE4
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-27-x86_64
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                        1/1 
  Installing       : php-json-7.1.17-1.fc27.x86_64                                         1/41 
  Installing       : php-common-7.1.17-1.fc27.x86_64                                       2/41 
  Installing       : postgresql-9.6.8-1.fc27.x86_64                                        3/41 
  Running scriptlet: postgresql-server-9.6.8-1.fc27.x86_64                                 4/41 
  Installing       : postgresql-server-9.6.8-1.fc27.x86_64                                 4/41 
  Running scriptlet: postgresql-server-9.6.8-1.fc27.x86_64                                 4/41 
  Installing       : postgresql-devel-9.6.8-1.fc27.x86_64                                  5/41 
  Installing       : postgresql-test-9.6.8-1.fc27.x86_64                                   6/41 
  Installing       : postgresql-plruby-0.5.4-15.fc27.x86_64                                7/41 
  Installing       : php-cli-7.1.17-1.fc27.x86_64                                          8/41 
  Installing       : php-7.1.17-1.fc27.x86_64                                              9/41 
  Installing       : php-pdo-7.1.17-1.fc27.x86_64                                         10/41 
  Installing       : php-pgsql-7.1.17-1.fc27.x86_64                                       11/41 
  Running scriptlet: nginx-filesystem-1:1.12.1-1.fc27.noarch                              12/41 
  Installing       : nginx-filesystem-1:1.12.1-1.fc27.noarch                              12/41 
  Installing       : unixODBC-devel-2.3.5-2.fc27.x86_64                                   13/41 
  Installing       : postgresql-odbc-09.06.0410-1.fc27.x86_64                             14/41 
  Running scriptlet: postgresql-odbc-09.06.0410-1.fc27.x86_64                             14/41 
  Installing       : tcl-pgtcl-2.1.1-6.fc27.x86_64                                        15/41 
  Installing       : uuid-1.6.2-39.fc27.x86_64                                            16/41 
  Running scriptlet: uuid-1.6.2-39.fc27.x86_64                                            16/41 
  Installing       : libmemcached-libs-1.0.18-10.fc27.x86_64                              17/41 
  Running scriptlet: libmemcached-libs-1.0.18-10.fc27.x86_64                              17/41 
  Installing       : postgresql-pgpool-II-3.6.5-3.fc27.x86_64                             18/41 
  Running scriptlet: postgresql-pgpool-II-3.6.5-3.fc27.x86_64                             18/41 
  Installing       : perl-HTML-Template-2.97-3.fc27.noarch                                19/41 
  Installing       : perl-DBD-Pg-3.7.0-1.fc27.x86_64                                      20/41 
  Installing       : perl-YAML-1.23-4.fc27.noarch                                         21/41 
  Installing       : postgresql-dbi-link-2.0.0-16.fc27.noarch                             22/41 
  Installing       : postgresql_autodoc-1.41-8.fc27.noarch                                23/41 
  Installing       : postgresql-pgpool-II-extensions-3.6.5-3.fc27.x86_64                  24/41 
  Installing       : postgresql-pgpoolAdmin-3.6.1-2.fc27.noarch                           25/41 
  Running scriptlet: postgresql-pgpoolAdmin-3.6.1-2.fc27.noarch                           25/41 
httpd.service is not active, cannot reload.
warning: %post(postgresql-pgpoolAdmin-3.6.1-2.fc27.noarch) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package postgresql-pgpoolAdmin
Non-fatal POSTIN scriptlet failure in rpm package postgresql-pgpoolAdmin
  Installing       : postgresql-pgpool-II-devel-3.6.5-3.fc27.x86_64                       26/41 
  Installing       : postgresql-contrib-9.6.8-1.fc27.x86_64                               27/41 
  Installing       : postgresql-pltcl-9.6.8-1.fc27.x86_64                                 28/41 
  Installing       : postgresql-odbc-tests-09.06.0410-1.fc27.x86_64                       29/41 
  Installing       : php-fpm-7.1.17-1.fc27.x86_64                                         30/41 
  Running scriptlet: php-fpm-7.1.17-1.fc27.x86_64                                         30/41 
  Installing       : postgresql-plruby-doc-0.5.4-15.fc27.x86_64                           31/41 
  Installing       : postgresql-static-9.6.8-1.fc27.x86_64                                32/41 
  Installing       : postgresql-ip4r-2.0.2-14.fc27.x86_64                                 33/41 
  Installing       : postgresql-upgrade-9.6.8-1.fc27.x86_64                               34/41 
  Installing       : postgresql-plpython3-9.6.8-1.fc27.x86_64                             35/41 
  Installing       : postgresql-plpython-9.6.8-1.fc27.x86_64                              36/41 
  Installing       : postgresql-plperl-9.6.8-1.fc27.x86_64                                37/41 
  Installing       : postgresql-docs-9.6.8-1.fc27.x86_64                                  38/41 
  Installing       : postgresql-jdbc-parent-poms-9.4.1212-4.fc27.noarch                   39/41 
  Installing       : postgresql-jdbc-javadoc-9.4.1212-4.fc27.noarch                       40/41 
  Installing       : postgresql-jdbc-9.4.1212-4.fc27.noarch                               41/41 
  Running scriptlet: postgresql-jdbc-9.4.1212-4.fc27.noarch                               41/41 
Running as unit: run-r4842574cdaba436d90aabf16c83a6041.service
  Verifying        : postgresql-dbi-link-2.0.0-16.fc27.noarch                              1/41 
  Verifying        : postgresql-ip4r-2.0.2-14.fc27.x86_64                                  2/41 
  Verifying        : postgresql-jdbc-9.4.1212-4.fc27.noarch                                3/41 
  Verifying        : postgresql-jdbc-javadoc-9.4.1212-4.fc27.noarch                        4/41 
  Verifying        : postgresql-jdbc-parent-poms-9.4.1212-4.fc27.noarch                    5/41 
  Verifying        : postgresql-odbc-tests-09.06.0410-1.fc27.x86_64                        6/41 
  Verifying        : postgresql-pgpool-II-extensions-3.6.5-3.fc27.x86_64                   7/41 
  Verifying        : postgresql-pgpoolAdmin-3.6.1-2.fc27.noarch                            8/41 
  Verifying        : postgresql-plruby-0.5.4-15.fc27.x86_64                                9/41 
  Verifying        : postgresql-plruby-doc-0.5.4-15.fc27.x86_64                           10/41 
  Verifying        : postgresql_autodoc-1.41-8.fc27.noarch                                11/41 
  Verifying        : perl-YAML-1.23-4.fc27.noarch                                         12/41 
  Verifying        : postgresql-pgpool-II-3.6.5-3.fc27.x86_64                             13/41 
  Verifying        : perl-DBD-Pg-3.7.0-1.fc27.x86_64                                      14/41 
  Verifying        : perl-HTML-Template-2.97-3.fc27.noarch                                15/41 
  Verifying        : libmemcached-libs-1.0.18-10.fc27.x86_64                              16/41 
  Verifying        : postgresql-upgrade-9.6.8-1.fc27.x86_64                               17/41 
  Verifying        : postgresql-server-9.6.8-1.fc27.x86_64                                18/41 
  Verifying        : postgresql-contrib-9.6.8-1.fc27.x86_64                               19/41 
  Verifying        : postgresql-9.6.8-1.fc27.x86_64                                       20/41 
  Verifying        : postgresql-test-9.6.8-1.fc27.x86_64                                  21/41 
  Verifying        : postgresql-pltcl-9.6.8-1.fc27.x86_64                                 22/41 
  Verifying        : postgresql-plpython3-9.6.8-1.fc27.x86_64                             23/41 
  Verifying        : postgresql-plpython-9.6.8-1.fc27.x86_64                              24/41 
  Verifying        : postgresql-plperl-9.6.8-1.fc27.x86_64                                25/41 
  Verifying        : uuid-1.6.2-39.fc27.x86_64                                            26/41 
  Verifying        : postgresql-docs-9.6.8-1.fc27.x86_64                                  27/41 
  Verifying        : postgresql-devel-9.6.8-1.fc27.x86_64                                 28/41 
  Verifying        : tcl-pgtcl-2.1.1-6.fc27.x86_64                                        29/41 
  Verifying        : postgresql-static-9.6.8-1.fc27.x86_64                                30/41 
  Verifying        : postgresql-odbc-09.06.0410-1.fc27.x86_64                             31/41 
  Verifying        : postgresql-pgpool-II-devel-3.6.5-3.fc27.x86_64                       32/41 
  Verifying        : php-7.1.17-1.fc27.x86_64                                             33/41 
  Verifying        : php-cli-7.1.17-1.fc27.x86_64                                         34/41 
  Verifying        : php-common-7.1.17-1.fc27.x86_64                                      35/41 
  Verifying        : php-json-7.1.17-1.fc27.x86_64                                        36/41 
  Verifying        : php-pgsql-7.1.17-1.fc27.x86_64                                       37/41 
  Verifying        : php-pdo-7.1.17-1.fc27.x86_64                                         38/41 
  Verifying        : unixODBC-devel-2.3.5-2.fc27.x86_64                                   39/41 
  Verifying        : php-fpm-7.1.17-1.fc27.x86_64                                         40/41 
  Verifying        : nginx-filesystem-1:1.12.1-1.fc27.noarch                              41/41 
 
Installed:
  postgresql.x86_64 9.6.8-1.fc27                                                                
  postgresql-contrib.x86_64 9.6.8-1.fc27                                                        
  postgresql-dbi-link.noarch 2.0.0-16.fc27                                                      
  postgresql-docs.x86_64 9.6.8-1.fc27                                                           
  postgresql-ip4r.x86_64 2.0.2-14.fc27                                                          
  postgresql-jdbc.noarch 9.4.1212-4.fc27                                                        
  postgresql-jdbc-javadoc.noarch 9.4.1212-4.fc27                                                
  postgresql-jdbc-parent-poms.noarch 9.4.1212-4.fc27                                            
  postgresql-odbc.x86_64 09.06.0410-1.fc27                                                      
  postgresql-odbc-tests.x86_64 09.06.0410-1.fc27                                                
  postgresql-pgpool-II-devel.x86_64 3.6.5-3.fc27                                                
  postgresql-pgpool-II-extensions.x86_64 3.6.5-3.fc27                                           
  postgresql-pgpoolAdmin.noarch 3.6.1-2.fc27                                                    
  postgresql-plperl.x86_64 9.6.8-1.fc27                                                         
  postgresql-plpython.x86_64 9.6.8-1.fc27                                                       
  postgresql-plpython3.x86_64 9.6.8-1.fc27                                                      
  postgresql-plruby.x86_64 0.5.4-15.fc27                                                        
  postgresql-plruby-doc.x86_64 0.5.4-15.fc27                                                    
  postgresql-pltcl.x86_64 9.6.8-1.fc27                                                          
  postgresql-static.x86_64 9.6.8-1.fc27                                                         
  postgresql-upgrade.x86_64 9.6.8-1.fc27                                                        
  postgresql_autodoc.noarch 1.41-8.fc27                                                         
  php-fpm.x86_64 7.1.17-1.fc27                                                                  
  libmemcached-libs.x86_64 1.0.18-10.fc27                                                       
  nginx-filesystem.noarch 1:1.12.1-1.fc27                                                       
  perl-DBD-Pg.x86_64 3.7.0-1.fc27                                                               
  perl-HTML-Template.noarch 2.97-3.fc27                                                         
  perl-YAML.noarch 1.23-4.fc27                                                                  
  php.x86_64 7.1.17-1.fc27                                                                      
  php-cli.x86_64 7.1.17-1.fc27                                                                  
  php-common.x86_64 7.1.17-1.fc27                                                               
  php-json.x86_64 7.1.17-1.fc27                                                                 
  php-pdo.x86_64 7.1.17-1.fc27                                                                  
  php-pgsql.x86_64 7.1.17-1.fc27                                                                
  postgresql-devel.x86_64 9.6.8-1.fc27                                                          
  postgresql-pgpool-II.x86_64 3.6.5-3.fc27                                                      
  postgresql-server.x86_64 9.6.8-1.fc27                                                         
  postgresql-test.x86_64 9.6.8-1.fc27                                                           
  tcl-pgtcl.x86_64 2.1.1-6.fc27                                                                 
  unixODBC-devel.x86_64 2.3.5-2.fc27                                                            
  uuid.x86_64 1.6.2-39.fc27                                                                     
 
Complete!

While I started the PostgreSQL instance with the following:

service postgresql initdb

It gave me the following warning:

Hint: the preferred way to do this is now "/usr/bin/postgresql-setup --initdb --unit postgresql"
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

So, you should use the following to initialize the PostgreSQL database:

/usr/bin/postgresql-setup --initdb --unit postgresql

As always, I hope this helps those looking for the hidden configuration script.

Written by maclochlainn

May 12th, 2018 at 10:58 pm

Can’t Display 256 Colors

without comments

If you’re reading this post, you most likely are trying to run the Oracle Database 11g or 12c runInstaller program, and it’s failing a critical dependency check and displaying an error like the one below. If so, choose n because if you choose y it won’t launch the Oracle Installer.

Starting Oracle Universal Installer...
 
Checking Temp space: must be greater than 500 MB.   Actual 30824 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3967 MB    Passed
Checking monitor: must be configured to display at least 256 colors
    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<
 
Some requirement checks failed. You must fulfill these requirements before
 
continuing with the installation,
 
Continue? (y/n) [n] n

The first thing to check is whether you’ve the $TERM environment variable. It’ll be set in your env list but may not be set in your .bashrc file. You can see whether it’s set by running the following command:

echo $TERM

It should return a value, like this:

xterm-256color

If you didn’t get that value, use the env command to lookup the $TERM. The correct value can be found by running the env command like this:

env | grep -i term

Add $TERM environment variable to your .bashrc file and source it after the change or reboot the user’s session:

export TERM=xterm-256color

If it still doesn’t work, some posts ask you to run xclock but you don’t generally install the xhost clients. Those articles assumes you’ve installed the xorg-x11-apps package library. That’s more or less a choice you made when installing the Linux OS. You can check for the presence of the library with the following command as the root user:

rpm -qa xorg-x11-apps

If the command fails to return a result from the search of Red Hat Package Manager (RPM) libraries, you haven’t installed it. You can install it as the root superuser with this syntax:

yum install -y xorg-x11-apps

It should display the following result when successful:

Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package xorg-x11-apps.x86_64 0:7.7-6.el7 will be installed
--> Processing Dependency: libXaw.so.7()(64bit) for package: xorg-x11-apps-7.7-6.el7.x86_64
--> Running transaction check
---> Package libXaw.x86_64 0:1.0.12-5.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=================================================================================
 Package              Arch          Version              Repository         Size
=================================================================================
Installing:
 xorg-x11-apps        x86_64        7.7-6.el7            ol7_latest        304 k
Installing for dependencies:
 libXaw               x86_64        1.0.12-5.el7         ol7_latest        190 k
 
Transaction Summary
=================================================================================
Install  1 Package (+1 Dependent package)
 
Total download size: 494 k
Installed size: 1.2 M
Downloading packages:
(1/2): libXaw-1.0.12-5.el7.x86_64.rpm                     | 190 kB  00:00:00     
(2/2): xorg-x11-apps-7.7-6.el7.x86_64.rpm                 | 304 kB  00:00:00     
---------------------------------------------------------------------------------
Total                                            690 kB/s | 494 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libXaw-1.0.12-5.el7.x86_64                                    1/2 
  Installing : xorg-x11-apps-7.7-6.el7.x86_64                                2/2 
  Verifying  : libXaw-1.0.12-5.el7.x86_64                                    1/2 
  Verifying  : xorg-x11-apps-7.7-6.el7.x86_64                                2/2 
 
Installed:
  xorg-x11-apps.x86_64 0:7.7-6.el7                                               
 
Dependency Installed:
  libXaw.x86_64 0:1.0.12-5.el7                                                   
 
Complete!

After installing the xorg-x11-apps library packages, you can retry running the Oracle installer. You should now see the following successful message set:

Starting Oracle Universal Installer...
 
Checking Temp space: must be greater than 500 MB.   Actual 30809 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3967 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-06-01_01-50-54AM. Please wait ...

As always, I hope this helps my students and anybody looking for a solution to a less than explicit error message.

Written by maclochlainn

June 1st, 2016 at 2:12 am

Fedora X11 Install

without comments

While working through getting my Mac OS X to work with X11, I stumbled on some interesting errors and misdirection solutions. Like most things, the solution was straightforward. Then, it struck me that I hadn’t installed it on my Fedora image. This blog post show you the errors I got the way to get it to work, and how to install X11 on Fedora.

The first step requires discovering the package. If you remember xclock or xeyes are X-Windows programs, it’s quite easy with this command (though it may take a moment or two to run):

repoquery -q -f */xclock

It will return something like this:

xorg-x11-apps-0:7.7-7.fc20.x86_64

You can then install X11 as a sudoer user with the yum utility like this:

sudo yum -y install xorg-x11-apps

It should return this to your console:

Loaded plugins: langpacks, refresh-packagekit
Resolving Dependencies
--> Running transaction check
---> Package xorg-x11-apps.x86_64 0:7.7-7.fc20 will be installed
--> Processing Dependency: xorg-x11-xbitmaps for package: xorg-x11-apps-7.7-7.fc20.x86_64
--> Running transaction check
---> Package xorg-x11-xbitmaps.noarch 0:1.1.1-6.fc20 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package                  Arch          Version             Repository     Size
================================================================================
Installing:
 xorg-x11-apps            x86_64        7.7-7.fc20          fedora        305 k
Installing for dependencies:
 xorg-x11-xbitmaps        noarch        1.1.1-6.fc20        fedora         37 k
 
Transaction Summary
================================================================================
Install  1 Package (+1 Dependent package)
 
Total download size: 341 k
Installed size: 949 k
Downloading packages:
(1/2): xorg-x11-apps-7.7-7.fc20.x86_64.rpm                  | 305 kB  00:01     
(2/2): xorg-x11-xbitmaps-1.1.1-6.fc20.noarch.rpm            |  37 kB  00:00     
--------------------------------------------------------------------------------
Total                                              252 kB/s | 341 kB  00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction (shutdown inhibited)
  Installing : xorg-x11-xbitmaps-1.1.1-6.fc20.noarch                        1/2 
  Installing : xorg-x11-apps-7.7-7.fc20.x86_64                              2/2 
  Verifying  : xorg-x11-apps-7.7-7.fc20.x86_64                              1/2 
  Verifying  : xorg-x11-xbitmaps-1.1.1-6.fc20.noarch                        2/2 
 
Installed:
  xorg-x11-apps.x86_64 0:7.7-7.fc20                                             
 
Dependency Installed:
  xorg-x11-xbitmaps.noarch 0:1.1.1-6.fc20                                       
 
Complete!

After you install the xorg-x11-apps libraries, you can launch xclock. You should use the following syntax:

xclock &

It should display something like the following on your console:

X11xclock

The warning message is typically because you’re running something like en_US.UTF-8 mode. You can find suitable X11 character sets by using the following command:

sudo yum search xorg-x11-fonts

You can install all of them with the following command:

sudo yum -y install xorg-x11-fonts*

However, at the end of the day the warning doesn’t go way. You should just ignore it.

Hope this helps those who want to install X11 on Fedora.

Written by maclochlainn

June 9th, 2015 at 3:53 pm

Bash Arrays & MySQL

with 2 comments

Student questions are always interesting! They get me to think and to write. The question this time is: “How do I write a Bash Shell script to process multiple MySQL script files?” This post builds the following model (courtesy of MySQL Workbench) by using a bash shell script and MySQL script files, but there’s a disclaimer on this post. It shows both insecure and secure approaches and you should avoid the insecure ones.

LittleERDModel

It seems a quick refresher on how to use arrays in bash shell may be helpful. While it’s essential in a Linux environment, it’s seems not everyone masters the bash shell.

Especially, since I checked my Learning the Bash Shell (2nd Edition) and found a typo on how you handle arrays in the bash shell, and it’s a mistake that could hang newbies up (on page 161). Perhaps I should update my copy because I bought it in 1998. 😉 It was good then, and the new edition is probably better. The error is probably corrected in the current Learning the Bash Shell, but if not, the following examples show you how to use arrays in loops.

Naturally, these do presume some knowledge of working with bash shell, like the first line always is the same in any bash shell script. That you open an if-statement with an if and close it with a fi, and that you else-if is elif; and that a semicolon between a for-statement and the do statement is required when they’re on the same line because they’re two statements.

If you’re new to bash shell arrays, click on the link below to expand a brief tutorial. It takes you through three progressive examples of working with bash arrays.

Only one more trick needs to be qualified before our main MySQL examples. That trick is how you pass parameters to a bash shell script. For reference, this is the part that’s insecure because user command histories are available inside the Linux OS.

Here’s a hello_whom.sh script to demonstrates the concept of parameter passing:

1
2
3
4
5
6
7
8
9
10
#!/usr/bin/bash
 
# This says hello to the argument while managing no argument.
if [[ ${#} = 1 ]]; then
  echo 'The '${0}' program says: "Hello '${1}'!"'
elif [[ ${#} > 1 ]]; then
  echo 'The '${0}' program wants to know if you have more than one name?'
else
  echo 'The '${0}' program wants to know if you have a name?'
fi

If you need more on how parameters are passed and managed, you can check a prior blob post on Handling bash Parameters, or check the bash help pages. The following leverages bash arrays to run scripts and query the MySQL database from the command line.

You will need the three batch SQL files first, so here they are:

The following list_mysql.sh shell script expects to receive the username, password, database and fully qualified path in that specific order. The script names are entered manually because this should be a unit test script. Naturally, you can extend the script to manage those parameters but as mentioned I see this type of solution as a developer machine only script to simplify unit testing. Anything beyond that is risky!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/bash
 
# Assign user and password
username="${1}"
password="${2}"
database="${3}"
directory="${4}"
 
# List the parameter values passed.
echo "Username:  " ${username}
echo "Password:  " ${password}
echo "Database:  " ${database}
echo "Directory: " ${directory}
echo ""
 
# Define an array.
declare -a cmd
 
# Assign elements to an array.
cmd[0]="actor.sql"
cmd[1]="film.sql"
cmd[2]="movie.sql"
 
# Call the array elements.
for i in ${cmd[*]}; do
  mysql -s -u${username} -p${password} -D${database} < ${directory}/${i} > /dev/null 2>/dev/null
done
 
# Connect and pipe the query result minus errors and warnings to the while loop.
mysql -u${username} -p${password} -D${database} <<<'show tables' 2>/dev/null |
 
# Read through the piped result until it's empty but format the title.
while IFS='\n' read list; do
  if [[ ${list} = "Tables_in_sampledb" ]]; then
    echo $list
    echo "----------------------------------------"
  else
    echo $list
  fi
done
echo ""
 
# Connect and pipe the query result minus errors and warnings to the while loop.
mysql -u${username} -p${password} -D${database} <<<'SELECT CONCAT(a.actor_name," in ",f.film_name) AS "Actors in Films" FROM actor a INNER JOIN movie m ON a.actor_id = m.actor_id INNER JOIN film f ON m.film_id = f.film_id' 2>/dev/null |
 
# Read through the piped result until it's empty but format the title.
while IFS='\n' read actor_name; do
  if [[ ${actor_name} = "Actors in Films" ]]; then
    echo $actor_name
    echo "----------------------------------------"
  else
    echo $actor_name
  fi
done

The IFS (Internal Field Separator) works with whitespace by default. The IFS on lines 33 and 47 sets the IFS to a line return ('\n'). That’s the trick to display the data, and you can read more about the IFS in this question and answer post.

You can run this script with the following input parameters from the local directory where you deploy it. The a parameters are: (1) username, (2) password, (3) database, and (4) a fully qualified path to the SQL setup files.

./list_mysql.sh student student sampledb "/home/student/Code/bash/mysql"

With valid input values, the list_mysql.sh bash script generates the following output, which confirms inputs and verifies actions taken by the scripts with queries:

Username:   student
Password:   student
Database:   sampledb
Directory:  /home/student/Code/bash/mysql
 
Tables_in_sampledb
----------------------------------------
actor
film
movie
 
Actors in Films
----------------------------------------
Chris Hemsworth in Thor
Chris Hemsworth in Thor: The Dark World
Chris Pine in Star Trek
Chris Pine in Star Trek into Darkness
Chris Pine in Guardians of the Galaxy

If you forgot to provide the required inputs to the list_mysql.sh bash script, it alternatively returns the following output:

Username:  
Password:  
Database:  
Directory: 
 
./list_mysql.sh: line 25: /actor.sql: No such file or directory
./list_mysql.sh: line 25: /film.sql: No such file or directory
./list_mysql.sh: line 25: /movie.sql: No such file or directory

The secure way removes the password at a minimum! The refactored program will require you to manually enter the password for all elements of the array (three in this sample), and twice for the two queries. Here’s the refactored code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/bash
 
# Assign user and password
username="${1}"
database="${2}"
directory="${3}"
 
# List the parameter values passed.
echo "Username:  " ${username}
echo "Database:  " ${database}
echo "Directory: " ${directory}
echo ""
 
# Define an array.
declare -a cmd
 
# Assign elements to an array.
cmd[0]="actor.sql"
cmd[1]="film.sql"
cmd[2]="movie.sql"
 
# Call the array elements.
for i in ${cmd[*]}; do
  mysql -s -u${username} -p -D${database} < ${directory}/${i} > /dev/null 2>/dev/null
done
 
# Connect and pipe the query result minus errors and warnings to the while loop.
mysql -u${username} -p -D${database} <<<'show tables' 2>/dev/null |
 
# Read through the piped result until it's empty.
while IFS='\n' read list; do
  if [[ ${list} = "Tables_in_sampledb" ]]; then
    echo $list
    echo "----------------------------------------"
  else
    echo $list
  fi
done
echo ""
 
# Connect and pipe the query result minus errors and warnings to the while loop.
mysql -u${username} -p -D${database} <<<'SELECT CONCAT(a.actor_name," in ",f.film_name) AS "Actors in Films" FROM actor a INNER JOIN movie m ON a.actor_id = m.actor_id INNER JOIN film f ON m.film_id = f.film_id' 2>/dev/null |
 
# Read through the piped result until it's empty.
while IFS='\n' read actor_name; do
  if [[ ${actor_name} = "Actors in Films" ]]; then
    echo $actor_name
    echo "----------------------------------------"
  else
    echo $actor_name
  fi
done

Please let me know if you think there should be any more scaffolding for newbies in this post. As always, I hope this helps those looking for this type of solution.

Written by maclochlainn

May 17th, 2015 at 12:01 pm