Ask Me

Installation of MySQL Database on Oracle Linux 7 using Generic Binaries

 


Step 1 . Oracle provides a set of binary distributions of MySQL. These include generic binary distributions in the form of compressed tar files (files with a .tar.gz extension) for a number of platform .
  • Download it from mysql site.
  • https://downloads.mysql.com/archives/
  • Select your version and platform and download the .tar type
  • Ex. Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit), TAR
  • Downloaded file  mysql-5.7.28-el7-x86_64.tar.gz

Step 2. Remove previous versions of installed binary 

Checking installed               ---------     rpm -qa | egrep mysql

Uninstall existing ones        ---------     rpm -e mysql.XXXXXXXX

Step 3: Unzip  files where you wanted to keep the mysql binary (Base Directory)
            Here i did it on /u01/mysql path and the directory Structure. 

[root@xcell oradba]# tar -xzvf mysql-5.7.28-el7-x86_64.tar.gz -C /u01/mysql

[root@xcell mysql-5.7.28-el7-x86_64]# ls -lrt
total 312
-rw-r--r--.  1 7161 31415    587 Sep 27  2019 README
-rw-r--r--.  1 7161 31415 279547 Sep 27  2019 LICENSE
drwxr-xr-x.  3 root root    4096 Apr 24 22:46 include
drwxr-xr-x.  4 root root    4096 Apr 24 22:46 man
drwxr-xr-x.  2 root root    4096 Apr 24 22:47 bin - 
drwxr-xr-x.  2 root root    4096 Apr 24 22:47 support-files
drwxr-xr-x. 28 root root    4096 Apr 24 22:47 share
drwxr-xr-x.  5 root root    4096 Apr 24 22:47 lib
drwxr-xr-x.  2 root root    4096 Apr 24 22:47 docs

DirectoryContents of Directory
bin mysqd server, client and utility programs
docsMySQL manual in Info format
manUnix manual pages
includeInclude (header) files
libLibraries
shareError messages, dictionary, and SQL for database installation
support-filesMiscellaneous support files

Step 4: Add necessary users 

groupadd mysql
useradd -r -g mysql -s /bin/false mysql
chown mysql:mysql /u01/mysql

Step 5: Go to the binary location and support-files directory ,
create the config file or Option file

EX. My.cnf

[root@xcell support-files]# ls -lrt
total 28
-rw-r--r--. 1 mysql mysql   773 Sep 27  2019 magic
-rwxr-xr-x. 1 mysql mysql 10576 Sep 27  2019 mysql.server
-rwxr-xr-x. 1 mysql mysql   894 Sep 27  2019 mysql-log-rotate
-rwxr-xr-x. 1 mysql mysql  1061 Sep 27  2019 mysqld_multi.server

-rw-r--r--. 1 mysql mysql   177 Apr 24 23:00 my.cnf

Also create a soft link in below location


[root@xcell ~]# ls -lrt /etc/my.cnf
lrwxrwxrwx. 1 root root 55 Apr 25 16:31 /etc/my.cnf -> /u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf

[root@xcell ~]#

[root@xcell ~]# cat /etc/my.cnf
[mysqld]
server-id=2                                        -- Serverid (for multiple serv)
socket=/u01/mysql/mysql-5.7.28-el7-x86_64/mysql.sock  -- socket file
port=3307                                             -- port (default 3306)
basedir=/u01/mysql/mysql-5.7.28-el7-x86_64
general-log
datadir=/u01/mysql/mysql-5.7.28-el7-x86_64/data  --- location for new database
max_binlog_size=4096
log-bin=mysql

[client]                   -- Client Option used for client conn as root or os auth
socket=/u01/mysql/mysql-5.7.28-el7-x86_64/mysql.sock
[root@xcell ~]#


Step 6: Go back to Bin location inside binary

