2. Installation of TimescaleDB on FreeBSD 11.2 - tanalam2411/freebsd GitHub Wiki
Installation of TimescaleDB on FreeBSD 11.2 steps
Reference -
https://github.com/timescale/timescaledb#building-from-source-unix-based-systems
- Install cmake (3.4+)
root@:~ # pkg install cmake
root@:~ # cmake --version
cmake version 3.12.2
- Install gcc
root@:~ # pkg install lang/gcc
/*
Message from gcc7-7.3.0_5:
To ensure binaries built with this toolchain find appropriate versions
of the necessary run-time libraries, you may want to link using
-Wl,-rpath=/usr/local/lib/gcc7
For ports leveraging USE_GCC, USES=compiler, or USES=fortran this happens
transparently.
*/
root@:~ # gcc --version
gcc (FreeBSD Ports Collection) 7.3.0
- Installing PostgresSql - https://www.youtube.com/watch?v=lIWEB9r4KbM
root@:~ # freebsd-update fetch
root@:~ # freebsd-update install
root@:~ # pkg search postgresql10
pgtcl-postgresql10-2.1.1 TCL extension for accessing a PostgreSQL server (PGTCL-NG)
postgresql10-client-10.5 PostgreSQL database (client)
postgresql10-contrib-10.5 The contrib utilities from the PostgreSQL distribution
postgresql10-docs-10.5 The PostgreSQL documentation set
postgresql10-plperl-10.5 Write SQL functions for PostgreSQL using Perl5
postgresql10-plpython-10.5 Module for using Python to write SQL functions
postgresql10-pltcl-10.5 Module for using Tcl to write SQL functions
postgresql10-server-10.5 PostgreSQL is the most advanced open-source database available anywhere
root@:~ # pkg install postgresql10-server-10.5
root@:~ # sysrc postgresql_enable="YES"
# check file /etc/rc.conf should have entry sysrc postgresql_enable="YES"
root@:~ # service postgresql initdb
root@:~ # /usr/libexec/locate.updatedb
root@:~ # locate postgresql.conf
/usr/local/share/postgresql/postgresql.conf.sample
/usr/ports/databases/postgresql10-server/files/patch-src_backend_utils_misc_postgresql.conf.sample
/usr/ports/databases/postgresql93-server/files/patch-src_backend_utils_misc_postgresql.conf.sample
/usr/ports/databases/postgresql94-server/files/patch-src_backend_utils_misc_postgresql.conf.sample
/usr/ports/databases/postgresql95-server/files/patch-src_backend_utils_misc_postgresql.conf.sample
/usr/ports/databases/postgresql96-server/files/patch-src_backend_utils_misc_postgresql.conf.sample
/var/db/postgres/data10/postgresql.conf
root@:~ # vi /var/db/postgres/data10/postgresql.conf
changes
--------------
listen_addresses = '*'
port = 5432
---------------
root@:~ # service postgresql start
2018-11-17 00:46:15.800 IST [3949] LOG: listening on IPv6 address "::", port 5432
2018-11-17 00:46:15.800 IST [3949] LOG: listening on IPv4 address "0.0.0.0", port 5432
2018-11-17 00:46:15.802 IST [3949] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2018-11-17 00:46:15.851 IST [3949] LOG: ending log output to stderr
2018-11-17 00:46:15.851 IST [3949] HINT: Future log output will go to log destination "syslog".
root@:~ # su postgres
$ createuser -sdrP admin
Enter password for new role:
Enter it again:
/*
Created 'admin' user with password 'admin123'
*/
- Installing TimescaleDB
root@:~ # mkdir -p performance/timescaledb
root@:~ # cd performance/timescaledb/
root@:~/performance/timescaledb # pkg install git
root@:~/performance/timescaledb # git clone https://github.com/timescale/timescaledb.git
root@:~/performance/timescaledb # cd timescaledb
root@:~/performance/timescaledb/timescaledb # git checkout 1.0.0
root@:~/performance/timescaledb/timescaledb # pkg install bash
root@:~/performance/timescaledb/timescaledb # where bash
/usr/local/bin/bash
[root@ ~/performance/timescaledb/timescaledb]# bash ./bootstrap
[root@ ~/performance/timescaledb/timescaledb]# cd build && make
[root@ ~/performance/timescaledb/timescaledb/build]# make install
[root@ ~/performance/timescaledb/timescaledb/build]# su postgres
$ psql -d postgres -c "SHOW config_file;"
config_file
-----------------------------------------
/var/db/postgres/data10/postgresql.conf
(1 row)
$ exit
[root@ ~/performance/timescaledb/timescaledb/build]# vi /var/db/postgres/data10/postgresql.conf
Change from -> #shared_preload_libraries = ''
to -> shared_preload_libraries = 'timescaledb'
[root@ ~/performance/timescaledb/timescaledb/build]# service postgresql restart
- TimescaleDB setup
[root@ ~/performance/timescaledb/timescaledb/build]# psql -U postgres -h localhost
psql (10.5)
Type "help" for help.
postgres=# CREATE database testdb;
CREATE DATABASE
postgres=# \c testdb
You are now connected to database "testdb" as user "postgres".
testdb=# CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
WARNING:
WELCOME TO
_____ _ _ ____________
|_ _(_) | | | _ \ ___ \
| | _ _ __ ___ ___ ___ ___ __ _| | ___| | | | |_/ /
| | | | _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \
| | | | | | | | | __/\__ \ (_| (_| | | __/ |/ /| |_/ /
|_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
Running version 1.0.0
For more information on TimescaleDB, please visit the following links:
1. Getting started: https://docs.timescale.com/getting-started
2. API reference documentation: https://docs.timescale.com/api
3. How TimescaleDB is designed: https://docs.timescale.com/introduction/architecture
Note: TimescaleDB collects anonymous reports to better understand and assist our users.
For more information and how to disable, please see our docs https://docs.timescaledb.com/using-timescaledb/telemetry.
CREATE EXTENSION
testdb=#
testdb=# \q
[root@ ~/performance/timescaledb/timescaledb/build]# psql -U postgres -h localhost -d testdb
psql (10.5)
Type "help" for help.
testdb=#
- Updating Postgresql for remote connection https://dba.stackexchange.com/a/175399/121118
[root@ ~/performance/timescaledb/timescaledb/build]# vi /var/db/postgres/data10/pg_hba.conf
# IPv4 local connections:
#host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 trust
[root@ ~/performance/timescaledb/timescaledb/build]# service postgresql restart