To import a database from another PostgreSQL database into a Docker PostgreSQL container, you can use the pg_dump and psql tools. Here’s a step-by-step guide to achieve this: Step 1: Export the Database from the Source PostgreSQL On the source PostgreSQL server, use the pg_dump tool to create a dump file of the database you […]
Author: admin
Install django+openlayer+postgres+postgis in docker
Below is a step-by-step guide to install and dockerize Django with OpenLayer, PostgreSQL, PostGIS, and the specified Python libraries on Ubuntu 22.04. This guide includes all the necessary Dockerfiles, scripts, and requirements files to help you set up the environment. Step 1: Install Docker and Docker Compose First, ensure that Docker and Docker Compose are […]
Django Test Framework
Django’s built-in test framework is a powerful tool that allows you to write and run tests for your Django applications. Below is a simple example and step-by-step guide to using it. Step 1: Set Up Your Django Project If you haven’t already, start by setting up a Django project. django-admin startproject myproject cd myproject python […]
Install node 20
Step 1: Update the System First, make sure your system is up-to-date: sudo apt update sudo apt upgrade -y Step 2: Add the NodeSource Repository for Node.js 20 Use the NodeSource setup script to add the repository for Node.js 20: (before running following command check it the /etc/apt/sources.list.d does exits) curl -fsSL https://deb.nodesource.com/setup_20.x | sudo […]
Install Postgres
Automated repository configuration: sudo apt install -y postgresql-common sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh Step 1: Update the Package List sudo apt update Step 2: Install PostgreSQL sudo apt install -y postgresql postgresql-contrib Step 3: Install PostGIS sudo apt install -y postgis postgresql-16-postgis-3 replace the 16 with version i have installed to check the version psql –version Step 4: […]
Sample script file
#!/bin/bash echo "Hello, World!" ls -l
Shared directory
Summary Create the Folder: sudo mkdir /path/to/your/folder Create Users and Set Passwords: sudo adduser user1 sudo adduser user2 sudo adduser user3 Create a Group: sudo groupadd mygroup Add Users to the Group: sudo usermod -aG mygroup user1 sudo usermod -aG mygroup user2 sudo usermod -aG mygroup user3 Change Group Ownership of the Folder: sudo chown […]
Basic Git
Configure your Git username and email: git config –global user.name "Your Name" git config –global user.email "youremail@example.com" Initialize Repository: git init Add Files to Staging: git add . Commit Changes: git commit -m "Initial commit" Create a Branch: git checkout -b new-feature Switch Branches: git checkout main Merge Branches: git merge new-feature Configuring .gitignore Create […]
psql commands
Connect remote PostgreSQL psql -U admin -h 192.168.1.5 -p 2506 -d mydatabae List all databases psql -l List users SELECT rolname FROM pg_roles; Show current database SELECT current_database(); Show all tables in database \dt database List databases \l Connect to database “` \c <database_name> Show current database SELECT current_database(); Create database CREATE DATABASE <database_name> WITH […]
Create User & Database
sudo mysql -u root -p CREATE DATABASE my_database; CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'secure_password'; GRANT ALL PRIVILEGES ON my_database.* TO 'my_user'@'localhost'; FLUSH PRIVILEGES; EXIT;