Skip to content

asdf plugin with prebuilt binaries of postgres

License

HandOfGod94/asdf-postgres-prebuilt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asdf-postgres-prebuilt

Postgresql plugin for asdf version manager, using prebuilt binaries.

Why prebuilt binaries?

Configuring from source is tedious and time consuming, esp. for few of my docker builds This is to fasten those things.

Dependencies

  • openssl
  • libreadline
  • zlib
  • curl
  • uuid
  • icu-devtools (linux) or icu4c (MacOS)

This assumes macOS, a Debian-flavored linux. If you need it to work on something else, you may need to modify the plugin. You'll need the dependencies referenced in the list above installed via whatever method you prefer. There are some suggestions below.

Note: This plugin has been tested only on macOS and Debian. Other operating systems have not been tested.

Install

  1. Add the plugin:

    asdf plugin add https://github.com/HandOfGod94/asdf-postgres-prebuilt.git
  2. In your project's .tool-versions file, add the desired Postgres version using this plugin name:

    postgres-prebuilt 17.4.0
    
  3. Install via asdf:

    asdf install

Mac

brew install gcc readline zlib curl ossp-uuid icu4c pkg-config

If you are on Apple silicon, you may need to set the HOMEBREW_PREFIX environment variable to /opt/homebrew. You can do this by putting export HOMEBREW_PREFIX=/opt/homebrew in your ~/.zshrc file. It isn't always required, but I don't know why this is required for some people. The same goes for intel machines only the prefix is /usr/local, which can also be dropped into your ~/.zshrc file export HOMEBREW_PREFIX=/usr/local.

If you are using pkgconfig, you may run into issues with linking, particularly with icu4c. Often they can be resolved by setting your PKG_CONFIG_PATH environment variable to reference where your linked libs live. For example:

brew install gcc readline zlib curl ossp-uuid icu4c pkg-config
export PKG_CONFIG_PATH="/opt/homebrew/bin/pkg-config:$(brew --prefix icu4c)/lib/pkgconfig:$(brew --prefix curl)/lib/pkgconfig:$(brew --prefix zlib)/lib/pkgconfig"

Ubuntu

sudo apt-get install linux-headers-$(uname -r) build-essential libssl-dev \
libreadline-dev zlib1g-dev libcurl4-openssl-dev uuid-dev icu-devtools libicu-dev

Ubuntu (WSL)

sudo apt-get install build-essential libssl-dev libreadline-dev zlib1g-dev \
libcurl4-openssl-dev uuid-dev icu-devtools libicu-dev

Fedora

sudo dnf install openssl-devel readline-devel zlib-devel libcurl-devel uuid-devel libuuid-devel

(open)SUSE

sudo zypper install -t pattern devel_basis
sudo zypper in openssl-devel readline-devel zlib-devel libcurl-devel uuid-devel libuuid-devel

Install

  1. Add the plugin:

    asdf plugin add https://github.com/HandOfGod94/asdf-postgres-prebuilt.git
  2. In your project's .tool-versions file, add the desired Postgres version using this plugin name:

    postgres-prebuilt 17.4.0
    
  3. Install via asdf:

    asdf install

Post-installation

To start a new database, you must provide a data directory when starting Postgres:

pg_ctl start -D /path/to/your/data

How to use (easier version)

Install

  1. Add the plugin:

    asdf plugin add https://github.com/HandOfGod94/asdf-postgres-prebuilt.git
  2. Create your .tool-versions file in the project that needs Postgres and add: postgres-prebuilt 17.4.0

  3. Run asdf install

Run

  1. Once it is done, run pg_ctl start -D /path/to/your/data
  2. Once that starts, run createdb default you can sub default with whatever you want your db name to be.
  3. Then log in with psql -d default if you didn't use default, make sure you use whatever you put in step 2.
  4. 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/data to 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.

Stop

  1. Just run pg_ctl stop if you moved your data directory, you have to do pg_ctl -D wherever/you/moved/it stop

Credits

Thanks to theseus-rs/postgresql-binaries for providing awesome PostgreSQL binaries.

About

asdf plugin with prebuilt binaries of postgres

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%