MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Archive for the ‘Fedora’ Category

Fedora 27 Screen Saver

without comments

Just back from Oracle OpenWorld and somebody desperately wants to know how to disable the 5 minute default screen saver setting in the KDE environment. OK, you navigate to the Fedora “f” in the lower left hand corner and choose System Settings, like:

In the System Setting menu page, select Desktop Behavior:

In the Desktop Behavior dialog, select Screen Locking. Change the default to something large like 90 for 1 and half hours.

As always, I hope that solves your problem.

Written by maclochlainn

October 27th, 2018 at 12:33 am

Fedora SQL*Developer

without comments

After you download SQL Developer 18 on Fedora 27, you can install it with the yum utility, like

yum install -y sqldeveloper-18.2.0.183.1748-1.noarch.rpm

The installation should generate the following log file:

Last metadata expiration check: 2:26:23 ago on Sat 25 Aug 2018 07:10:16 PM MDT.
Dependencies resolved.
================================================================================================
 Package               Arch            Version                      Repository             Size
================================================================================================
Installing:
 sqldeveloper          noarch          18.2.0.183.1748-1            @commandline          338 M
 
Transaction Summary
================================================================================================
Install  1 Package
 
Total size: 338 M
Installed size: 420 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                        1/1 
  Installing       : sqldeveloper-18.2.0.183.1748-1.noarch                                  1/1 
  Running scriptlet: sqldeveloper-18.2.0.183.1748-1.noarch                                  1/1 
  Verifying        : sqldeveloper-18.2.0.183.1748-1.noarch                                  1/1 
 
Installed:
  sqldeveloper.noarch 18.2.0.183.1748-1                                                         
 
Complete!

After you install SQL Developer, you won’t be able to launch it. Attempts to launch it won’t raise an error message either. The problem is that there is a post-installation step, which requires you to configure the product.conf file.

You can see the error by navigating to the /opt/sqldeveloper directory. You will find the sqldeveloper.sh file in that directory. You will see the error when you run the command as the root user from the command-line interface (CLI), as follows:

/opt/sqldeveloper/sqldeveloper.sh

 Oracle SQL Developer
 Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
 
Type the full pathname of a JDK installation (or Ctrl-C to quit), the path
 will be stored in /root/.sqldeveloper/18.2.0/product.conf

You can find the Oracle home by searching for the rt.jar file as the root user. You use the following find command syntax from the / topmost directory.

find . -name rt.jar

On Fedora 27, you should see the following absolute file name:

./usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-1.b10.fc27.x86_64/jre/lib/rt.jar

You discard the /jre/lib portion of the directory path and the rt.jar file name to get the Java home’s fully qualified path. This should update the product.conf file but if you have to change it manually you should edit the following file:

/root/.sqldeveloper/18.2.0/product.conf

You need to configure the SetJavaHome parameter value in the product.conf file. The SetJavaHome parameter needs to point to the Java home directory on your Fedora instance. It should look like this:

#
# By default, the product launcher will search for a JDK to use, and if none
# can be found, it will ask for the location of a JDK and store its location
# in this file. If a particular JDK should be used instead, uncomment the
# line below and set the path to your preferred JDK.
#
SetJavaHome /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-1.b10.fc27.x86_64

It’s possible that an attempt to launch SQL Developer by another user may have copied the product.conf file into a local directory. You should change those manually by editing their respective product.conf files. Assuming you attempted to launch SQL Developer by a student user before you changed the root user’s copy of the SQL Developer’s product.conf file.

Written by maclochlainn

August 25th, 2018 at 11:51 pm

MySQL 5.7.* and mysqli

without comments

After installing MySQL 5.7.22 and PHP 7.1.17 on Fedora 27, you need to install the mysqli library. You need to verify if the mysqli library is installed. You can do that with the following mysqli_check.php program:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<html>
<header>
<title>Check mysqli Install</title>
</header>
<body>
<?php
  if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
    print 'mysqli not installed.'; }
  else {
    print 'mysqli installed.'; }