[root@xcell bin]# ./mysqld --defaults-file=/u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf --user=mysql --initialize 2020-04-24T18:05:03.535086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2020-04-24T18:05:04.298446Z 0 [Warning] InnoDB: New log files created, LSN=45790 2020-04-24T18:05:04.627597Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2020-04-24T18:05:04.701383Z 0 [Warning] No existing UUID has been found,
so we assume that this is the first time that this server has been started.
Generating a new UUID: 1fcc4cde-8656-11ea-8b82-08002743c30b. 2020-04-24T18:05:05.042753Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2020-04-24T18:05:09.874302Z 0 [Warning] CA certificate ca.pem is self signed. 2020-04-24T18:05:10.591258Z 1 [Note] A temporary password is generated for root@localhost: r5g:+l9&jecG [root@xcell bin]#


root@devserver support-files]# ls
magic  my.cnf  mysqld_multi.server  mysql-log-rotate  mysql.server
[root@devserver support-files]# ls -lrt
total 28
-rw-r--r--. 1 mysql mysql   773 Sep 27  2019 magic
-rwxr-xr-x. 1 mysql mysql 10576 Sep 27  2019 mysql.server
-rwxr-xr-x. 1 mysql mysql   894 Sep 27  2019 mysql-log-rotate
-rwxr-xr-x. 1 mysql mysql  1061 Sep 27  2019 mysqld_multi.server
-rw-r--r--. 1 mysql mysql   341 May 10 14:33 my.cnf
[root@devserver support-files]# ./mysql.server start


Step 7: Secure your installation using the above auto generated root pass
and change the user pass

mysql_secure_installation --defaults-file=/u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf
socket=/u01/mysql/mysql-5.7.28-el7-x86_64/mysql2.sock

Securing the MySQL server deployment.


Enter password for user root:

Step 8: Configure the mysqld as a linux service.

[root@xcell system]# cat /etc/systemd/system/mysqld.service
[Unit]Description=MYSQL service
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=1
User=rootExec
Start= /u01/mysql/mysql-5.7.28-el7-x86_64/bin/mysqld
--defaults-file=/u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf --user=root
[Install]
WantedBy=multi-user.target


[root@xcell system]# service mysqld start

Redirecting to /bin/systemctl start  mysqld.service

[root@xcell system]# service mysqld statusRedirecting to /bin/systemctl status  mysqld.service
● mysqld.service - MYSQL service   Loaded: loaded (/etc/systemd/system/mysqld.service; disabled; vendor preset: disabled)   

Active: active (running) since Sat 2020-04-25 00:14:35 IST; 3s ago Main PID: 10389 (mysqld)   CGroup: /system.slice/mysqld.service           

└─10389 /u01/mysql/mysql-5.7.28-el7-x86_64/bin/mysqld --defaults-file=/u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf --user=rootApr 25 00:14:36

xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.036985Z 0 [Warning] CA certificate ca.pem is self signed.Apr 25 00:14:36

xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.037039Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.Apr 25 00:14:36

xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.037249Z 0 [Note] Server hostname (bind-address): '*'; port: 3307Apr 25 00:14:36

xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.037299Z 0 [Note] IPv6 is available.Apr 25 00:14:36 xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.037316Z 0 [Note]   - '::' resolves to '::';Apr 25 00:14:36

xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.037348Z 0 [Note] Server socket created on IP: '::'.Apr 25 00:14:36

xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.051042Z 0 [Note] Failed to start slave threads for channel ''Apr 25 00:14:36

xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.063109Z 0 [Note] Event Scheduler: Loaded 0 eventsApr 25 00:14:36

xcell.home.com mysqld[10389]: 2020-04-24T18:44:36.063823Z 0 [Note] /u01/mysql/mysql-5.7.28-el7-x86_64/bin/mysqld: ready for connections.Apr 25 00:14:36

xcell.home.com mysqld[10389]: Version: '5.7.28'  socket: '/u01/mysql/mysql-5.7.28-el7-x86_64/mysql2.sock'  port: 3307  MySQL Community Server (GPL)Hint: Some lines were ellipsized, use -l to show in full.

[root@xcell system]#


Installation of MySQL Database on Oracle Linux 7 using RPM Method

 1. Install Required  RPMS specified below , can be downloaded from oracle edelivery site.


