← WindowsSELECT * FROM TheShiraverse · All Nukte
Get started › Setup › Windows › One-command install

Install PostgreSQL on Windows with one command

One PowerShell command installs everything you need for this course: PostgreSQL, pgAdmin 4, VS Code and Git. Then you check that it worked. Takes about 10 to 30 minutes, mostly waiting. No experience needed.

Jo video mein bola, yahan nukte mein likha hai.
What I said in the video, written here as key points.

▶ Watch on YouTube

Get started › Setup › Windows › One-command

One command.
Four tools.

PostgreSQL logo
PostgreSQLthe database engine
🖥️
pgAdmin 4see your data visually
📝
VS Codewrite your SQL files
🌿
Gitsave your work

Ek command, saara setup. One command sets up everything on your Windows PC.

This is the fast way to set up your laptop for the course. One script installs the four tools we use: PostgreSQL (the database engine, where your data lives), pgAdmin 4 (a visual manager to browse tables and run queries), VS Code (an editor for writing .sql files) and Git (version control for your work). It also creates an empty database called practice for your own tables.

Three things you need

Thoda sabr rakhna. Be patient. It takes about 20 to 30 minutes, mostly waiting.

You need a Windows 10 or 11 PC, an internet connection with room for roughly 700 MB of downloads (PostgreSQL is about 390 MB and VS Code about 215 MB), and permission to run PowerShell as administrator. The script uses winget (Windows Package Manager), which comes with Windows 11. On Windows 10, update "App Installer" from the Microsoft Store first. Plan for about 10 to 30 minutes depending on your internet speed, most of it waiting for downloads.

Step 1 · Download the installer

📄
install_windows.ps1from sql.theshiraverse.com/setup
↓
📁
Downloadskeep it there, we will run it from that folder

Pehle file utaaro. First, get the file onto your PC.

Download install_windows.ps1 and leave it in your Downloads folder. It is a plain text script, so you can open it in Notepad and read exactly what it does before running it. The installer file is also on the Setup page.

Step 2 · Open PowerShell as administrator

1
Click Startthe Windows button
2
Type "PowerShell"Windows PowerShell appears
3
Right-click itchoose Run as administrator
4
Click Yesthe window title says Administrator
Administrator: Windows PowerShell– □ ×
PS C:\WINDOWS\system32>

Admin ke bina install nahi hoga. Without admin, the install will stop.

Click Start, type PowerShell, right-click Windows PowerShell and choose Run as administrator, then click Yes. Check the window title says Administrator. If you skip this, the script stops straight away with "This script must be run as Administrator".

Step 3 · Type two lines

Administrator: Windows PowerShell– □ ×
PS> cd $HOME\Downloads PS> powershell -ExecutionPolicy Bypass -File .\install_windows.ps1
cd $HOME\DownloadsGo to the folder where the file is.
powershell -ExecutionPolicy Bypass -File ...Run the installer. "Bypass" lets this one run happen. Nothing is changed for good.

Bas do line. Just two lines. Press Enter after each one.

In the administrator PowerShell window, type these two lines, pressing Enter after each:

cd $HOME\Downloads
powershell -ExecutionPolicy Bypass -File .\install_windows.ps1

The first line moves into the Downloads folder. The second starts the installer. -ExecutionPolicy Bypass tells Windows to allow scripts for this one run only. Nothing is changed permanently, and Windows does not ask you any question.

What the script is doing

Let it finish. Wait until you see Installation Complete! And do not click inside the window.

Do not click inside the black window while it works. Clicking starts "selection mode" (the title bar then begins with the word Select), and that pauses the program. If it happens, press Esc.

While it runs, the script does these things in order: checks you are administrator, checks winget, installs PostgreSQL (with pgAdmin 4), adds PostgreSQL to your PATH, starts the database and waits for it, creates the postgres user and an empty practice database, then installs VS Code and Git. It always picks the newest version, in the build made for your PC (Intel/AMD or ARM). Anything you already have is skipped. Wait until you see "Installation Complete!" before you close the window.

Your connection details

Hostlocalhost
Port5432
Userpostgres
Passwordpostgres
Databasepractice

Yeh sirf practice ke liye hai. This simple password is for practice on your own laptop only. Never use it on a real server.

At the end the script prints these details. Save a screenshot of them.

The password postgres is fine for practice on your own laptop, and it is never exposed to the internet. Want your own? Before you run the script, type $env:PG_PASSWORD = "your-password" in the same window.

Close it. Open a new one.

Windows PowerShell– □ ×
PS> psql --version psql (PostgreSQL) <version> PS> git --version git version 2.x PS> code --version 1.x PS> psql -h localhost -U postgres -d practice Password for user postgres: WARNING: Console code page (437) differs from Windows code page (1252) practice=#

See practice=#? You are connected. Type \q to leave. Mubarak ho! Congratulations.

Close the PowerShell window and open a new one. This time a normal window is fine. A new window matters: PATH changes only show up in windows opened after the install.

psql --version
git --version
code --version
psql -h localhost -U postgres -d practice

The first three should print version numbers. The last one asks for your password (postgres unless you changed it) and then shows the prompt practice=#. That means you are connected to your own database. Type \q and press Enter to leave. You may see a WARNING about "Console code page". It is harmless. Ignore it. Then open pgAdmin 4 from the Start menu. Your server is already listed there. Click it and type the password postgres.

Six common problems

It stops moving, and the title says "Select"You clicked inside the window, and that pauses it. Press Esc and it carries on. Then do not click inside it again.
"running scripts is disabled"Use the one-line command: powershell -ExecutionPolicy Bypass -File .\install_windows.ps1
"must be run as Administrator"Close it and reopen PowerShell with Run as administrator.
"winget not found"Install App Installer from the Microsoft Store, then run again.
psql is not recognizedOpen a new PowerShell window. Still no? Restart the PC.
PostgreSQL did not startRun Get-Service postgresql-x64-* and check it says Running.

Still stuck? Tell me exactly what the screen says. Ghabrana nahi.

The common problems and their fixes:

  • It stops moving, and the window title starts with "Select": you clicked inside the window, which pauses it. Press Esc and it carries on. Do not click inside it again while it works.
  • "running scripts is disabled": use the one-line command powershell -ExecutionPolicy Bypass -File .\install_windows.ps1.
  • "This script must be run as Administrator": close the window and reopen PowerShell with Run as administrator.
  • "winget not found": install App Installer from the Microsoft Store, then run the script again.
  • psql is not recognized: open a new PowerShell window. If it still fails, restart the PC.
  • "PostgreSQL didn't accept connections": run Get-Service postgresql-x64-* and check the status says Running.

More fixes are on the Windows check page. If you are stuck, tell me exactly what the screen says in the comments or in the community.

Did you see practice=#?

Tell me in the comments. Milte hain agli video mein. Next: meet RetailMart, a quick overview of the database you will load.

sql.theshiraverse.com
→ / Space next   ← back   F fullscreen   H hide bars   N notes