How to install PostgreSQL with pgvector on Ubuntu 22
Turn PostgreSQL in a vector database using the pgvector extension on Ubuntu 22.
Published by Mark van Eijk on December 2, 2023 · 1 minute read
- Install PostgreSQL
- Install pgvector
- Enable the pgvector extension
- Start PostgreSQL automatically (optional)
We assume you already have provisioned a Ubuntu 22.x server, ready to get going.
If you haven't already installed PostgreSQL on your server, execute these commands to install it from the official repository:
sudo apt install -y postgresql-common
When PostgreSQL (version 15) is installed, run the following command:
sudo apt install postgresql-15-pgvector
Enable the pgvector extension
The last step to turn PostgreSQL in a vector database, run the following query as the postgres user:
sudo -u postgres psql # run as postgres user
CREATE EXTENSION vector; # create the vector extension
Start PostgreSQL automatically (optional)
Configure PostgreSQL to start automatically after booting your server:
sudo systemctl enable postgresql
sudo service postgresql start
Subscribe to our newsletter
Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!