To save file and close nano editor press CTRL+X than SHIFT+Y than ENTER
Required OS: ubuntu 22.04+
Recommended OS: ubuntu 22.04 LTS
Required Software:
sudo apt update
sudo apt upgrade# https://www.postgresql.org/download/linux/ubuntu/
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresqlsudo passwd postgres
sudo -i -u postgres# not superuser, you will be asked to type "veilusr" password
createuser --interactive -e veilusr -D -P -R
createdb veilexplorer -O veilusr -E UTF8su [your_user]sudo nano /etc/postgresql/13/main/postgresql.confyou can tweak configuration by using pgtune: https://pgtune.leopard.in.ua/#/
sudo nano /etc/postgresql/13/main/pg_hba.confAdd this content to opened file:
local veilexplorer veilusr md5
sudo service postgresql restartSQL scripts located at /explorer-backend/schemas directory. Upload this sql scripts to postgres user root: /var/lib/postgresql
sudo -i -u postgres
cd ~
# after each psql call you will be asked to type "veilusr" password
psql -h localhost -U veilusr -d veilexplorer -f "1. blocks.sql"
psql -h localhost -U veilusr -d veilexplorer -f "2. transactions.sql"
psql -h localhost -U veilusr -d veilexplorer -f "3. rawtxs.sql"
# if there other SQL files under /explorer-backend/schemas, they should be imported same way as shown above
...Done, now database is ready.