Skip to main content

Setting Up Apache AGE, PostgreSQL, Docker, and pgAdmin on Ubuntu 22.04: A Step-by-Step Guide

Setting Up Apache AGE, PostgreSQL, Docker, and pgAdmin on Ubuntu 22.04: A Step-by-Step Guide

If you’re struggling to set up Apache AGE with PostgreSQL, Docker, and pgAdmin on Ubuntu 22.04, trust me — I’ve been there. It can be frustrating, but this guide will walk you through the process step by step.

Before starting, make sure you have installed the following tools:

1. Prerequisites

Before we dive in, make sure you have Docker installed on your Ubuntu system. If not, follow these steps to install it:

  • Update your package index:
    sudo apt update

  • Install required packages:
    sudo apt install ca-certificates curl

  • Add Docker's official GPG key:
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
    sudo chmod a+r /etc/apt/keyrings/docker.asc

  • Add the Docker repository:
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

  • Update the package index again:
    sudo apt update

  • Install Docker:
    sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

  • Add your user to the Docker group (to run Docker without sudo):
    sudo usermod -aG docker $USER
    Log out and log back in for this to take effect.

2. Verify Docker Installation

Open a terminal and run the following command to check if Docker is working:

docker ps

If Docker is installed correctly, this command will display running containers. Some useful Docker commands:

docker ps -a # List all containers, running or stopped
docker stop cont # Stop the running container
docker start cont # Restart a stopped container
docker rm cont # Remove a container
docker logs cont # View logs of the container
docker exec -it cont psql -U age -d age

Connect to PostgreSQL inside the container

3. Download the Apache AGE Image from Docker Hub

Run the following command to pull the Apache AGE image:

docker pull apache/age

After downloading, verify the creation of the image with:

docker images

You should see the apache/age image in the list of available images.

4. Create a docker-compose.yml File

To facilitate container management, create a docker-compose.yml file with the following configuration:

version: '3.7'

services:
  age:
    container_name: cont
    image: apache/age
    restart: always
    environment:
      POSTGRES_USER: age
      POSTGRES_PASSWORD: age
      POSTGRES_DB: age
    ports:
      - "5432:5432"
    networks:
      - my_network

  pgadmin:
    container_name: pgadmin
    image: dpage/pgadmin4
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@admin.com
      PGADMIN_DEFAULT_PASSWORD: admin
    ports:
      - "5050:80"
    networks:
      - my_network

networks:
  my_network:
    driver: bridge

(Note: On Ubuntu with newer Docker versions, you can use docker compose instead of docker-compose. If you installed via the plugin, use docker compose for commands.)

5. Start the Containers

In the terminal, navigate to the folder where docker-compose.yml is located and run:

docker compose up -d

This starts PostgreSQL with the Apache AGE extension and also sets up pgAdmin.

6. Access the Apache AGE Container via Terminal

If you want to interact with PostgreSQL and Apache AGE via the terminal, use the following command:

docker exec -it cont bash

Then, access PostgreSQL inside the container:

psql -U age -d age

7. Connecting to Apache AGE via pgAdmin

Open your browser and go to:
http://localhost:5050

Login using:
Email: admin@admin.com
Password: admin

8. Register the PostgreSQL Server in pgAdmin

Inside pgAdmin, go to “Servers” > “Register” > “Server”

In the General tab:
Name: Apache AGE

In the Connection tab:
Host name/address: age (use the service name from docker-compose)
Port: 5432
Maintenance Database: age
Username: age
Password: age

Click Save.

Now, you should be connected to Apache AGE via pgAdmin inside Docker. 🎉

Conclusion

You now have a fully functional environment for working with Apache AGE on PostgreSQL using Docker and pgAdmin on Ubuntu 22.04. You can start executing graph queries and exploring this powerful graph database extension.

If you found this guide helpful, share it with others who might be struggling with the setup! 🚀

Popular posts from this blog