?>
</script>
</body>
</html>

You test preceding PHP program with the following URL in a browser:

http://localhost/mysqli_check.php

If the mysqli program isn’t installed, you can install it as follows by opening the yum interactive shell:

[root@localhost html]# yum shell
Last metadata expiration check: 1:26:46 ago on Wed 22 Aug 2018 08:05:50 PM MDT.
> remove php-mysql
No match for argument: php-mysql
Error: No packages marked for removal.
> install php-mysqlnd
> run
================================================================================================
 Package                 Arch               Version                   Repository           Size
================================================================================================
Installing:
 php-mysqlnd             x86_64             7.1.20-1.fc27             updates             246 k
Upgrading:
 php                     x86_64             7.1.20-1.fc27             updates             2.8 M
 php-cli                 x86_64             7.1.20-1.fc27             updates             4.2 M
 php-common              x86_64             7.1.20-1.fc27             updates             1.0 M
 php-fpm                 x86_64             7.1.20-1.fc27             updates             1.5 M
 php-json                x86_64             7.1.20-1.fc27             updates              73 k
 php-pdo                 x86_64             7.1.20-1.fc27             updates             138 k
 php-pgsql               x86_64             7.1.20-1.fc27             updates             135 k
 
Transaction Summary
================================================================================================
Install  1 Package
Upgrade  7 Packages
 
Total download size: 10 M
Is this ok [y/N]: y

After you type y and the return key, you should see a detailed log of the installation. Click the link below to see the yum installation log detail.

After you install the mysqli library, you exit the yum interactive shell with the quit command as shown:

> quit
Leaving Shell
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.

You can now retest by re-running the mysqli_check.php program with the following URL:

http://localhost/mysqli_check.php

Image processing is not generally installed by default. You should use the following yum command to install the PHP Image processing library:

yum install -y php-gd

Or, you can use dnf (Dandified yum), like:

dnf install -y php-gd

Click the link below to see the yum installation log detail.

If you encounter an error trying to render an image like this:

Call to undefined function imagecreatefromstring() in ...

The php-gd package is not enabled. You can verify the contents of the php-gd package with the following rpm command on Fedora or CentOS:

rpm -ql php-gd

On PHP 7.1, it should return:

/etc/php-zts.d/20-gd.ini
/etc/php.d/20-gd.ini
/usr/lib/.build-id
/usr/lib/.build-id/50
/usr/lib/.build-id/50/11f0ec947836c6b0d325084841c05255197131
/usr/lib/.build-id/b0/10bf6f48ca6c0710dcc5777c07059b2acece77
/usr/lib64/php-zts/modules/gd.so
/usr/lib64/php/modules/gd.so

Then, you might choose to follow some obsolete note from ten or more years ago to include gd.so in your /etc/php.ini file. That’s not necessary.

The most common reason for incurring this error is tied to migrating old PHP 5 code forward. Sometimes folks used logic like the following to print a Portable Network Graphics (png) file stored natively in a MySQL BLOB column:

  header('Content-Type: image/x-png');
  imagepng(imagecreatefromstring($image));

If it was stored as a Portable Network Graphics (png) file, all you needed was:

  header('Content-Type: image/x-png');
  print $image;

As always, I hope this helps those looking for a solution.

Written by maclochlainn

August 23rd, 2018 at 11:47 am

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

Ruby GEM Mongo

without comments

While trying to use the Ruby gem utility to install the MongoDB gem, I encountered an error on a new Fedora 27 instance. This is the error message:

Fetching: bson-4.3.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing mongo:
        ERROR: Failed to build gem native extension.
 
    current directory: /usr/local/share/gems/gems/bson-4.3.0/ext/bson
/usr/bin/ruby -r ./siteconf20180517-49401-1htl7zc.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
 
extconf failed, exit code 1
 
Gem files will remain installed in /usr/local/share/gems/gems/bson-4.3.0 for inspection.
Results logged to /usr/local/lib64/gems/ruby/bson-4.3.0/gem_make.out
[student@localhost ~]$ ruby --version
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]

