> For the complete documentation index, see [llms.txt](https://docs.tibero.com/tmaxopensql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tibero.com/tmaxopensql/installation/binary/opensql-database.md).

# OpenSQL 데이터베이스

OpenSQL 설치를 위한 기본환경 설정 및 PostgreSQL 설치 과정을 안내합니다.

## 개요

OpenSQL은 PostgreSQL 기반의 데이터베이스 패키지로 본 매뉴얼은 OpenSQL 설치를 위한 기본환경 설정 및 PostgreSQL 설치 과정을 안내합니다.

***

## 설치

### 1. OPENSQL 유저 생성

OpenSQL 바이너리 압축을 해제하면 scripts 디렉토리 안에 `setenv.sh` , `install.sh` 등 OpenSQL 설치를 위한 스크립트가 포함되어 있습니다.

`opensql` 유저가 생성되며 해당 유저로 전환됩니다.

```
./create_user.sh <password>
```

### 2. OPENSQL\_HOME 환경 변수 설정

OpenSQL이 설치될 위치를 환경 변수 `OPENSQL_HOME` 로 설정합니다.

```
export OPENSQL_HOME="path/to/install"
export PG_HOME="path/to/pg"
export PG_DATA_DIR="path/to/pg_data"
```

### 3. OPENSQL\_INSTALL\_HOME 디렉토리 설정

OPENSQL 환경 변수를 bashrc에 설정하고, OPENSQL을 설치하는데 필요한 디렉터리 위치를 설정합니다.

OPENSQL\_HOME 이 설정되어 있지 않다면 수행이 실패합니다.

```
. ./setenv.sh `pwd`
OPENSQL_INSTALL_HOME is set to: /home/opensql3.0-rockylinux9.4-pg16.8
```

### 4. Postgresql 설치

PostgreSQL을 설치하고 binary 파일을 PATH에 등록합니다. 그리고 PGDATA 환경변수를 $OPENSQL\_HOME/data로 설정합니다.

<pre><code><strong>sudo -E ./install.sh postgresql
</strong></code></pre>

### 5. Postgresql 설치여부 확인

설치를 완료하면 아래의 명령어로 postgresql 의 설치 경로와 설치 버전을 확인할 수 있습니다.

```
$ $PG_HOME/bin/pg_config 
BINDIR = /usr/pgsql-16/bin
DOCDIR = /usr/pgsql-16/doc
HTMLDIR = /usr/pgsql-16/doc/html
INCLUDEDIR = /usr/pgsql-16/include
PKGINCLUDEDIR = /usr/pgsql-16/include
INCLUDEDIR-SERVER = /usr/pgsql-16/include/server
LIBDIR = /usr/pgsql-16/lib
PKGLIBDIR = /usr/pgsql-16/lib
LOCALEDIR = /usr/pgsql-16/share/locale
MANDIR = /usr/pgsql-16/share/man
SHAREDIR = /usr/pgsql-16/share
SYSCONFDIR = /etc/sysconfig/pgsql
PGXS = /usr/pgsql-16/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE =  '--enable-rpath' '--prefix=/usr/pgsql-16' '--includedir=/usr/pgsql-16/include' '--mandir=/usr/pgsql-16/share/man' '--datadir=/usr/pgsql-16/share' '--libdir=/usr/pgsql-16/lib' '--with-lz4' '--with-zstd' '--enable-tap-tests' '--with-icu' '--with-llvm' '--with-perl' '--with-python' '--with-tcl' '--with-tclconfig=/usr/lib64' '--with-openssl' '--with-pam' '--with-gssapi' '--with-includes=/usr/include' '--with-libraries=/usr/lib64' '--enable-nls' '--enable-dtrace' '--with-uuid=e2fs' '--with-libxml' '--with-libxslt' '--with-ldap' '--with-selinux' '--with-systemd' '--with-system-tzdata=/usr/share/zoneinfo' '--sysconfdir=/etc/sysconfig/pgsql' '--docdir=/usr/pgsql-16/doc' '--htmldir=/usr/pgsql-16/doc/html' 'CFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' 'LDFLAGS=-Wl,--as-needed' 'LLVM_CONFIG=/usr/bin/llvm-config-64' 'CLANG=/usr/bin/clang' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
CFLAGS_SL = -fPIC
LDFLAGS = -Wl,--as-needed -L/usr/lib64 -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-16/lib',--enable-new-dtags
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgcommon -lpgport -lselinux -lzstd -llz4 -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm 
VERSION = PostgreSQL 16.8
```

###