Nền tảng Dữ Liệu Khách Hàng (Customer Data Platforms - CDP) là gì? - Một cách giải thích đơn giản Ngày nay, Thu nhập dữ liệu khách hàng là một trong những hoạt động “sót còn” để phát triển doanh nghiệp. Do đó, để giúp doanh nghiệp giải đáp bài toán phức tạp liên quan đến vấn đề này, một giải pháp mới được hình thành: Nền tảng dữ liệu khách hàng (Customer Data Platform - CDP). Vậy chính xác nền tảng dữ liệu khách hàng (CDP) là gì? Không cần sử dụng các biệt ngữ phần mềm và thuật ngữ kỹ thuật, chúng ta có thể hiểu đơn giản Nền tảng Dữ Liệu Khách Hàng như sau: 1, Nền Tảng Dữ Liệu Khách Hàng (CDP) là gì? “ A Customer Data Platform is a packaged software that consolidates customer data from multiple sources and creates a persistent, unified and real-time customer database easily accessible by other systems. ” Có thể dịch đơn giản như sau: “Nền Tảng Dữ Liệu Khách Hàng (CDP) là một loại phần mềm tạo ra một cơ sở dữ liệu khách hàng liên tục, thống nhất, bền vững có thể truy cập được từ các hệ...
Các trường đại học thường gặp khó khăn trong việc hiểu và kết nối với các bên liên quan đa dạng của mình. Do hệ thống dữ liệu bị phân mảnh, các tổ chức giáo dục đại học gặp khó khăn trong việc đạt được cái nhìn thống nhất về sinh viên, cựu sinh viên và nhà tài trợ. Điều này dẫn đến các nỗ lực tiếp cận không nhất quán và bỏ lỡ các cơ hội tham gia. Một giải pháp hiệu quả cho những vấn đề này có thể đạt được bằng cách triển khai Nền tảng dữ liệu khách hàng (CDP). CDP có thể thống nhất và sắp xếp dữ liệu từ các hệ thống tuyển sinh, cơ sở dữ liệu CRM và tương tác trực tuyến để cung cấp cái nhìn toàn diện về các bên liên quan. Điều này cho phép các trường đại học cung cấp trải nghiệm kỹ thuật số được cá nhân hóa và thúc đẩy kết quả tích cực. CDP là gì? Nền tảng dữ liệu khách hàng (CDP) là giải pháp công nghệ cho phép các tổ chức thu thập, hợp nhất và giám sát dữ liệu khách hàng từ nhiều nguồn, bao gồm các lượt truy cập trang web, tương tác qua email và phương tiện truyền thông xã hội. Sau đó...
Leo CDP System Architecture  Server requirements must have Internet and have the installed Linux operating system  If you have from 100,000 to 1 million profiles Need 5 servers: 1) Data Observer: 2 servers (4 CPUs, 8 GB RAM, 20 GB SSD disk) 2) Database: 1 server (8 CPUs, 16 GB RAM, 500 GB SSD disk) 3) Data Processor: 1 server (4 CPUs, 8 GB RAM, 120 GB SSD disk) 4) Admin Dashboard: 1 server (4 CPUs, 8 GB RAM, 40 GB SSD disk) If you have from  1 million to 2 million profiles Need  10 servers: 1) Data Observer: 4 servers (4 CPUs, 8 GB RAM, 20 GB SSD disk) 2) Database: 2 servers (8 CPUs, 16 GB RAM, 500 GB SSD disk) 3) Data Processor: 2 servers (4 CPUs, 8 GB RAM, 120 GB SSD disk) 4) Admin Dashboard: 2 servers (4 CPUs, 8 GB RAM, 40 GB SSD disk) F.A.Q. in Vietnamese: 1. LEO CDP có giá bao nhiêu, mua như thế nào ? Miễn phí  cho mọi mục đích Ghi chú: 1. Profile là một data record các thông tin cá nhân và dữ liệu hành vi của khách hàng Định danh một profile bằng email hoặ...