There wasn’t much on the error but I checked the Ruby installation and ruby-devel package wasn’t installed by default. That’s odd since I choose to install the development components on the workstation.

Not a problem, I simply ran the yum utility as root through a sudoer user to install the ruby-devel package:

yum install -y ruby-devel

You should see a successful installation log like:

As I suspected, it fixed the problem immediately when I ran gem utility to install the mongo gem. The syntax to install the mongo gem is:

gem install mongo

The console output should be:

Building native extensions.  This could take a while...
Successfully installed bson-4.3.0
Fetching: mongo-2.5.3.gem (100%)
Successfully installed mongo-2.5.3
Parsing documentation for bson-4.3.0
Installing ri documentation for bson-4.3.0
Parsing documentation for mongo-2.5.3
Installing ri documentation for mongo-2.5.3
Done installing documentation for bson, mongo after 3 seconds
2 gems installed

You can now write and run a Ruby test MongoDB connection program. Here’s a basic MongoDBTest.rb Ruby file:

#!/usr/bin/ruby
 
# Require libraries.
require 'rubygems'
require 'mongo'
 
# Create a new connection to MongoDB.
$client = Mongo::Client.new(['localhost'])
 
puts 'Connected to MongoDB'
puts '===================='
puts 'Database Names:'
puts '---------------'
$client.database_names.each{|name| puts name}

After you create the MongoDBTest.rb file, you need to change its permissions with the chmod utility as follows:

chmod 755 MongoDBTest.rb

Then, you can run it as follows from the directory where you created the file:

./MongoDBTest.rb

Unless you’ve added something to the base MongoDB instance, it should print:

Connected to MongoDB
====================
Database Names:
---------------
admin
local

As always, I hope this helps somebody looking for a straightforward example and solution.

Written by maclochlainn

May 17th, 2018 at 2:00 pm

MongoDB on Fedora 27

without comments

I was very pleased to see MongoDB 3.4 in the repo for Fedora 27; however, I was quite frankly severely disappointed by the lack of concrete installation steps in the MongoDB in Action, Second Edition. The installation is straightforward as long as you remember that you don’t simply install a mongodb package. You need to install the mongodb and mongodb-server packages as well as some dependents.

As the root user, you can use yum to install them like this:

yum install -y mongo*

After installing the correct packages, you can start the MongoDB Daemon as a service using the root account or a sudoer account (if you get warning messages, you need to create a mongod file):

service mongod start

Finally, you can connect to the MongoDB client, like so:

mongo

Inside the mongo shell, you can check the MongoDB version with the following command:

db.version()

It should print:

3.4.11

Or, you can check the statistics of a new empty instance:

db.stats()

A fresh installation of MongoDB 3.4.11 on Fedora 27 should return:

{
        "db" : "test",
        "collections" : 0,
        "views" : 0,
        "objects" : 0,
        "avgObjSize" : 0,
        "dataSize" : 0,
        "storageSize" : 0,
        "numExtents" : 0,
        "indexes" : 0,
        "indexSize" : 0,
        "fileSize" : 0,
        "ok" : 1
}

You can insert data into MongoDB by creating a database, which is simply a file. You use an existing database or file by using the use command. If the database or file doesn’t exist already, the use command creates the database.

use videodb

You can create a collection or table with the insert function. The following creates an item collection and adds two JSON objects to the item collection.

db.item.insert({item:"Star Wars: A New Hope"})

It returns:

WriteResult({ "nInserted" : 1 })

You can create or add to an item collection or table with the same insert function call. You simply enclose the list of collection elements in the square brackets of a JavaScript array or list. The following inserts the second and third Star Wars films:

db.item.insert([{item:"Star Wars: The Empire Strikes Back"},{item:"Star Wars: Return of the Jedi"}])

It returns:

BulkWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 2,
        "nUpserted" : 0,
        "nMatched" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]

You can query the collection with the find function, like:

