Why does PostgreSQL work on Ubuntu after installation without using initdb?

I am wondering why you do not need to use initdb according to the postgresql manual before running psql for the first time? (I installed version 8.3 on 8.04.1)

Red Hat requires -c postgresql start, but not init.db.

However, on FreeBSD, you need to run initdb.

Why is the setting not consistent? Difference between apt-get install, rpm -i and pkg_add?

+6
ubuntu install redhat
source share
5 answers

Most likely, itโ€™s just that the startup scripts that they packaged with these systems automatically start initdb the first time they run.

+1
source share

Almost certainly yes. Different tastes of Linux and Unix have different approaches to packaging software; For example, FreeBSD is based on a port system (where you compile from scratch, although most of them have built-in binary packages), while often in common Linux distributions you will find a prepared binary package for something popular.

Various people who support packaging systems (โ€œpackersโ€ and other, sometimes less kind nicknames) support different approaches to the problem, often reflecting the ethical principle of the parent project. Alternatively, it may just be that one packer decides that it is wise to set the preferences with the standard configuration and run some general initialization steps on your behalf, while the more ready-to-pack package will leave it to the end user, especially if the software - It is somehow complicated or requires some consideration before deployment, for example, system services.

+1
source share

These are not startup scripts, but its installation hooks, which are listed in the package that you installed, which takes additional steps for you. Regardless of whether you use the .deb or .rpm format, packers can set tasks after all the files have been installed.

Some distributions hold your hand in installing software; some expect you to prefer to do something yourself. In fact, there is no golden answer as to why any packer does what they do.

Ubuntu aims for a simple, clickless installation without using a shell. Other distributions created specifically for system integrators do not hold your hand.

We invite you to 31 (or more) variants of operating systems that revolve around the Linux kernel, or efforts aimed at the BSD kernel.

Everyone has some idea of โ€‹โ€‹how this should be done. Good distributions assume that you know what you are doing. Unless, of course, they want to pinch the desktop market from Microsoft, in which case they will become good desktop distributions that hold your hand.

This is a matter of choice, basically, which makes the whole phenomenon so cool.

+1
source share

Debian (and, in addition, Ubuntu) handles PostgreSQL quite smartly. Take a look at the postgresql-common package for more details. In short, it supports the presence of several (major) versions of postgres and several clusters for each version of postgres. To find out which clusters you have, try pg_lsclusters . The package compiler assumes that if you are installing the pg server packages for the first time, you want the initdb cluster for it. For example, if you install postgresql-9.1 , by default you will get 9.1 / main cluster initdb'd for your use.

In linux distributions, things are incompatible, because the whole point of distributions is to offer more effective solutions to problems in exactly the same way. Debian offers a great solution on this front. However, I suggest you use postgresql PPA and get a newer version of postgresql, especially since you just install things.

I only realized that I was answering an ancient question. Boo.

+1
source share

If I am not mistaken, Ubuntu PostgreSQL packages are output from Debian. Maybe Debian packaging has this position for some reason. If so, Debian and all its derivatives, such as Ubuntu, will exhibit the same behavior. This will only happen if you try to install the appropriate software from the repository. If you get the source from the PostgreSQL website and compile it, you will get it as indicated in the manual. Different distributions comply with certain packaging rules and adhere to certain positions regarding the packaging of certain software products. If you want to know the exact information, you can pop out a third-party postgresql package wrapper to find out the reasons.

0
source share

All Articles