pg_ctl allows for a -D
option which allows you to point at your data wherever it is.
I do this all the time for development environments and fun things like setting up intracomputer replication environments for testing. It works fine.
The one thing you really need to be careful about is the configuration. After unzipping you should probably edit the postgresql.conf
appropriately.
Dunno if it was true when you wrote your question, but the puppetlabs/postgresql
module does some pretty clever stuff with versions that are not standard for your OS distro, including installing the required repository.
Snippets from my config:
In one of my puppet classes I call:
class { 'postgresql::globals':
encoding => hiera('postgresql::globals::encoding', 'UTF8'),
locale => hiera('postgresql::globals::locale', 'C'),
manage_package_repo => hiera('postgresql::globals::manage_package_repo', false),
version => hiera('postgresql::globals::version', undef),
notify => Class['postgresql::server', 'postgresql::client'],
}
and in my hiera config data I have:
postgresql::globals::version: "9.3"
postgresql::globals::manage_package_repo: true
Using hiera like this is optional of course, but it gives you a nice way to use different versions on different hosts. On later versions of puppet (at least 3.x) you can override postgresql::globals variables without needing that to be part of how you call the package.
You won't need to do stuff from source here, but if you did, I'd recommend that you should build your own package rather than try to automate the build process through puppet. Avoid it as far as possible though, since it sets you up to do ongoing maintenance of that package.
Best Answer
If you install from apt-get you will be able to use apt-get upgrade option later and other apt-get build in options (available from Ubuntu). Furthermore apt-get installs binaries and manages their versions. You just install and nothing more.
Installing from source gives you the ability to do a more detailed installation. (You can customize the build and installation process with command line options connected to
./configure
PARAMETERS LIST.) It's useful if you need a feature that can be enabled only by compiling the package yourself. Next thing is that installation from source may not be visible to apt-get commands so you may not be able to use them.But if you need to install Postgres stable version without any specialized functionalities use apt-get option.