db.item.find()

It returns:

{ "_id" : ObjectId("5b02732435b861850bc51ef1"), "item" : "Star Wars: A New Hope" }
{ "_id" : ObjectId("5b02734635b861850bc51ef2"), "item" : "Star Wars: The Empire Strikes Back" }
{ "_id" : ObjectId("5b02734635b861850bc51ef3"), "item" : "Star Wars: Return of the Jedi" }

You can write large JavaScript files for bulk inserts. For example, the following users.js file:

db.users.insert(
[
  { contact_account: "CA_20170321_0001"
  , first_name: "Jonathan"
  , middle_name: "Eoin"
  , last_name: "MacGregor"
  , addresses:
    {
      street_address: ["1111 Broadway","Suite 101"]
    , city: "Oakland"
    , state: "CA"
    , zip: "94607" 
    }
  }
, { contact_account: "CA_20170328_0001"
  , first_name: "Remington"
  , middle_name: "Alain" 
  , last_name: "Dennison"
  , addresses:
    {
      street_address: ["2222 Broadway","Suite 121"]
    , city: "Oakland"
    , state: "CA"
    , zip: "94607" 
    }
  }
])

You can call the file with the load command from the interactive MongoDB command line:

load("/home/student/Code/mongodb/users.js")

You can query the results after you load the collection elements in the users collection with the following command:

db.users.find()

It returns:

{ "_id" : ObjectId("5b0270d535b861850bc51eef"), "contact_account" : "CA_20170321_0001", "first_name" : "Jonathan", "middle_name" : "Eoin", "last_name" : "MacGregor", "addresses" : { "street_address" : [ "1111 Broadway", "Suite 101" ], "city" : "Oakland", "state" : "CA", "zip" : "94607" } }
{ "_id" : ObjectId("5b0270d535b861850bc51ef0"), "contact_account" : "CA_20170328_0001", "first_name" : "Remington", "middle_name" : "Alain", "last_name" : "Dennison", "addresses" : { "street_address" : [ "2222 Broadway", "Suite 121" ], "city" : "Oakland", "state" : "CA", "zip" : "94607" } }

In both cases, the item and user collections add a unique identifier. The unique identifier is much like a surrogate key in a relational database. That’s why you should always define a unique natural key in the definition of your collection.

As always, I hope this helps.

Written by maclochlainn

May 16th, 2018 at 6:05 pm

MySQL on Fedora 27

without comments

While updating my class image to Fedora 27, I noticed that it installed the Akonadi Server. The documentation on the Akonadi server lacked some straightforward documentation. It also offered a bundled set of software that limited how to approach MySQL development.

So, I removed all those packages with the following syntax:

dnf remove `rpm -qa | grep akonadi`

After removing those Akonadi packages, I installed the MySQL Community Edition from the Fedora repo with this syntax:

yum install -y community-mysql*

Having installed MySQL Community Edition, I started the service with this command:

sudo service mysql start

Then, I ran the mysql_secure_installation script to secure the installation:

mysql_secure_installation

The script set the root user’s password, remove the anonymous user, disallow remote root login, and remove the test databases. Then, I verified connecting to the MySQL database with the following syntax:

mysql -uroot -ppassword

I enabled the MySQL Service to start with each reboot of the Fedora instance. I used the following command:

systemctl enable mysqld.service

It creates the following link:

ln -s '/etc/systemd/system/multi-user.target.wants/mysqld.service' '/usr/lib/systemd/system/mysqld.service'

Now, I need to install and configure Apache, PHP, and upgrade Oracle Database 11g XE’s APEX 4 to 5.

Written by maclochlainn

May 16th, 2018 at 2:13 am

PostgreSQL Calling File

without comments

Somebody asked: How do you run a script file from PostgreSQL’s psql prompt? I created two files to answer the question. Here are the two files:

Static File

SELECT 'Hello World!';

Dynamic File

SELECT 'Hello ['||current_user||']!';

It’s a simple solution, you put a \i or \include before the script file name, like:

