Installing PostgreSQL as non-root by Extracting the binaries from RPMs

Started by Thiagarajan Lakshminarayananalmost 8 years ago5 messagesgeneral
Jump to latest
#1Thiagarajan Lakshminarayanan
thiagu1997@gmail.com

Hello,

In our environment, our standard RHEL OS install comes with all the
PostgreSQL required packages / libraries installed. So, can I just extract
the binaries from PostgreSQL RPMs via rpm2cpio and create a tar file and
install it as non-root user in an alternate location? I tested the above
approach, created a new PostgreSQL instance and it is working fine. Please
let me know if there would be any issues with the above approach?

Thanks
Raj

#2Benjamin Scherrey
scherrey@proteus-tech.com
In reply to: Thiagarajan Lakshminarayanan (#1)
Re: Installing PostgreSQL as non-root by Extracting the binaries from RPMs

You know this is something super easy to do if you do it within Docker.
Advise you to go ahead and map the data directories to the host file system
rather than use a storage container until you get a lot more experience
with Docker. Otherwise it's crazy easy and, in fact, there already exist
Docker images with Postgres installed that you could just download and use.
Postgres will be entirely under local user control and requires no system
level access.

-- Ben

On Mon, May 21, 2018 at 9:23 PM, Thiagarajan Lakshminarayanan <
thiagu1997@gmail.com> wrote:

Show quoted text

Hello,

In our environment, our standard RHEL OS install comes with all the
PostgreSQL required packages / libraries installed. So, can I just extract
the binaries from PostgreSQL RPMs via rpm2cpio and create a tar file and
install it as non-root user in an alternate location? I tested the above
approach, created a new PostgreSQL instance and it is working fine. Please
let me know if there would be any issues with the above approach?

Thanks
Raj

#3Thiagarajan Lakshminarayanan
thiagu1997@gmail.com
In reply to: Benjamin Scherrey (#2)
Re: Installing PostgreSQL as non-root by Extracting the binaries from RPMs

Thanks Benjamin. Actually, we don't use Docker in our environment. We just
use a standard RHEL OS install. Will there be any issues if I install
PostgreSQL by extracting the RPM binaries?

Please let me know.

Thanks
Raj

On Mon, May 21, 2018 at 10:15 AM, Benjamin Scherrey <
scherrey@proteus-tech.com> wrote:

Show quoted text

You know this is something super easy to do if you do it within Docker.
Advise you to go ahead and map the data directories to the host file system
rather than use a storage container until you get a lot more experience
with Docker. Otherwise it's crazy easy and, in fact, there already exist
Docker images with Postgres installed that you could just download and use.
Postgres will be entirely under local user control and requires no system
level access.

-- Ben

On Mon, May 21, 2018 at 9:23 PM, Thiagarajan Lakshminarayanan <
thiagu1997@gmail.com> wrote:

Hello,

In our environment, our standard RHEL OS install comes with all the
PostgreSQL required packages / libraries installed. So, can I just extract
the binaries from PostgreSQL RPMs via rpm2cpio and create a tar file and
install it as non-root user in an alternate location? I tested the above
approach, created a new PostgreSQL instance and it is working fine. Please
let me know if there would be any issues with the above approach?

Thanks
Raj

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Thiagarajan Lakshminarayanan (#3)
Re: Installing PostgreSQL as non-root by Extracting the binaries from RPMs

Thiagarajan Lakshminarayanan <thiagu1997@gmail.com> writes:

Thanks Benjamin. Actually, we don't use Docker in our environment. We just
use a standard RHEL OS install. Will there be any issues if I install
PostgreSQL by extracting the RPM binaries?

What exactly is your purpose here? Is it just that you want to run a
separate data directory somewhere? You don't need a separate set of
binaries for that, just point PGDATA to where you want it and run the
server as the owner of that data directory.

(Depending on the details, you might need to teach SELinux to allow
this usage. I don't remember exactly what cues SELinux to treat a
particular process as being subject to its restrictions, but use of
the system binaries is at least part of it.)

If you want to be able to build and run a server without any root
privileges at all, you might be best off just building from source.
Maybe I'm too used to doing that, but I'm not very clear on what
you gain by extracting the result of somebody else's build -- which,
almost by definition, is not exactly what you want.

regards, tom lane

#5Alvaro Aguayo Garcia-Rada
aaguayo@opensysperu.com
In reply to: Thiagarajan Lakshminarayanan (#1)
Re: Installing PostgreSQL as non-root by Extracting the binaries from RPMs

Should work with no problem, but I would not recommend it. You may not be able to setup a service(SysV or systemd) to automatically start postgres, and updating version could be troublesome.

Regards,

Alvaro Aguayo
Operations Manager
Open Comb Systems E.I.R.L.

Office: (+51-1) 3377813 | Mobile: (+51) 995540103 | (+51) 954183248
Web: www.ocs.pe

----- Original Message -----
From: "Thiagarajan Lakshminarayanan" <thiagu1997@gmail.com>
To: pgsql-general@lists.postgresql.org
Sent: Monday, 21 May, 2018 09:23:28
Subject: Installing PostgreSQL as non-root by Extracting the binaries from RPMs

Hello,

In our environment, our standard RHEL OS install comes with all the
PostgreSQL required packages / libraries installed. So, can I just extract
the binaries from PostgreSQL RPMs via rpm2cpio and create a tar file and
install it as non-root user in an alternate location? I tested the above
approach, created a new PostgreSQL instance and it is working fine. Please
let me know if there would be any issues with the above approach?

Thanks
Raj