This story is a guild to install PostgresSQL from the binary.

Download specific PostgreSQL version:

wget https://ftp.postgresql.org/pub/source/v11.1/postgresql-11.1.tar.gz --no-check-certificate

Extract and install:

mkdir -p pg_src
tar xf postgresql-11.1.tar.gz --strip-components=1 -C pg_src
# create env folder
mkdir -p pg_env
cd pg_src
./configure --prefix=pg_env
make all -j4
make check
make install

Config environment:

cd pg_env
touch config.sh
# put this content to config.sh file:
export C_INCLUDE_PATH=<pth_to_env_folder>/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=<pth_to_env_folder>/include:$CPLUS_INCLUDE_PATH
export LD_LIBRARY_PATH=<pth_to_env_folder>/lib:$LD_LIBRARY_PATH
export PATH=<pg_env_path>/bin:$PATH

Initial data:

source pg_env/config.sh
mkdir -p pg_data
initdb -D pg_data

Start PostgreSQL:

pg_ctl -D pg_data start

--

--

Have ever you confusing when converting the timezone on python.

So, in this post, I will describe a simple way to understand and using timezone converting.

We have two steps to conversion DateTime from a timezone to another timezone.
1. Determined current timezone.

from datetime import datetime
fdate = datetime.now()

For the above code, the fdate variable will be assign timezone of local. I’m in Singapore fdate is in Singapore UTC+8.

To assign a DateTime to specify local timezone:

import pytz
us_moscow_time_zone = pytz.timezone('Europe/Moscow')
fdate = us_moscow_time_zone.localize(fdate)

Now, change the timezone of fdate

utc_time_zone = pytz.timezone('UTC')
fdate = fdate.astimezone(utc_time_zone)

--

--