I installed the postgresql and devpkg-postgresql through swupd but that didn’t actually create any postgres user nor ran any service. I tried to create both manually, but it wouldn’t launch (unknown error), so I’m guessing it did not install the required files (I have the required dependencies, including dev tools, openssl, i even installed database-basic to be sure).
I tried to follow the documentation on the postgres website for manual install from source but that did not work either (i did the short and long version of chapter 16 / installation). I managed to run make install and it did what it had to, but it did not create the user, and still no service running.
I tried to add the user manually through useradd (since their command lists adduser), and that did not return me a valid user either. I tried to start the service manually through systemctl but that returned an unknown error.
I sank a couple hours into this searching the deep internet for answer but couldn’t find any, has anyone managed to run postgres, tell me what I’m doing wrong please kind OG people of the linux community (p.s. sorry about all my recent noobish inquiries on this forum, you are all too smart and kind!).
Even after : useradd postgres and passwd postgres I cannot su - postgres it says This account is currently not available. There is no postgres user in my /etc/passwd either. When i try to run useradd postgres again it tells me the user already exists. I tried to manualy add the user in my passwd file with the information copied from my ubuntu install of postgres but that didn’t work either.
I managed to su - postgres into my user after manually creating it in my passwd file and setting the password manually, but that did not solve any problem obviously.
My /var/lib/postgresql folder was also empty, manually creating it did not solve the problem either.
If you start postgres (systemctl start postgres) it should create the db (if you look at the service you see it creating the datadir in /var/lib/pgsql/data by default). From there you should be able to modify the pg_hba.conf to enable login.
Thanks to @william.douglas’s keen eyes we found out that postgresql-install.service wasn’t properly getting ran. We’re fixing this so that in the future this won’t happen.
For your system, I recommend doing this (if you haven’t created any tables/databases yet, obviously):
BTW, the postgres user is always present on clearlinux, it is part of the OS default uid mapping, and therefore it won’t be dynamically added after a bundle-add.
I’m planning to build my own custom GIS stack bundle - there are some missing pieces in maker-gis and I need header files for the R packages I install. As I’ve noted elsewhere, user-installed R packages often require headers or libraries that may or may not be bundled in Clear Linux.
Updating postgresql is a little bit tricky because of db migrations. At this point my goal is to add postgres 11 in a way that can sit side by side with postgres 9.
@ahkok I managed to setup the conf file correctly and now postgres is running, and my rust/rocket/diesel setup is working! Thank you!
I was wondering, since the user postgres is enabled by default, is there a way I can su - postgres? Right now I get error: This account is currently not available.
The account is a system account and those are by default not something you can log in to. There are some ways around it, most of them involve using sudo … For instance you can just do sudo -u postgres bash. However, I would recommend not using this method for normal maintenance - you should use the postgresql client instead.