Trouble installing Gitlab on CentOS 6.5 - postgresql

I have attempted, several times to install Gitlab on my CentOS 6.5 VPS as per the instructions on the Official page and every time, it fails during the "gitlab-ctl reconfigure" stage of installation. I tried googling around and looking in other questions on here without much luck.
Error is as follows:
* execute[create gitlab database user] action run
================================================================================
Error executing action `run` on resource 'execute[create gitlab database user]'
================================================================================
---- Begin output of /opt/gitlab/embedded/bin/psql --port 5432 -d template1 -c "CREATE USER gitlab" ----
STDOUT:
STDERR: psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
---- End output of /opt/gitlab/embedded/bin/psql --port 5432 -d template1 -c "CREATE USER gitlab" ----

This might not be immediately related to GitLab, but to PostgreSQL itself.
See "Chapter 17. Server Setup and Operation", section "Client Connection Problems":
Alternatively, you'll get this when attempting Unix-domain socket communication to a local server:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
The last line is useful in verifying that the client is trying to connect to the right place.
If there is in fact no server running there, the kernel error message will typically be either Connection refused or No such file or directory, as illustrated.
(It is important to realize that Connection refused in this context does not mean that the server got your connection request and rejected it. That case will produce a different message, as shown in Section 19.4.)
Other error messages such as Connection timed out might indicate more fundamental problems, like lack of network connectivity.
So make sure the database can start first.
The OP Luke Usher confirms in the comments:
The default PostgreSQL config included in gitlab was set to allocate more memory for shared_buffer than I have available.
This was corrected by adding postgresql['shared_buffers'] = "1024MB" to /etc/gitlab/gitlab.rb.

Related

Postgresql not starting even after editing rc file

I receive the following error when I try to start postgresql aka psql in Slackware Linux:
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
I am trying to start it and changed the field in pg_hba.conf to trust from md5.
At some point it was asking for a password.
I get the following when I try to start the server:
bash-5.1# postgres -D /pgsql/data
"root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise. See the documentation for
more information on how to properly start the server.
bash-5.1# postgres -D /pgsql/data >logfile 2>&1 &
[1] 8310

PostgresSQL is not getting connected

