MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Archive for the ‘Linux System Admin’ tag

User/Group Setups

without comments

The following are samples of creating, changing, and removing users and groups in Linux. These are the command-line options in the event you don’t have access to the GUI tools.

Managing Users:

Adding a user:

The prototype is:

# useradd [-u uid] [-g initial_group] [-G group[,...]] \
 > [-d home_directory] [-s shell] [-c comment] \
 > [-m [-k skeleton_directory]] [-f inactive_time] \
 > [-e expire_date] -n username

A sample implementation of the prototype is:

# useradd -u 502 -g dba -G users,root \
 > -d /u02/oracle -s /bin/tcsh -c "Oracle Account" \
 > -f 7 -e 12/31/03 -n jdoe

Modifying a user:

The prototype is:

 # usermod [-u uid] [-g initial_group] [-G group[,...]] \
 > [-d home_directory] [-s shell] [-c comment] \
 > [-l new_username ] [-f inactive_time] [-e expire_date]
 > username

A sample implementation of the prototype is:

# usermod -u 502 -g dba -G users,root
 > -d /u02/oracle -s /bin/bash -c "Senior DBA"
 > -l sdba -f 7 -e 12/31/03 jdoe

Removing a user:

The prototype is:

# userdel [-r] username

A sample implementation of the prototype is:

# userdel -r jdoe

Managing Groups:

Adding a group:

The prototype is:

# groupadd [-g gid] [-rf] groupname

A sample implementation of the prototype is:

# groupadd -g 500 dba

Modifying a group:

The prototype is:

# groupmod [-g gid] [-n new_group_name] groupname

A sample implementation of the prototype is:

 # groupmod -g 500 -n dba oinstall

Deleting a group:

The prototype is:

# groupdel groupname

A sample implementation of the prototype is:

# groupdel dba

Installing a GUI Manager for Users and Groups:

If you’re the root user or enjoy sudoer privileges, you can install the following GUI package for these tasks:

yum install -y system-config-users

You can verify the GUI user management tool is present with the following command:

which system-config-users

It should return this:

/bin/system-config-users

You can run the GUI user management tool from the root user account or any sudoer account. The following shows how to launch the GUI User Manager from a sudoer account:

sudo system-config-users

As always, I hope this helps those trying to figure out the proper syntax.

Written by maclochlainn

June 19th, 2023 at 10:48 pm

AlmaLinux+VSCode

with one comment

How to install and configure VSCode on AlmaLinux (Red Hat Enterprise 9). This is a step-by-step version of the Visual Studio documentation. The first thing you do is download the Microsoft packages:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

Next, create the yum repository with the following command:

sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

It creates the following vscode.repo file in the /etc/yum.repos.d directory:

