plpython3u ... Work/PostgreSQL2019. 3. 28. 14:07
postgresql 11 을 설치해서 사용해보고 있는데...
plpython 을 사용해야 할 일이 있어 버전 확인을 해보았다.
기본으로 2.7.5 를 사용할 수 있는 듯...
이전에도 phtyon 3 버전을 사용할 수 있는 방법을 찾고 있었는데, 별 수 없는듯...
그런데.. plpython3u 설치에 대한 한국 블로그를 보고 감동...
이대로 하면 될지 안될지 모르지만... 정말 감사..
[Installation of PostgreSQL 11 ]
1. Up-to-date
$su
$yum update
2. Installation of PostgreSQL
$yum install postgresql11-server.x86_64 postgresql11.x86_64
3. Creating a initial database
$cd /usr/pgsql-11/bin/
$./postgresql-11-setup initdb
4. Setting for Automatic restart of PostgreSQL
$systemctl enable postgresql-11
$systemctl enable postgresql-11.service
$systemctl start postgresql-11.service
5. Firewall Setting to open port 5432
$firewall-cmd --zone=public --add-port=5432/tcp
6. Setting for External connection to DBMS
$cd /var/lib/pgsql/11/data
$vi postgresql.conf
-- edit / add the following line
listen_addresses = '*'
7. Setting for Network connection from external client
$cd /var/lib/pgsql/11/data
$vi pg_hba.conf
-- edit the pg_hba.conf
local all all peer => local all all md5
host all all 127.0.0.1/32 ident => host all all 0.0.0.0/0 md5
host all all ::1/128 ident => host all all ::1/128 md5
-- Final result
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 md5
8. Setting for postgres
$su postgres
$psql
\password postgres
\q
9. Return to root or another user
$exit
10. Restart of PostgreSQL
$systemctl restart postgresql-11.service
11. UUID 확장 기능 설치를 위해 다음 명령이 필요함
$systemctl stop postgresql-11.service
$yum install postgresql11-contrib.x86_64
$systemctl start postgresql-11.service
[Installation of PgAdmin4(optional)]
$yum install pgadmin4-desktop-gnome
[Installation of PostGIS on PostgreSQL 11]
$yum install epel-release
--For version 2.5 on postgresql 11
$yum install postgis25_11.x86_64
$systemctl restart postgresql-11.service
[Installation of PL/Python3u on PostgreSQL 11]
1.Installation of Python 3.6
$sudo yum -y update
$sudo yum -y install yum-utils
$sudo yum -y groupinstall development
$sudo yum -y install https://centos7.iuscommunity.org/ius-release.rpm
$sudo yum -y install python36u.x86_64 python36u-pip.noarch python36u-devel.x86_64
2.Compile and Install of PL/Python3u
PosgreSQL 11 Source Code Download : https://www.postgresql.org/ftp/source/
1) Download postgresql source code
$wget https://ftp.postgresql.org/pub/source/v11.1/postgresql-11.1.tar.gz
$gzip -d posgresql-11.1.tar.gz
$tar xvf postgresql-11.1.tar
$cd postgresql-11.1
2) Compile and make
$yum install readline-devel zlib.devel
$./configure \--prefix=/usr/pgsql-11 \--with-python \--enable-nls=ko \PYTHON='/usr/bin/python3.6'
$make
3) plpython3.so and *.control file install
$cd src/pl/plpython
$sudo cp plpython3u.* /usr/pgsql-11/share/extension
$sudo cp plpython3.so /usr/pgsql-11/lib
4) In psql and pgAdmin4
CREATE LANGUAGE plpython3u;
[Installation of PL/Java (1.5.1-.rhel7) on CentOS 7]
1) Installation of OpenJDK and Pl/Java
$yum install java-1.8.0-openjdk-devel.x86_64
$ yum install
$ yum install pljava-11.x86_64
2) Setting in PostgreSQL for pl/java
$cd /var/lib/pgsql/11/data
$vi postgresql.conf
#Add the following lines for the pljava setting
pljava.classpath='/usr/pgsql-11/share/pljava/pljava-1.5.1.jar'
pljava.libjvm_location='/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/amd64/server/libjvm.so'
3) Restart of PostgreSQL
$systemctl restart postgresql-11.service
4) In psql or pgAdmin4
CREATE EXTENSION pljava;
[Perfect uninstall of PostgreSQL]
1) Removing pgAdmin4
$yum erase pgadmin4-desktop-gnome.noarch
2) Removing postgres* packages and directories
$yum erase postgres*
$rm-rf /var/lib/pgsql
$rm -rf /usr/pgsql-11
$rm -f /tmp/.s.PGSQL.5432*
[Installation of AnyDesk 4.0.1 for Remote Desktop]
$sudo wget https://download.anydesk.com/linux/rhel7/anydesk.x86_64 0:4.0.1-1.el7
$sudo yum localinstall anydesk-4.0.1-1.el7.x86_64.rpm