I cannot install postgresql with homebrew.
$ brew install postgresql
Error: Could not create /usr/local/Cellar
Check you have permission to write to /usr/local
I am not sure if homebrew was installed well. If you need more information, I will update this.
I created /usr/local/Cellar by myself, then could install successfully.
I find that if I get this problem with brew I just fix the permissions on the /use/local folder:
sudo chown -R $(whoami):admin /usr/local
I was getting an error while installation that not able to link postgres and /usr/local/include is not writable
Below solution worked for me :-
First create the include folder, note that this requires sudo privileges
cd /usr/local
sudo mkdir include
sudo chown -R $(whoami) $(brew --prefix)/*
brew link postgresql
Related
In order to install Apache age from source,
i am installing development files for PostgreSQL server-side programming. For this i am using following command on my Ubuntu OS.
sudo apt install postgresql-server-dev-11
But i am getting this error "Unable to locate package postgresql-server-dev-11"
image of the error
i am searching online but did not find yet.It would be great if someone help.
This is because you do not have the correct Ubuntu version and the package does not exist.
To determine the major PostgreSQL version in a given release of Ubuntu find it here in Ubuntu Packages
18.04 has PostgreSQL 10 (postgresql-server-dev-10)
19.04 has PostgreSQL 11 (postgresql-server-dev-11)
20.04 has PostgreSQL 12 (postgresql-server-dev-12)
If you have ubuntu 19.04 you can follow this guide
In the case there is no maintainer for the Version of PostgreSQL you are trying to install you have to build from source.
Download your PostgreSQL version source code. Then run these commands.
tar xf postgresql-version.tar.bz2
cd postgresql-version
Install dependencies. Then run the following.
./configure
make
su
make install
adduser postgres
mkdir -p /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
Reference from Official Docs
Seems the package is not available from your package manager. But, since you want development files, it's best to get the source code directly from GitHub.
In your home directory do:
git clone https://github.com/postgres/postgres.git
cd postgres
git checkout "REL_11_STABLE"
then follow this guide https://www.thegeekstuff.com/2009/04/linux-postgresql-install-and-configure-from-source/
Official documentation for installing from source is here https://www.postgresql.org/docs/current/installation.html
You should follow these steps:
sudo apt-get update
sudo apt-get -y install postgresql-12 postgresql-client-12
sudo systemctl status postgresql
I was also facing the same problem and i just updated my Ubunutu and the error got resolved when i run the command again
I faced the same issue on Ubuntu jammy(22.04 LTS).
If you are on the same version of Ubuntu as me, try using
sudo apt install postgresql-server-dev-all
Because neither
sudo apt install postgresql-server-dev-12
nor
sudo apt install postgresql-server-dev-11
worked for me.
When installing PostgreSQL via Homebrew on Mac (OSX 10.11.6) I get the following errors:
Error: The `brew link` step did not complete successfully The formula
built, but is not symlinked into /usr/local
and
initdb: file "/usr/local/share/postgresql/postgres.bki" does not exist
This might mean you have a corrupted installation or identified the
wrong directory with the invocation option -L.
The /postgresql folder doesn't exist.
Not sure if it's relevant, but I already have OpenSSL 1.0.2o_2 and Readline 7.0.5 installed via Homebrew.
Does anyone know why this error occurs and how I can solve it?
In my case, I had installed libpq which prevented postgresql from linking. Unlinking libpq followed by linking postgresql fixed the issue for me.
brew unlink libpq
brew link postgresql
brew postinstall postgresql
Managed to solve the problem. It's a permissions issue. The original answer can be found here: Homebrew: Could not symlink, /usr/local/bin is not writable
In short, perform the following commands:
sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share
sudo chown -R `whoami`:admin /usr/local/opt
I followed the official guide to install mongodb but failed many times.
Firstly, I tried to use brew install mongodb
brew --version
Homebrew 1.4.3
brew install mongodb
Error:
Error: Permission denied # rb_sysopen - /usr/local/var/homebrew/locks/scons.formula.lock
I tried to use sudo
sudo brew install mongodb
Error:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
I am still trying to download the binaries and extracted through the tar command, but it is more complicated and I encountered many other problems. So I hope to solve this problem firstly... Any ideas? Thanks a lot.
sudo chown -R $USER:admin /usr/local
Update:
Whilst the above solves your issue just fine, there is a much nicer way.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew
# if you are using cask then allow admins to manager cask install too
chgrp -R admin /opt/homebrew-cask
chmod -R g+w /opt/homebrew-cask
source: https://gist.github.com/jaibeee/9a4ea6aa9d428bc77925
I got stuck in a bit of a loop with permissions issues. I eventually uninstalled and reinstalled Homebrew and it worked for me. Here's a reference: https://github.com/Homebrew/install
I can only find installations for the latest stable version. Can someone provide me steps to install an older version of pg?
Thanks
Sithara
I've installed Postgresql 8.4 on Ubuntu 16.4 using the following:
#Requirements
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install libreadline6 libreadline6-dev
sudo apt-get install zlib1g-dev
sudo apt-get install bison
#Download postgres
wget https://ftp.postgresql.org/pub/source/v8.4.22/postgresql-8.4.22.tar.gz
tar xfz postgresql-8.4.22.tar.gz
cd postgresql-8.4.22
#Installation
./configure
make
su
make install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
Look for documentation in order to install other version, in this case I've checked:
https://www.postgresql.org/docs/8.4/static/install-short.html
One of possible ways is to install the required version of PostgreSQL from sources. Go to https://www.postgresql.org/ftp/source/. Download the required sources. And follow the instructions here
https://www.postgresql.org/docs/current/static/installation.html
It shouldn't be difficult.
Probably you should consider running sudo checkinstall instead of make install in order to be able to uninstall the package in a clean way. Package 'checkinstall' must be installed separately.
I tried to install postgresql using the following command
apt-get install -t squeeze-backports postgresql-9.1 postgresql-client-9.1 postgresql-contrib-9.1
but i got the following error message.
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
how to fix this?
It looks to me like you aren't running the command as root. Prefix it with "sudo".
sudo apt-get install -t squeeze-backports postgresql-9.1 postgresql-client-9.1 postgresql-contrib-9.1
per the error message:
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
However, it looks like you don't understand the command, as you're running Ubuntu and Squeeze is a Debian dist. I think you need to go back to the basics and read the instructions:
Ubuntu help for Pg.
PostgreSQL-supplied packages of newer versions
Some other program has a lock on download operations. Have you got another terminal open or synaptic package manager or anything? Close everything and try again. You can also delete this file /var/lib/dpkg/lock if that doesnt work. Or it might be a root access issue. try running with sudo
Simple steps to install postgresql latest version (Believe me -- try these commends to install postgresql..it will works perfectly )
sudo bash -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/
precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-9.3 pgadmin3
For Open Terminal of postgres
sudo -u postgres psql postgres