\i helloworld.sql

It outputs:

   ?column?   
--------------
 Hello World!

or

\include hellowhom.sql

It outputs:

     ?column?     
------------------
 Hello [student]!

I hope this helps those trying to call SQL script files from an interactive psql session.

Written by maclochlainn

May 14th, 2018 at 12:19 am

Setup PostgreSQL

without comments

After you have installed PostgeSQL on Fedora 27 and initialized the database, you have several steps to configure a new instance. This blog post shows you how to create all the implementation pieces for a student database.

Connect as the postgres user from a sudoer user. It requires you to connect as the root user before you connect as the postgres user.

sudo sh

As the root user, you don’t need a password to connect as the postgres user:

su - postgres

As the postgres user, you own the PostgreSQL database and can connect to the database like the following:

[postgres@localhost ~]$ psql
psql (9.6.8)
Type "help" for help.
 
postgres=#

After you connect as the privileged postgres user, you can check the default data location with the following command:

postgres=# show data_directory;

It will return:

   data_directory    
---------------------
 /var/lib/pgsql/data
(1 row)

After you’ve initialized the PostgreSQL database, you may need to restart your database manually unless you configure the server to start it when you boot your server. The syntax to start the PostgreSQL database at the command-line as the postgres privileged user is:

postgres -D /var/lib/pgsql/data &

You can find detailed instructions in Chapter 18.3 Starting the Database Server web page. There are several options available to you to automate the starting process.

The instructions to build a postgresql.service actually require modification for Fedora 27. You should create the following file in the /etc/systemd/system directory:

[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)
 
[Service]
Type=notify
User=postgres
ExecStart=/usr/bin/postgres -D /var/lib/pgsql/data
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
 
[Install]
WantedBy=multi-user.target

You can start the PostgreSQL service with the following command:

systemctl start postgresql.service >/dev/null

The following steps create tablespace, database, role, and user:

  1. Create Tablespace

You can create a video_db tablespace with the following syntax:

CREATE TABLESPACE video_db
  OWNER postgres
  LOCATION '/var/lib/pgsql/data';

This will return the following:

WARNING:  tablespace location should not be inside the data directory
CREATE TABLESPACE

The warning only lets you know that you really shouldn’t create table spaces in the default data directory. You can query whether you successfully create the video_db tablespace with the following:

SELECT * FROM pg_tablespace;

It should return the following:

  spcname   | spcowner | spcacl | spcoptions 
------------+----------+--------+------------
 pg_default |       10 |        | 
 pg_global  |       10 |        | 
 video_db   |       10 |        | 
(3 rows)
  1. Create a Database

You can create a videodb database with the following syntax:

CREATE DATABASE videodb
  WITH OWNER = postgres
       ENCODING = 'UTF8'
       TABLESPACE = video_db
       LC_COLLATE = 'en_US.UTF-8'
       LC_CTYPE = 'en_US.UTF-8'
       CONNECTION LIMIT = -1;

Then, you can assign comment to the database with the following syntax:

COMMENT ON DATABASE videodb IS 'Video Database';
  1. Create a Role, Grant, and User

In this section you create a dba role, grant privileges on a videodb database to a role, and create a user with the role that you created previously with the following three statements. There are three steps in this sections.

  • The first step creates a dba role:

    CREATE ROLE dba WITH SUPERUSER;
  • The second step grants all privileges on a videodb database to a dba role:

    GRANT ALL PRIVILEGES ON DATABASE videodb TO dba;
  • The third step creates a student user with the dba role:

    CREATE USER student
      WITH ROLE dba
           PASSWORD 'student';
  1. Connect to the videodb as the student user

You connect to the videodb database as the student user with the following command:

sql -d videodb -U student;

After connecting to the videodb database, you can query the current database, like

SELECT current_database();

It should return the following:

 current_database 
------------------
 videodb
(1 row)

This has shown you how to create a videodb database, dba role, and student user.

Written by maclochlainn

May 13th, 2018 at 1:01 am

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