Postgresql plugin for asdf version manager
This assumes macOS or a debian flavored linux. If you need it to work on something else, you'll likely need to modify the plugin.
- You will need a compiler.
- Hit the ok button and it will install. If it already has it, then you are good.
- You will need a comppiler.
sudo apt install linux-headers-$(uname -r) build-essential
- You will need libreadline
sudo apt-get install libreadline-dev
- On Ubuntu 19.04+, you will need curl and zlib
sudo apt-get install zlib1g-dev curl
asdf plugin-add postgres
Check asdf readme for instructions on how to install & manage versions of Postgres.
When installing Postgres using
asdf install, you can pass custom configure options with the following env vars:
POSTGRES_CONFIGURE_OPTIONS- use only your configure options
POSTGRES_EXTRA_CONFIGURE_OPTIONS- append these configure options along with ones that this plugin already uses
These options can be passed at runtime, or set in
~/.asdf-postgres-configure-options. This file will be sourced at
asdf install time if it exists.
For example, if you want to compile with a specific set of openssl libraries, you might do something like
POSTGRES_EXTRA_CONFIGURE_OPTIONS="--with-uuid=e2fs --with-openssl --with-libraries=/usr/local/lib:/firstname.lastname@example.org/lib --with-includes=/usr/local/include:/email@example.com/include" asdf install postgres
How to use (easier version)
- Create your .tool-versions file in the project that needs postgres and add
postgres 9.4.7or whatever version that you want.
- Once it is done, run
- Once that starts, run
createdb defaultyou can sub
defaultwith whatever you want your db name to be.
- Then log in with
psql -d defaultif you didn't use default, make sure you use whatever you put in step 2.
- If you need to move your data file around, move data from your install directory, which will look something like this:
~/.asdf/installs/postgres/9.4.7/datato wherever you want it. Once it is moved, start your db with
pg_ctl -D wherever/you/moved/it start. Your postgresql.conf file is in that directory if you need to change the port or anything.
- Just run
pg_ctl stopif you moved your data directory, you have to do
pg_ctl -D wherever/you/moved/it stop