rpm -ivh mysql-commercial-devel-5.7.29-1.1.el7.x86_64.rpm  --force --nodeps
rpm -ivh mysql-commercial-common-5.7.29-1.1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-commercial-client-5.7.29-1.1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-commercial-embedded-5.7.29-1.1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-commercial-embedded-compat-5.7.29-1.1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-commercial-embedded-devel-5.7.29-1.1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-commercial-libs-compat-5.7.29-1.1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-commercial-libs-5.7.29-1.1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-commercial-server-5.7.29-1.1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-commercial-test-5.7.29-1.1.el7.x86_64.rpm


2. Check mysql deamon -->root# service mysql status

3. Login to mysql -- you may get this error

[root@xcell trace]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@xcell trace]#

4. Get temporary pass from installation log file

[root@xcell ~]# grep "A temporary password" /var/log/mysqld.log
2020-04-02T12:17:50.275514Z 1 [Note] A temporary password is generated for root@localhost: X(kV9r51Yle*

5. Set current environment calling the utility mysql_secure_installation by using the temporary root password

[root@xcell ~]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:

Re-enter new password:
 ... Failed! Error: Your password does not satisfy the current policy requirements

New password:

Re-enter new password:
 ... Failed! Error: Your password does not satisfy the current policy requirements

New password:

Re-enter new password:
 ... Failed! Error: Your password does not satisfy the current policy requirements

New password:

Re-enter new password:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.

Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password:

Re-enter new password:

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

--> Service mysqld restart


[root@xcell ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.29-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> help




mysql> status
--------------
mysql  Ver 14.14 Distrib 5.7.29, for Linux (x86_64) using  EditLine wrapper

Connection id:          4
Current database:       mysql
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.7.29-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 2 min 10 sec

Threads: 1  Questions: 46  Slow queries: 0  Opens: 136  Flush tables: 1  Open tables: 129  Queries per second avg: 0.353
--------------

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mydb               |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)


mysql> SELECT User, Host, plugin FROM mysql.user;
+-----------+-----------+-----------------------+
| User      | Host      | plugin                |
+-----------+-----------+-----------------------+
| root      | localhost | mysql_native_password |
| mysql.sys | localhost | mysql_native_password |
+-----------+-----------+-----------------------+
2 rows in set (0.00 sec)

mysql>

Postgres Remove connectivity -Where Postgres database running on Cloud compute node.

  

 Step 1: You can install postgres using source code  under any compute running on any cloud services (OCI,AZURE,AWS,GCS) .Below link can be used .

https://deepakoracledba.blogspot.com/p/postgres-binary-based-installation-v14.html

 Step 2: As per above link installation my location on all postgres related datafiles under below dir.

postgres@nftserver ~> cd $PGDATA

postgres@nftserver /u01/pdata> ll

total 64

drwx------. 6 postgres postgres    54 Sep  3 07:02 base

drwx------. 2 postgres postgres  4096 Sep  3 07:02 global

drwx------. 2 postgres postgres     6 Aug 29 04:52 pg_commit_ts

drwx------. 2 postgres postgres     6 Aug 29 04:52 pg_dynshmem

-rw-------. 1 postgres postgres  4960 Sep  3 06:56 pg_hba.conf

-rw-------. 1 postgres postgres  1636 Aug 29 04:52 pg_ident.conf

drwx------. 4 postgres postgres    68 Sep  3 07:07 pg_logical

drwx------. 4 postgres postgres    36 Aug 29 04:52 pg_multixact

drwx------. 2 postgres postgres     6 Aug 29 04:52 pg_notify

drwx------. 2 postgres postgres     6 Aug 29 04:52 pg_replslot

drwx------. 2 postgres postgres     6 Aug 29 04:52 pg_serial

drwx------. 2 postgres postgres     6 Aug 29 04:52 pg_snapshots

drwx------. 2 postgres postgres     6 Sep  3 06:52 pg_stat

drwx------. 2 postgres postgres    84 Sep  4 08:18 pg_stat_tmp

drwx------. 2 postgres postgres    18 Aug 29 04:52 pg_subtrans

drwx------. 2 postgres postgres     6 Aug 29 04:52 pg_tblspc

drwx------. 2 postgres postgres     6 Aug 29 04:52 pg_twophase

-rw-------. 1 postgres postgres     3 Aug 29 04:52 PG_VERSION

drwx------. 3 postgres postgres    60 Aug 29 04:52 pg_wal

drwx------. 2 postgres postgres    18 Aug 29 04:52 pg_xact

-rw-------. 1 postgres postgres    88 Aug 29 04:52 postgresql.auto.conf

-rw-------. 1 postgres postgres 28781 Sep  3 06:52 postgresql.conf

-rw-------. 1 postgres postgres    27 Sep  3 06:52 postmaster.opts

-rw-------. 1 postgres postgres    77 Sep  3 06:52 postmaster.pid

postgres@nftserver /u01/pdata>


 Step 3: You need to update 2 files

postgresql.conf :-- Postgres Sever configuration like (SPFILE in ORACLE) , Be default it locahost , so database will be accessible in local host only, Please change it to 0.0.0.0

postgres@nftserver /u01/pdata> grep listen postgresql.conf

#listen_addresses = 'localhost'         # what IP address(es) to listen on;

listen_addresses = '0.0.0.0'

postgres@nftserver /u01/pdata>


pg_hba.conf :-- Postgres client authentication file . Please add below line so it will accept connection from any IP addresses remotely. You can use the client IP address for limited usage or security purposes.

postgres@nftserver /u01/pdata> grep 0.0.0.0/0 pg_hba.conf
host    all             all             0.0.0.0/0               password
postgres@nftserver /u01/pdata>


 Step 3: Now open port in firewall using root access.

Example here i have already open the port.

[root@nftserver opc]# netstat -lntu | grep 5435

tcp        0      0 0.0.0.0:5435            0.0.0.0:*               LISTEN

[root@nftserver opc]#

To open port.

firewall-cmd --add-port=5435/tcp

firewall-cmd --add-port=4000/tcp --permanent


Step 4: Similarly update same port under OCI console security list ingress rule.




  Step 5: Now install PGADMIN for postgres in your client system running on windows operating system

 Step 6 : Configure in PGADMIN to connect remote database.

add new server , give a name any name i have give ip address as name, then in connection tab . please update IP address or hostname , port , username and password







 

Installation of Postgres database in Linux system using Binary based using source code

 

 Step 1: As like any other opensource database , we will install database under root user and later will give the ownership of the binary .

 Step 2:create a unix user and group named as postgres


groupdd postgres

userdd postgres -g postgres

 Step 3:Download latest version of postgrace binary from postgres portal and unzip it


https://www.postgresql.org/ftp/source/v14.5/

[root@nftserver opc]# ll
total 4217756
drwxrwxrwx. 6 1107 1107       4096 Jun 13 20:08 postgresql-14.4
-rw-rw-r--. 1 opc  opc   147312640 Aug  2 06:45 postgresql-14.4.tar
[root@nftserver opc]#

 Step 4: Next step to build the binary , we need pass location of the software installation as value for -prefix.


Then run the below command . This is basically used to check system requirements like ram cpu and other dependent software packages 

[root@nftserver postgresql-14.4]# ./configure  --prefix=/u01/postgres
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking which template to use... linux
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
checking for g++... no
checking for c++... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking for gawk... gawk
checking whether gcc supports -Wdeclaration-after-statement, for CFLAGS... yes
checking whether gcc supports -Werror=vla, for CFLAGS... yes
checking whether gcc supports -Werror=unguarded-availability-new, for CFLAGS... no
checking whether g++ supports -Werror=unguarded-availability-new, for CXXFLAGS... no
checking whether gcc supports -Wendif-labels, for CFLAGS... yes
checking whether g++ supports -Wendif-labels, for CXXFLAGS... no
checking whether gcc supports -Wmissing-format-attribute, for CFLAGS... yes
checking whether g++ supports -Wmissing-format-attribute, for CXXFLAGS... no
checking whether gcc supports -Wimplicit-fallthrough=3, for CFLAGS... yes
checking whether g++ supports -Wimplicit-fallthrough=3, for CXXFLAGS... no
checking whether gcc supports -Wcast-function-type, for CFLAGS... yes
checking whether g++ supports -Wcast-function-type, for CXXFLAGS... no
checking whether gcc supports -Wformat-security, for CFLAGS... yes
checking whether g++ supports -Wformat-security, for CXXFLAGS... no
checking whether gcc supports -fno-strict-aliasing, for CFLAGS... yes
checking whether g++ supports -fno-strict-aliasing, for CXXFLAGS... no
checking whether gcc supports -fwrapv, for CFLAGS... yes
checking whether g++ supports -fwrapv, for CXXFLAGS... no
checking whether gcc supports -fexcess-precision=standard, for CFLAGS... yes
checking whether g++ supports -fexcess-precision=standard, for CXXFLAGS... no
checking whether gcc supports -funroll-loops, for CFLAGS_UNROLL_LOOPS... yes
checking whether gcc supports -ftree-vectorize, for CFLAGS_VECTORIZE... yes
checking whether gcc supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... no
checking whether gcc supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... no
checking whether gcc supports -Wformat-truncation, for NOT_THE_CFLAGS... yes
checking whether gcc supports -Wstringop-truncation, for NOT_THE_CFLAGS... yes
checking whether the C compiler still works... yes
checking how to run the C preprocessor... gcc -E
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking allow thread-safe client libraries... yes
checking whether to build with ICU support... no
checking whether to build with Tcl... no
checking whether to build Perl modules... no
checking whether to build Python modules... no
checking whether to build with GSSAPI support... no
checking whether to build with PAM support... no
checking whether to build with BSD Authentication support... no
checking whether to build with LDAP support... no
checking whether to build with Bonjour support... no
checking whether to build with SELinux support... no
checking whether to build with systemd support... no
checking whether to build with XML support... no
checking whether to build with LZ4 support... no
checking for ld used by GCC... /bin/ld
checking if the linker (/bin/ld) is GNU ld... yes
checking for ranlib... ranlib
checking for strip... strip
checking whether it is possible to strip libraries... yes
checking for ar... ar
checking for a BSD-compatible install... /bin/install -c
checking for tar... /bin/tar
checking whether ln -s works... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for bison... /bin/bison
configure: using bison (GNU Bison) 3.0.4
checking for flex... /bin/flex
configure: using flex 2.6.1
checking for perl... /bin/perl
configure: using perl 5.26.3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for strerror_r... yes
checking for getpwuid_r... yes
checking for gethostbyname_r... yes
checking whether strerror_r returns int... no
checking for main in -lm... yes
checking for library containing setproctitle... no
checking for library containing dlsym... -ldl
checking for library containing socket... none required
checking for library containing shl_load... no
checking for library containing getopt_long... none required
checking for library containing shm_open... -lrt
checking for library containing shm_unlink... none required
checking for library containing clock_gettime... none required
checking for library containing fdatasync... none required
checking for library containing shmget... none required
checking for library containing backtrace_symbols... none required
checking for library containing gethostbyname_r... none required
checking for library containing pthread_barrier_wait... -lpthread
checking for library containing readline... -lreadline
checking for inflate in -lz... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking atomic.h usability... no
checking atomic.h presence... no
checking for atomic.h... no
checking copyfile.h usability... no
checking copyfile.h presence... no
checking for copyfile.h... no
checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking ifaddrs.h usability... yes
checking ifaddrs.h presence... yes
checking for ifaddrs.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking mbarrier.h usability... no
checking mbarrier.h presence... no
checking for mbarrier.h... no
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/event.h usability... no
checking sys/event.h presence... no
checking for sys/event.h... no
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking sys/procctl.h usability... no
checking sys/procctl.h presence... no
checking for sys/procctl.h... no
checking sys/pstat.h usability... no
checking sys/pstat.h presence... no
checking for sys/pstat.h... no
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/sem.h usability... yes
checking sys/sem.h presence... yes
checking for sys/sem.h... yes
checking sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking sys/signalfd.h usability... yes
checking sys/signalfd.h presence... yes
checking for sys/signalfd.h... yes
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking sys/tas.h usability... no
checking sys/tas.h presence... no
checking for sys/tas.h... no
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking ucred.h usability... no
checking ucred.h presence... no
checking for ucred.h... no
checking wctype.h usability... yes
checking wctype.h presence... yes
checking for wctype.h... yes
checking for net/if.h... yes
checking for sys/ucred.h... no
checking for netinet/tcp.h... yes
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking whether byte ordering is bigendian... no
checking for inline... inline
checking for printf format archetype... gnu_printf
checking for __func__... yes
checking for _Static_assert... yes
checking for typeof... typeof
checking for __builtin_types_compatible_p... yes
checking for __builtin_constant_p... yes
checking for __builtin_unreachable... yes
checking for computed goto support... yes
checking for struct tm.tm_zone... yes
checking for union semun... no
checking for struct sockaddr_un... yes
checking for struct sockaddr_storage... yes
checking for struct sockaddr_storage.ss_family... yes
checking for struct sockaddr_storage.__ss_family... no
checking for struct sockaddr_storage.ss_len... no
checking for struct sockaddr_storage.__ss_len... no
checking for struct sockaddr.sa_len... no
checking for struct addrinfo... yes
checking for locale_t... yes
checking for C/C++ restrict keyword... __restrict
checking for struct cmsgcred... no
checking for struct option... yes
checking for z_streamp... yes
checking whether assembler supports x86_64 popcntq... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking size of off_t... 8
checking size of bool... 1
checking for int timezone... yes
checking types of arguments for accept()... int, int, struct sockaddr *, socklen_t *
checking whether gettimeofday takes only one argument... no
checking for wcstombs_l declaration... no
checking for backtrace_symbols... yes
checking for clock_gettime... yes
checking for copyfile... no
checking for fdatasync... yes
checking for getifaddrs... yes
checking for getpeerucred... no
checking for getrlimit... yes
checking for kqueue... no
checking for mbstowcs_l... no
checking for memset_s... no
checking for poll... yes
checking for posix_fallocate... yes
checking for ppoll... yes
checking for pstat... no
checking for pthread_is_threaded_np... no
checking for readlink... yes
checking for readv... yes
checking for setproctitle... no
checking for setproctitle_fast... no
checking for setsid... yes
checking for shm_open... yes
checking for strchrnul... yes
checking for strsignal... yes
checking for symlink... yes
checking for syncfs... yes
checking for sync_file_range... yes
checking for uselocale... yes
checking for wcstombs_l... no
checking for writev... yes
checking for __builtin_bswap16... yes
checking for __builtin_bswap32... yes
checking for __builtin_bswap64... yes
checking for __builtin_clz... yes
checking for __builtin_ctz... yes
checking for __builtin_popcount... yes
checking for __builtin_frame_address... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking how gcc reports undeclared, standard C functions... error
checking for posix_fadvise... yes
checking whether posix_fadvise is declared... yes
checking whether fdatasync is declared... yes
checking whether strlcat is declared... no
checking whether strlcpy is declared... no
checking whether strnlen is declared... yes
checking whether preadv is declared... yes
checking whether pwritev is declared... yes
checking whether F_FULLFSYNC is declared... no
checking whether RTLD_GLOBAL is declared... yes
checking whether RTLD_NOW is declared... yes
checking for struct sockaddr_in6... yes
checking for PS_STRINGS... no
checking for dlopen... yes
checking for explicit_bzero... yes
checking for fls... no
checking for getopt... yes
checking for getpeereid... no
checking for getrusage... yes
checking for inet_aton... yes
checking for link... yes
checking for mkdtemp... yes
checking for pread... yes
checking for pwrite... yes
checking for random... yes
checking for srandom... yes
checking for strlcat... no
checking for strlcpy... no
checking for strnlen... yes
checking for strtof... yes
checking for pthread_barrier_wait... yes
checking for setenv... yes
checking for unsetenv... yes
checking for getaddrinfo... yes
checking for getopt_long... yes
checking for syslog... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for opterr... yes
checking for optreset... no
checking for strtoll... yes
checking for strtoull... yes
checking whether strtoll is declared... yes
checking whether strtoull is declared... yes
checking for rl_completion_append_character... yes
checking for rl_completion_suppress_quote... yes
checking for rl_filename_quote_characters... yes
checking for rl_filename_quoting_function... yes
checking for rl_completion_matches... yes
checking for rl_filename_completion_function... yes
checking for rl_reset_screen_size... yes
checking for append_history... yes
checking for history_truncate_file... yes
checking test program... ok
checking whether long int is 64 bits... yes
checking for __builtin_mul_overflow... yes
checking size of void *... 8
checking size of size_t... 8
checking size of long... 8
checking alignment of short... 2
checking alignment of int... 4
checking alignment of long... 8
checking alignment of double... 8
checking for int8... no
checking for uint8... no
checking for int64... no
checking for uint64... no
checking for __int128... yes
checking for __int128 alignment bug... ok
checking alignment of PG_INT128_TYPE... 16
checking for builtin __sync char locking functions... yes
checking for builtin __sync int32 locking functions... yes
checking for builtin __sync int32 atomic operations... yes
checking for builtin __sync int64 atomic operations... yes
checking for builtin __atomic int32 atomic operations... yes
checking for builtin __atomic int64 atomic operations... yes
checking for __get_cpuid... yes
checking for __cpuid... no
checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... no
checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=-msse4.2... yes
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=... no
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc... no
checking which CRC-32C implementation to use... SSE 4.2 with runtime check
checking for library containing sem_init... none required
checking which semaphore API to use... unnamed POSIX
checking which random number source to use... /dev/urandom
checking for /dev/urandom... yes
checking for xmllint... /bin/xmllint
checking for xsltproc... /bin/xsltproc
checking for fop... no
checking for dbtoepub... no
checking whether gcc supports -Wl,--as-needed... yes
configure: using compiler=gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10.0.2)
configure: using CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2
configure: using CPPFLAGS= -D_GNU_SOURCE
configure: using LDFLAGS=  -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/include/pg_config_ext.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port
[root@nftserver postgresql-14.4]#

 Step5: Now installation finished , Validate the location of the binary  and pass the ownership to postgres.