[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc

Then, update the package cache and install the package using dnf dnf, like this as the sudoer user:

sudo dnf check-update

The log file for this is:

You can install the VSCode package using dnf dnf, like this as the sudoer user:

sudo dnf install -y code

The log file for this is:

Click on Activities in the upper left corner and then the clustered nine dots to view applications. Choose the Visual Studio and double click and you should see the following dialog:

Choose a color schema that works for you, then click the less than symbol in the top left hand corner to start working with Visual Studio Code:

As always, I hope this helps those looking for step-by-step instructions and clarity of complete examples.

Written by maclochlainn

December 19th, 2022 at 8:50 pm

AlmaLinux Installation

without comments

These are the instructions for installing AlmaLinux 9 on MacOS Intel with VMware. It’s broken into three parts: Configuration, Installation, and Setup.

You should download the current or desired older version of AlmaLinux from the website. It’s a good idea to install it in a source directory or folder.

You need to launch VMware, click the File menu option and then the New menu option before you can configure, install, and setup AlmaLinux. It will show you the following dialog.

Use the Finder to drag the AlmaLinux-9-latest-x86_64-dvd.iso file on to the Install from disc or image to begin the configuration process.

Configuration

Oracle12cInstall01

  1. The first thing you need to do is configure the VMware container. You click on the wrench icon in the menu bar that lets you edit the hardware settings for this virtual machine. This opens the general settings dialog.

Oracle12cInstall02

  1. The General System Settings dialog lets you will configure the isolation properties for “drag and drop” and “copy and paste”, and define the network adapter.

Oracle12cInstall03

  1. Click on the Isolation menu option from the General System Settings dialog, and enable “Drag adn Drop” and “Copy and Paste” checkboxes. Then, return to the General System Settings dialog/li>

Oracle12cInstall03

  1. Click on the Network Adapter menu option from the General System Settings dialog, and click the “Autodetect” checkbox. Then, return to the General System Settings dialog.

Installation

Oracle12cInstall02

  1. The first the install asks you to do is type an I for install or T for test. Generally, you can skip the test if this is a copied file rather than DVD.

Oracle12cInstall01

  1. Click the Tab key to configure the target installation or Enter key to skip the automatic boot delay.

Oracle12cInstall03

  1. Choose the installation language and click the Continue button.

Oracle12cInstall04

  1. The Installation Summary dialog lets you fix anything with a warning message orange triangle. Fix the Root Password first by clicking on the text.

Oracle12cInstall05

  1. Enter the Root Password twice, click the Lock root account checkbox to unselect it, and click the Allow root SSH login with password checkbox to enable it.

Oracle12cInstall06

  1. Click the Done button to complete setting the root password.

Oracle12cInstall07

  1. After fixing the root password, click on the Installation Destination item to change the default partition.

Oracle12cInstall08

  1. Click the Done button to accept the initial size of the VM partition.

Oracle12cInstall08

  1. Click the Software Selection element to add software components to the default installation.

Oracle12cInstall09

  1. Click the checkboxes for the following additional software:
    • Debugging Tools
    • Performance Tools
    • Remote Desktop Clients
    • Remote Management for Linux
    • Legacy UNIX Compatibility
    • Console Internet Tools
    • Development Tools
    • .NET Development
    • Graphical Administration Tools
    • System Tools

    Click the Done button to accept the added software elements.

Oracle12cInstall08

  1. Click the Begin Installation button to begin the installation of AlmaLinux.

Oracle12cInstall11

  1. The Installing Progress dialog will show a progress bar for several minutes.

Oracle12cInstall11

  1. The Installing Progress dialog eventually completes, and you click the Reboot System button to complete the installation.

Setup

Oracle12cInstall02

  1. The Welcome to AlmaLinux page begins the set up of the operating systems.

Oracle12cInstall01

  1. Click the Slide to disable location services.

Oracle12cInstall01

  1. After clicking the Slide location services are disabled.

Oracle12cInstall01

  1. The Online Account dialog lets you connect your email, online calendar, contacts, documents, and photos. You click the Skip button to avoid setting up any of the online accounts.

Oracle12cInstall01

  1. The About You dialog lets you enter user account with sudoer privileges.

Oracle12cInstall01

  1. The About You dialog enters a title case user’s name and a lowercase user’s name.

Oracle12cInstall01

  1. The Password dialog lets you enter a case sensitive password.

Oracle12cInstall01

  1. The Password dialog displays the entry of the passwords as dots.

Oracle12cInstall01

  1. The Setup Complete dialog leaves you to click the Start Using AlmaLinux button to complete the setup.

Oracle12cInstall01

  1. The blank image page displays until you click on it.

Oracle12cInstall01

  1. The Welcome to AlmaLinux dialog invites you to take a tour or decline it. Click the No Thanks button to decline the tour.

Oracle12cInstall01

  1. After declining the tour, it displays the core AlmaLinux screen.

Oracle12cInstall01

  1. Rebooting the system is necessary to complete the installation. Click on the circle icon on the right to begin the process to restart or shutdown the operating system. Click on the Power Off / Log Out dropdown to continue.

Oracle12cInstall01

  1. Click the Restart… menu option to restart the operating system.

Oracle12cInstall01

  1. Click the Restart… menu option to confirm the restart of the operating system.

Oracle12cInstall01

  1. Click the Student icon to get prompted for a password.

Oracle12cInstall01

  1. Enter the Student password to connect to the AlmaLinux operating system.

Oracle12cInstall01

  1. This displays the standard working interface for the AlmaLinux operating system.

Written by maclochlainn

October 28th, 2022 at 11:39 pm

Bash Debug Function

without comments

My students working in Linux would have a series of labs to negotiate and I’d have them log the activities of their Oracle SQL scripts. Many of them would suffer quite a bit because they didn’t know how to find the errors in the log files.

I wrote this SQL function for them to put in their .bashrc files. It searches all the .txt files for errors and organizes them by log file, line number, and descriptive error message.

errors () 
{ 
  label="File Name:Line Number:Error Code";
  list=`ls ./*.$1 | wc -l`;
  if [[ ${list} -eq 1 ]]; then
    echo ${label};
    echo "----------------------------------------";
    filename=`ls *.txt`;
    echo ${filename}:`find . -type f | grep -in *.txt -e ora\- -e pls\- -e sp2\-`;
  else
    if [[ ${list} -gt 1 ]]; then
      echo ${label};
      echo "----------------------------------------";
      find . -type f | grep --color=auto -in *.txt -e ora\- -e pls\- -e sp2\-;
    fi;
  fi
}

I hope it helps others now too.

Written by maclochlainn

May 4th, 2022 at 10:51 pm

Linux sqlplus wrapper

without comments

Here’s a quick way to ensure you can use the up-arrows and navigation keys when using the sqlplus command-line interface. You can just add it to your .bashrc file.

sqlplus ()
{ 
    path=`which rlwrap 2>/dev/null`;
    file='';
    if [ -n ${path} ]; then
        file=${path##/*/};
    fi;
    if [ -n ${file} ] && [[ ${file} = "rlwrap" ]]; then
        rlwrap sqlplus "${@}";
    else
        echo "Command-line history unavailable: Install the rlwrap package.";
        $ORACLE_HOME/bin/sqlplus "${@}";
    fi
}

As always, I hope this helps those looking of solutions.

Written by maclochlainn

November 12th, 2021 at 11:34 pm

Installing PL/Python Extension

without comments

While PL/Python is an untrusted language inside PostgreSQL, I was installing it to test some of its features. First, we check to see if PL/Python is installed by attempting to create a PL/Python function:

CREATE FUNCTION pima(a integer, b integer)
RETURNS integer AS
$$
if a > b:
  return a
return b
$$ LANGUAGE plpython3u;

It likely should raise an error like this because PL/Python is an untrusted language. It’s untrusted because it runs with root privileges rather than a restricted user’s privilege. More or less, with PL/Python you can access the entire database. This makes PL/Python more of a threat than tool beyond experimentation in a test database.

ERROR:  language "plpython3u" does not exist
HINT:  Use CREATE EXTENSION to load the language into the database.

A quick query as the postgres user tells you whether or not PL/Python is installed:

SELECT * FROM pg_language;

It returns the following:

 lanname  | lanowner | lanispl | lanpltrusted | lanplcallfoid | laninline | lanvalidator | lanacl 
----------+----------+---------+--------------+---------------+-----------+--------------+--------
 internal |       10 | f       | f            |             0 |         0 |         2246 | 
 c        |       10 | f       | f            |             0 |         0 |         2247 | 
 sql      |       10 | f       | t            |             0 |         0 |         2248 | 
 plpgsql  |       10 | t       | t            |         14088 |     14089 |        14090 | 
(4 rows)

I attempted to add PL/Python with the following command:

CREATE EXTENSION plpython3u;

It raised the following error:

ERROR:  could not open extension control file "/usr/pgsql-11/share/extension/plpython3u.control": No such file or directory

The error basically appeared to occur because there’s a missing Python 3 package from what I could find on the web. I installed the missing postgresql-plpython3 package as the root superuser, which you also could install as a member of the sudoer list. The following shows how to install it as a sudoer member:

sudo yum install -y postgresql-plpython3

You should see something close to the following console output:

Last metadata expiration check: 0:43:53 ago on Fri 06 Nov 2020 10:42:28 AM MST.
Dependencies resolved.
============================================================================================================
 Package                           Architecture        Version                   Repository            Size
============================================================================================================
Installing:
 postgresql-plpython3              x86_64              11.7-2.fc30               updates               86 k
Installing dependencies:
 postgresql-server                 x86_64              11.7-2.fc30               updates              5.3 M
 
Transaction Summary
============================================================================================================
Install  2 Packages
 
Total download size: 5.3 M
Installed size: 23 M
Downloading Packages:
(1/2): postgresql-plpython3-11.7-2.fc30.x86_64.rpm                          218 kB/s |  86 kB     00:00    
(2/2): postgresql-server-11.7-2.fc30.x86_64.rpm                             3.0 MB/s | 5.3 MB     00:01    
------------------------------------------------------------------------------------------------------------
Total                                                                       2.1 MB/s | 5.3 MB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                    1/1 
  Running scriptlet: postgresql-server-11.7-2.fc30.x86_64                                               1/2 
  Installing       : postgresql-server-11.7-2.fc30.x86_64                                               1/2 
warning: /var/lib/pgsql/.bash_profile created as /var/lib/pgsql/.bash_profile.rpmnew
 
  Running scriptlet: postgresql-server-11.7-2.fc30.x86_64                                               1/2 
  Installing       : postgresql-plpython3-11.7-2.fc30.x86_64                                            2/2 
  Running scriptlet: postgresql-plpython3-11.7-2.fc30.x86_64                                            2/2 
  Verifying        : postgresql-plpython3-11.7-2.fc30.x86_64                                            1/2 
  Verifying        : postgresql-server-11.7-2.fc30.x86_64                                               2/2 
 
Installed:
  postgresql-plpython3-11.7-2.fc30.x86_64                postgresql-server-11.7-2.fc30.x86_64               
 
Complete!

While I thought this might fix the problem, it didn’t and raised the following error:

ERROR:  could not open extension control file "/usr/pgsql-11/share/extension/plpython3u.control": No such file or directory

I found the plpython3u.control file on GitHub and put the following plpython3u.control file, after comparing it against the plpgsql.control file, into the /usr/pgsql-11/share/extension directory. At this point, I began wondering why it’s looking in the /usr/pgsql-11/share/extension directory instead of a /usr/plpython3u/share/extension directory (does not exist).

# plpython3u extension
comment = 'PL/Python3U untrusted procedural language'
default_version = '1.0'
module_pathname = '$libdir/plpython3'
relocatable = false
schema = pg_catalog
superuser = true

I retried creating the plpython3u extension:

CREATE EXTENSION plpython3u;

It raised the following error:

ERROR:  extension "plpython3u" has no installation script nor update path for version "1.0"

At this point, I could find no further help on the Internet. I did notice that there were these two *.sql files in the /usr/pgsql-11/share/extension directory:

  • plpgsql–1.0.sql
  • plpgsql–unpackaged–1.0.sql

I found this plpython3u--1.0.sql file on GitHub:

/* src/pl/plpython/plpython3u--1.0.sql */
 
CREATE FUNCTION plpython3_call_handler() RETURNS language_handler
  LANGUAGE c AS 'MODULE_PATHNAME';
 
CREATE FUNCTION plpython3_inline_handler(internal) RETURNS void
  STRICT LANGUAGE c AS 'MODULE_PATHNAME';
 
CREATE FUNCTION plpython3_validator(oid) RETURNS void
  STRICT LANGUAGE c AS 'MODULE_PATHNAME';
 
CREATE LANGUAGE plpython3u
  HANDLER plpython3_call_handler
  INLINE plpython3_inline_handler
  VALIDATOR plpython3_validator;
 
COMMENT ON LANGUAGE plpython3u IS 'PL/Python3U untrusted procedural language';

I retried creating the plpython3u extension, as a member of the sudoer list and got a new error:

ERROR:  permission denied to create extension "plpython3u"
HINT:  Must be superuser to create this extension.

I retried creating the plpython3u extension as the postgres user, who is the owning user:

CREATE EXTENSION plpython3u;

It raised the following error:

ERROR:  could not access file "$libdir/plpython3": No such file or directory

While I intend to finish this, that’s as far as I got. It appears from some of the things I’ve read I need to recompile or configure items that would destabilize what I have working at the moment. Finishing this will need to wait for me to build another test environment from scratch. If you catch this post and know the remaining steps, I invite you to add them in the comments.

Written by maclochlainn

November 8th, 2020 at 1:54 pm

Linux mongod Service

with one comment

The installation of MongoDB doesn’t do everything for you. In fact, the first time you start the mongod service, like this as the root user or sudoer user with the command:

service mongod start

A sudoer user will be prompted for their password, like

A typical MongoDB instance raises the following errors:

Redirecting to /bin/systemctl start mongod.service
[student@localhost cit425]$ mongo
MongoDB shell version v3.4.11
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.11
Server has startup warnings: 
2018-10-29T10:51:57.515-0600 I STORAGE  [initandlisten] 
2018-10-29T10:51:57.515-0600 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-10-29T10:51:57.515-0600 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-10-29T10:51:58.264-0600 I CONTROL  [initandlisten] 
2018-10-29T10:51:58.264-0600 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.                                                                                               
2018-10-29T10:51:58.264-0600 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.                                                                              
2018-10-29T10:51:58.264-0600 I CONTROL  [initandlisten]                                                  
2018-10-29T10:51:58.265-0600 I CONTROL  [initandlisten]                                                  
2018-10-29T10:51:58.265-0600 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 15580 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files.

You can fix this by following the MongoDB instructions for the Unix ulimit Settings, which will tell you to create a mongod file in the /etc/systemd/system directory. You should create this file as the root superuser. This is what you should put in the file:

[Unit]
Description=MongoDB
Documentation=man:mongo
 
[Service]
# Other directives omitted
# (file size)
LimitFSIZE=infinity
# (cpu time)
LimitCPU=infinity
# (virtual memory size)
LimitAS=infinity
# (locked-in-memory size)
LimitMEMLOCK=infinity
# (open files)
LimitNOFILE=64000
# (processes/threads)
LimitNPROC=64000

Then, you should be able to restart the mongod service without any warnings with this command:

service mongod restart

As always, I hope this helps somebody.

Written by maclochlainn

October 29th, 2018 at 11:39 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

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