surroundings:
[root@test ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.3.1611 (Core)
Release: 7.3.1611
Codename: Core
Package:
postgresql-11.2.tar.gz
I. extract the package
mkdir /soft/pgsql
tar -xvf postgresql-11.2.tar.gz
II. Yum source configuration and installation package
cd / run / media / liang / CentOS \ 7 \ x86_64 /
cd Packages/
mkdir /yums
cp * /yums
Several local installation package yum source required.
rpm -ivh deltarpm-
rpm -ivh python deltarpm-
rpm -ivh createrepo-
Different versions of this particular version numbers may be different, but the front of the prefix is the same, that is to say the package is the same.
Configure the local yum source
cd /yums
createrepo .
Etc. done here.
cd /etc/yum.repos.d
rm -rf C * --- delete all here, try to avoid using rm -rf *
vi yum.local.repo
[local]
name=yum local repo
baseurl = file: /// yums
gpgcheck=0
enable=1
yum clean all
Necessary for the installation package
yum install -y bc
yum install -y compat-libcap1*
yum install -y compat-libcap*
yum install -y binutils
yum install -y compat-libstdc++-33
yum install -y elfutils-libelf
yum install -y elfutils-libelf-devel
yum install -y gcc
yum install -y gcc-c++
yum install -y glibc-2.5
yum install -y glibc-common
yum install -y glibc-devel
yum install -y glibc-headers
yum install -y ksh libaio
yum install -y libaio-devel
yum install -y libgcc
yum install -y libstdc++
yum install -y libstdc++-devel
yum install -y make
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install -y libXp*
yum install -y glibc-kernheaders
yum install -y net-tools-*
Here I installed directly in accordance with oracle package installed, since the latter also need to install oracle
III. Create a directory and user
groupadd -g 2000 postgres
useradd -u 2001 -g 2000 postgres
chmod -R 775 postgresql-11.2
chown -R postgres:postgres postgresql-11.2
mkdir /pgsql/11.2/data
chown postgres:postgres /pgsql/11.2/data
Configuration environment variable:
su - postgres
vi .bash_profile
export PATH
export PATH
PGHOME=/pgsql/11.2/data
export PGHOME
PGDATA=/pgsql/11.2/database
export PGDATA
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PGHOME/bin
IV. To start the installation
su - postgres
cd /soft/pgsql/postgresql-11.2
./configure --prefix=/pgsql/11.2/data --配置
make;
make install;
cd /pgsql/11.2/
mkdir database - Creating Cluster Approach
cd /soft/pgsql/postgresql-11.2
initdb -D /pgsql/11.2/database/ -E utf8 - initialization cluster
cat postgresql.conf | grep listen_addresses - Configuring the Listener
cat postgresql.conf | grep port
pg_ctl start -D $ PGDATA - Start the cluster
pg_ctl status
[postgres@test database]$ psql -l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
pg_ctl stop -mf - close the database
pg_ctl start
pg_ctl status
ps -ef | grep mail