[root@nftserver postgresql-14.4]#  make install >> make_install.log

[root@nftserver postgresql-14.4]# chown -R postgres:postgres /u01/postgres
[root@nftserver postgresql-14.4]# chmod 775 -R /u01/postgres


[root@nftserver postgresql-14.4]# ll /u01/postgres/
total 16
drwxr-xr-x. 2 root     root     4096 Aug 28 16:09 bin
drwxrwxr-x. 6 postgres postgres 4096 Aug 28 16:08 include
drwxr-xr-x. 4 root     root     4096 Aug 28 16:10 lib
drwxr-xr-x. 6 root     root     4096 Aug 28 16:10 share
[root@nftserver postgresql-14.4]#
Step 6: Set your environment for postgres

Be default postgres used port :5432 and user directory /var/postges/data for storing datafile.

we can change the env and. here we are using /u01/pdata as datafile location . make sure postgres has the ownership for that lcoation.

postgres@nftserver /home/postgres> cat .bash_profile
[ -f /etc/profile ] && source /etc/profile
PGDATA=/u01/pdata
export PGDATA
# If you want to customize your settings,
# Use the file below. This is not overridden
# by the RPMS.
[ -f /var/lib/pgsql/.pgsql_profile ] && source /var/lib/pgsql/.pgsql_profile
export PS1="\u@\h \w> "
export LD_LIBRARY_PATH=/u01/postgres/lib:$LD_LIBRARY_PATH
export PATH=/u01/postgres/bin:$PATH
postgres@nftserver /home/postgres> 

 Step 7: now start default instance .


postgres@nftserver /home/postgres> pg_ctl init
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /u01/pdata ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... GMT
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /u01/postgres/bin/pg_ctl -D /u01/pdata -l logfile start

 Step 8: connect database using psql command line interface.

postgres@nftserver ~> psql -p 5432 -U postgres -d postgres
psql (14.4)
Type "help" for help.

postgres=# select datname from pg_database;
  datname
-----------
 postgres
 template1
 template0
(3 rows)

postgres=# show data_directory;
 data_directory
----------------
 /u01/pdata
(1 row)


Popular Posts