I am new to Ubuntu operating system and trying to install postgresSQL in my system.
After completing the installation and entering postgres mode when I enter the command pgsql, it gives me this error
psql: error: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
what could possibly be wrong??
Probably the postgresql server is not running; you can run netstat -adp to see if postgres is listening on port 5432.
If it isn't, then it most likely isn't running; systemctl status postgresql will help identify if it is even installed, and if it has run into any issues (for further details, see https://mydbanotebook.org/post/troubleshooting-01/)
If it is running and seems healthy, then it might not be configured to accept connections in whichever way you are connecting (which user, database, host/network etc) - see details about the pg_hba.conf file that includes rules for this - https://www.postgresql.org/docs/9.1/auth-pg-hba-conf.html
After install, you must create an instance with initdb.
Later, change the listen_address to *, restart the service and now you can check the port.
Check the pg log for the message: "postgres is ready to accept connections"

GPDB-psql: could not connect to server: No such file or directory

We have the small array of Greenplum database.In that, We have a master node. when I am trying to use PSQL utility
Getting this error :
[gpadmin#master gpseg-1]$ psql
PSQL: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
We tried
on searching for postmaster.pid files.We have removed it.But still, the error remains.
You need to export your PGPORT and source Postgres.sh_path(inside your GPDB).
After that you will be able to do psql and connect to the database.

Postgres and Atlassian Jira: driver issue

I am trying to setup a server with centOS 32 bit to install Atlassian Jira on it.
I followed the official Atlassian installation guide at https://confluence.atlassian.com/display/JIRA/Installing+JIRA
Now I am running the Setup Wizard and I need to configure a PostgreSQL database. On my centOS, I installed version 8.4.20 via yum.
However, I am having a hard time setting Jira. Postgres is running and I can login via Linux console, but when I test the connection to the database, I get the following error:
Error connecting to database
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Connection refused
Also, this error appears when I type the full public IP address. If I insert localhost, I get this:
Error connecting to database
FATAL: Ident authentication failed for user "jiradbuser"
If I insert
http://<public ip>
I get the following:
Error connecting to database
No suitable driver found for jdbc:postgresql://http://<public ip>:5432/jiradb
However, I put my jdbc driver into /opt/atlassian/jira/lib and its name is postgresql-8.4-703.jdbc4.jar. Postgresql version is 8.4.20.
Where am I doing wrong?
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
By default, PostgreSQL listens only on the local loopback interface, so connecting to the public IP won't work. If you're connecting from localhost you don't need to anyway, just use localhost.
FATAL: Ident authentication failed for user "jiradbuser"
This is good, it shows that you're connecting to PostgreSQL successfully, then getting an authentication error when trying to log in.
Your PostgreSQL server install defaulted to ident authentication for TCP/IP connections, but the JIRA application isn't running under a unix user named "jiradbuser" so the connection is rejected. Change pg_hba.conf to use md5 instead of ident and set a password for the user. See the client authentication chapter in the docs, particularly, pg_hba.conf.
No suitable driver found for jdbc:postgresql://http://:5432/jiradb
I have no idea where you got the idea that that URL would work...
You want something like:
jdbc:postgresql://localhost:5432/jiradb
I had the same problem. I could solve it setting up the postgres driver .jar from maven repository to \target\jira\webapp\WEB-INF\lib\
Pretty late to the question here but thought I'd add a couple bits to help out the future, going backwards:
No suitable driver found for jdbc
A while ago Atlassian didn't distribute the PostGreSQL JDBC driver file with the JIRA releases. They have been doing this for a while now (I'd say since mid 2013) - regardless, the driver file belongs in the <jira-base>/lib directory unless you are doing a WAR install, in which case you shouldn't, and just put the driver file in the lib directory anyway
FATAL: Ident authentication failed for user "jiradbuser"
1. Listen on a socket if you need to - The best approach to this is to look at your JDBC driver URL - if it has an IP/hostname other than 127.x.x.x or 'localhost' you need to modify PostGreSQL to listen to a TCP port by modifying your postgresql.conf file to enable listening on ports. Just find the file, back it up, then open it and search for localhost, read the file comments and make the correct change. If you find yourself looking around in multiple locations in the file or changing more than a single word you are trying too hard - restore your backup and try again. Just remember to *stop* and *start* your postgres db cluster when you are done
2. enable the correct login METHOD in pg_hba.conf (same directory as the postgresql.conf file - on unix typically under /etc/postgresql/<version>/main/.) - this is difficult to writeup in brief but I'll try
1. backup the pg_hba.conf file - I ain't foolin, this is something you'll be happy with later - back the sucker up
2. edit the file
3. go to the bottom of the file - look for the last line like "# TYPE DATABASE USER ADDRESS METHOD"
4. comment out every line under this 'table heading' line
- the reason to do this is that the package maintainers often fall back to commenting here and so you'll have 2 commented out lines and then one line that isn't commented out - and you'll never notice it - it's easiest to just start off with commenting out the whole block of stuff so there isn't a single uncommented line in the file
- add a two lines for the postgres user to connect local and to a db socket unless your corporate security does not allow - something like this:
local all postgres 127.0.0.1/32 peer
host all postgres 127.0.0.1/32 trust
- add a line for your jiradbuser to connect to the newly created database via sockets with md5 encryption. md5 isn't the best - there are other options to google - if you use md5, it'd look something like this:
host jiraversiondb jiradbuser 127.0.0.1/32 md5
Then save the file, restart postgres cluster (with a stop and start, not with the 'restart' option), and test connecting from the command line.
How to test connections from the command line
If you are logged into a unix system with the postgres tools installed you should be able to mimic the connection attempt which the JIRA server will try to connect to the database. If you cannot connect to the new postgresql db from the command line it's a REAL GOOD chance that JIRA won't be able to either. Plus you'll get better error messages. So to do this just bring up a shell and enter (replacing variables where appropriate - things within the '<' and '>' characters) - all the values for these are in your head and the postgresql.conf file:
psql --port <port - default is 5434> --username=<db user name> --password --dbname=<database name>
Once you can connect from the command line it's a good bet JIRA will as well - no promises, but you'll be on sound footing.
...ahhh....now, that'll hopefully help someone...

bugzilla can't connect to postgres server

I just installed bugzilla-4.4.1 on version 6.4 of Scientific Linux, and I'm having problems connecting to the database (Pg version 8.4).
When I try to fetch the main page (index.cgi), I get the following message:
Software error:
Can't connect to the database.
Error: could not connect to server: Permission denied
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Is your database installed and up and running?
Do you have the correct username and password selected in localconfig?
For help, please send mail to the webmaster (root#localhost), giving this error message and the time and date of the error.
Postgres's pg_hba.conf.conf is configured for md5 auth on localhost:
host all all 127.0.0.1/32 md5
and I can connect to the bugs user in the database using psql:
psql -h 127.0.0.1 -U bugs
Running checksetup.pl seems to confirm that the database is set up and configured properly:
... snip ...
Reading ./localconfig...
Checking for DBD-Pg (v2.7.0) ok: found v2.15.1
Checking for PostgreSQL (v8.03.0000) ok: found v08.04.1800
Removing existing compiled templates...
Precompiling templates...done.
Fixing file permissions...
Now that you have installed Bugzilla, you should visit the 'Parameters'
page (linked in the footer of the Administrator account) to ensure it
is set up as you wish - this includes setting the 'urlbase' option to
the correct URL.
checksetup.pl complete.
[root#PAHRALBLNX001 bugzilla]#
and the testserver.pl script indicates that the server is set up properly:
[root#PAHRALBLNX001 bugzilla]# ./testserver.pl http://127.0.0.1/
TEST-OK Webserver is running under group id in $webservergroup.
TEST-OK Got padlock picture.
TEST-OK Webserver is executing CGIs via mod_cgi.
TEST-OK Webserver is preventing fetch of http://127.0.0.1/localconfig.
I've also verified that the bugs username and password in localconfig matches the setup in Postgres.
The one thing that seems odd however, is that when I look at localhost with Wireshark, I don't see any attempts to connect to the PostgreSQL server while accessing the bugzilla main page. However, if I connect to the PostgreSQL server using psql, I do see the connection in Wireshark.
Edit
I also discovered that bugzilla wouldn't send email. This turned out to be a selinux problem as pointed out by Daniel Vérité. I changed httpd_can_sendmail and httpd_can_network_connect to true, and now it works.
Based on the error message:
Error: could not connect to server: Permission denied
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Permission denied when trying to connect to an IP address means it's denied by the local security policy.
The web server must be enabled to connect to databases with this command:
setsebool -P httpd_can_network_connect_db 1
and if it's not sufficient:
setsebool -P httpd_can_network_connect 1
See http://wiki.centos.org/TipsAndTricks/SelinuxBooleans for more