-1

I am trying to install postgreSQL

I open terminal and type the

gedit  /etc/apt/sources.list.d/pgdg.list

then in Gedit I enter this line

deb http://apt.postgresql.org/pub/repos/apt/ zesty-pgdg main

The when I try to save the file red colored text appears saying:

Could not save the file “/etc/apt/sources.list.d/pgdg.list”. you do not have the permission necessary to save the file. Please check that you typed the location correctly and try again

How do I solve this problem?

Zanna
  • 69,223
  • 56
  • 216
  • 327
  • Downvoting due to apparent lack of research. [How to install postgresql](https://help.ubuntu.com/community/PostgreSQL) properly is clearly documented. – user535733 Feb 27 '18 at 16:46

1 Answers1

1

You need to modify this file as root. From the terminal, type

sudo -H gedit /etc/apt/sources.list.d/pgdg.list

Then you can modify inside gedit and save it as you tried before

The sudo command means that you will run the command as root and it will ask you for your password

Félicien
  • 1,163
  • 1
  • 10
  • 18
  • thanks solve that problem further you tell me how to install postgresql – kashif naqvi Feb 27 '18 at 14:11
  • 1
    Don't use GUI applications with `sudo` (without additional parameters) this will change some file's permissions in the user's home directory, that will cause errors in the future. Use: `sudo -H`, or `sudo -i`, or `gksu` (`gksudo`). The best approach is to learn to work with some terminal based editor as `nano` - `sudo nano /path/to/file` is correct. To recover from previous wrong usage: `sudo chown $USER:USER $HOME`. – pa4080 Feb 27 '18 at 14:11
  • @kashif `sudo apt-get install postgresql` – Félicien Feb 27 '18 at 14:15
  • Installation completely continued but a error fond that – kashif naqvi Feb 27 '18 at 14:22