Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Installing Roundcube with postgres

I am working on installing roundcube webmail on my mountain lion server. The instructions seem straight forward enough but I am having no luck getting past the database setup. I dont really know how to proceed. I issue the first command to create a user and get the following error


sudo createuser -U _postgres -d -s roundcube

Password:

createuser: could not connect to database postgres: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?


What do I need to do to get postgres to connect.


David Urban

Mac mini (Mid 2011), OS X Server

Posted on Nov 9, 2012 11:21 AM

Reply
29 replies

Jan 20, 2013 10:07 PM in response to redshift82r

I'm running into the same issue. I don't expect to need Profile Manager, Wiki Services, Calendar or Address Book on my server so found postgres wasn't running. Configuring Calendar to run seemed like the most innocuous option. So I did that with the 10.8 Server GUI, and now see:


output of: sudo ps -aA | grep postgres

19360 ?? 0:00.04 /Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real -D /Library/Server/PostgreSQL For Server Services/Data -c unix_socket_directory=/Library/Server/PostgreSQL For Server Services/Socket -c logging_collector=on -c log_connections=on -c log_lock_waits=on -c log_statement=ddl -c log_line_prefix=%t -c listen_addresses= -c log_directory=/Library/Logs/PostgreSQL -c log_filename=PostgreSQL_Server_Services.log -c unix_socket_group=_postgres -c unix_socket_permissions=0770

19369 ?? 0:00.00 postgres: logger process

19371 ?? 0:00.00 postgres: checkpointer process

19372 ?? 0:00.05 postgres: writer process

19373 ?? 0:00.01 postgres: wal writer process

19374 ?? 0:00.04 postgres: autovacuum launcher process

19375 ?? 0:00.06 postgres: stats collector process

19377 ?? 0:00.02 postgres: caldav caldav [local] idle

19458 ttys005 0:00.00 grep postgres

but yet I still see the same error -

sudo createuser -U _postgres -d -s roundcube

createuser: could not connect to database postgres: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?


Any thoughts? I haven't rebooted the machine, but since the postgres processes are running I sort of assume it would've created the socket file automatically.

Jan 21, 2013 9:29 AM in response to jaydisc

I'm running 10.8.2 on a new mac mini that I purchased and installed the latest Server from the App Store. So far a fairly vanilla installation for file sharing purposes for a few users at home, along with a reasonable number of customizations to the postfix/dovecot installation.


@Redshift82r:


sudo psql -U _postgres --list

Password:

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

Is the server running locally and accepting

connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?


/Applications/Utilities/Network\ Utility.app/Contents/Resources/stroke 127.0.0.1 5432 5432

Port Scanning host: 127.0.0.1

Jan 21, 2013 2:54 PM in response to Jonathan2001

19360 ?? 0:00.04 /Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real -D /Library/Server/PostgreSQL For Server Services/Data -c unix_socket_directory=/Library/Server/PostgreSQL For Server Services/Socket -c logging_collector=on -c log_connections=on -c log_lock_waits=on -c log_statement=ddl -c log_line_prefix=%t -c listen_addresses= -c log_directory=/Library/Logs/PostgreSQL -c log_filename=PostgreSQL_Server_Services.log -c unix_socket_group=_postgres -c unix_socket_permissions=0770




"listen_addresses= "


It would appear you may not have edited the postgres plist file to listen on 127.0.0.1


Have a look at my posts re vacation messaging to find the how to ( sorry doing this on an iPhone and off to work!)


Gerry

Jan 22, 2013 9:10 PM in response to redshift82r

Indeed, thanks!

sudo -u _postgres createdb -O roundcube -E UNICODE roundcubemail

(etc) helped me get through the database setup.


I'm stuck, however further along.


I chose to install roundcube in:

/opt/local/more/roundcubemail-0.8.4 with a symbolic link at /opt/local/more/roundcube to easy subsequent migration.


I've set up apache to alias from the default 443 sites config that ML Server sets up by including a httpd_webmail.conf file (so it doesn't get clobbered by the UI. Here's the contents --

cat /Library/Server/Web/Config/apache2/httpd_webmail.conf

Alias /webmail "/opt/local/more/roundcube/"

<Directory "/opt/local/more/roundcube/">

Options -Indexes FollowSymLinks

</Directory>

I created a WebApp plist file for the heck of it (though honestly I'm not sure if that really does anythign since I've fot the Alias set up to point to the alternative directory), and I copied the roundcube config/*php.dist to *php variants and modified a number of settings that seemed relevant for me.


I'm now struggling to load the https://localhost/webmail/installer/ page in Safari. Here's what I see in the apache error_log:


[Tue Jan 22 20:54:15 2013] [error] [client ::1] PHP Fatal error: Unknown: Failed opening required '/opt/local/more/roundcube/installer/index.php' (include_path='.:') in Unknown on line 0


I'm not quite sure if the include path is sufficient ... but if I run php -l -f locally *within* the .../installer directory, I see no problems. If I run it with an absolute path I run into other problems which I think mimic what apache is doing...

> php -f /opt/local/more/roundcube/installer/index.php

PHP Warning: require_once(utils.php): failed to open stream: No such file or directory in /opt/local/more/roundcube/installer/index.php on line 56


Warning: require_once(utils.php): failed to open stream: No such file or directory in /opt/local/more/roundcube/installer/index.php on line 56

PHP Fatal error: require_once(): Failed opening required 'utils.php' (include_path='/program/lib:/program:/program/include:.:') in /opt/local/more/roundcube/installer/index.php on line 56


Fatal error: require_once(): Failed opening required 'utils.php' (include_path='/program/lib:/program:/program/include:.:') in /opt/local/more/roundcube/installer/index.php on line 56


Do I have something PHP-related obviously misconfigured?


Also, the /opt/local/more/roundcube contents are basically chmod 744, though directories are 755, and owned by admin:staff (admin = the MacOS default user account). The temp and logs directories are owned by _www:staff ,for what it's worth. I assume these are okay?

Jan 22, 2013 9:32 PM in response to Jonathan2001

Jonathon - all I created were these two files - hopefully its self explanatory - just ticked "RoundCube webmail" in the Advanced section of each web domain I wished to offer it on.




Contents of /opt/webapps/webmail/httpd_webmail.conf



Alias /webmail "/opt/webapps/webmail/"

Alias /Webmail "/opt/webapps/webmail/"

Alias /WebMail "/opt/webapps/webmail/"

Requestheader set x-apple-service-webmail-enabled true

<Directory "/opt/webapps/webmail/">

Options -Indexes FollowSymLinks

</Directory>



Contents of /Library/Server/Web/Config/Apache2/Webapps/com.mydomain.webapps.webmail.plist



<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>name</key>

<string>com.mydomain.webmail</string>

<key>displayName</key>

<string>"RoundCube webmail</string>

<key>proxies</key>

<dict/>

<key>includeFiles</key>

<array>

<string>/opt/webapps/webmail/httpd_webmail.conf</string>

</array>

<key>installationIndicatorFilePath</key>

<string>/opt/webapps/webmail/httpd_webmail.conf</string>

</dict>

</plist>




server:webapps admin$ ll

total 0

drwxr-xr-x 6 root wheel 204 16 Jan 18:13 ./

drwxr-xr-x 5 root wheel 170 9 Nov 16:05 ../

drwxr-xr-x@ 20 admin _www 680 17 Jan 16:14 ossec/

drwxr-xr-x 76 admin _www 2584 28 Oct 12:29 phpPgAdmin/

drwxr-xr-x 24 admin _www 816 18 Jan 10:32 phusion/

drwxr-xr-x 22 admin _www 748 1 Oct 16:06 webmail/


to reset ownership -


$ sudo chown -R admin:_www webmail


I use webapps for adding all sorts of functionality like proxies to different machines, ossec WUI, etc


hope that helps.

cheers

G


Message was edited by: redshift82r

Jan 22, 2013 9:51 PM in response to redshift82r

Thanks gerry - think what I had done was equivilient ... but I just changed my approach to simply use the Webapp plist to import the apache configuration rather than manually importing it. I still have the same problem with the PHP page not loading when I load https://localhost/webmail/installer/


[Tue Jan 22 21:39:34 2013] [error] [client ::1] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

[Tue Jan 22 21:39:34 2013] [error] [client ::1] PHP Fatal error: Unknown: Failed opening required '/opt/local/more/roundcube/installer/index.php' (include_path='.:') in Unknown on line 0



------------


Update: I think I've found the issue. Something PHP or apache HATES the symbolic link. So now /opt/local/more/roundcube/ is the actual folder that was previously entitled roundcubemail-0.8.4. Hopefully this post will benefit somebody else in the future!


Message was edited by: Jonathan2001

Jan 30, 2013 12:09 AM in response to redshift82r

Great suggestions! Any idea why I get the following error when trying to start the web server after adding the two files you mentioned?


undefined method `to_ruby' for nil:NilClass

web:error = "CANNOT_START_SERVICE_ERR"


Here's what I have:

1 The File) /Library/Server/Web/Config/Apache2/Webapps/com.test.mydomain.webapps.webmail.pl ist

2 The Permissions) -rw-r--r-- 1 root wheel 793 Jan 30 01:03 com.test.mydomain.webapps.webmail.plist

3 The Contents):

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>name</key>

<string>com.test.mydomain.webmail</string>

<key>displayName</key>

<string>"RoundCube webmail</string>

<key>proxies</key>

<dict/>

<key>includeFiles</key>

<array>

<string>/usr/share/web/roundcubemail/httpd_webmail.conf</string>

</array>

<key>installationIndicatorFilePath</key>

<string>/usr/share/web/roundcubemail/httpd_webmail.conf</string>

</dict>

</plist>



AND


1 File) /usr/share/web/roundcubemail/httpd_webmail.conf

2 Permissions) -rw-r--r-- 1 root _www 319 Jan 30 01:00 httpd_webmail.conf

3 Contents):

/usr/share/web/roundcubemail/



Alias /webmail "/usr/share/web/roundcubemail/"

Alias /Webmail "/usr/share/web/roundcubemail/"

Alias /WebMail "/usr/share/web/roundcubemail/"

Requestheader set x-apple-service-webmail-enabled true

<Directory "/usr/share/web/roundcubemail/">

Options -Indexes FollowSymLinks

</Directory>

Jan 30, 2013 9:22 PM in response to Bryan Schramm

I fixed by moving the files to new locations, and, changing them to the following:


FILE: /Library/Server/Web/Config/apache2/httpd_webmail.conf

CONTENTS:

Alias /webmail "/usr/share/web/roundcubemail/"

Alias /Webmail "/usr/share/web/roundcubemail/"

Alias /WebMail "/usr/share/web/roundcubemail/"

<Directory "/usr/share/web/roundcubemail">

DirectoryIndex index.php

</Directory>


FILE: com.mydomain.test.webapp.webmail.plist

CONTENTS:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">



<plist version="1.0">

<dict>

<key>includeFiles</key>

<array> <!-- Include files are activated in virtual host when webapp is started -->

<string>/Library/Server/Web/Config/apache2/httpd_webmail.conf</string >

</array>

<key>name</key>

<string>com.mydomain.test.webmail</string>

<key>displayName</key> <!-- Name shown in Server app -->

<string>""RoundCube Webmail"</string>

<key>installationIndicatorFilePath</key> <!-- The presence of this file indicates web app is installed -->

<string>/Library/Server/Web/Config/apache2/httpd_webmail.conf</string>

<key>sslPolicy</key> <!-- Determines webapp SSL behavior -->

<integer>0</integer> <!-- 0: default, UseSSLWhenEnabled -->

<!-- 1: UseSSLAlways -->

<!-- 2: UseSSLOnlyWhenCertificateIsTrustable -->

<!-- 3: UseSSLNever -->

<!-- 4: UseSSLAndNonSSL -->

</dict>

</plist>

Feb 23, 2013 4:01 PM in response to redshift82r

I, too am getting an Error Reading Settings now when I try to turn the Websites service off (it automatically goes to ON!). The error is: An error occurred on the server while processing a command. The error occurred while processing a command of type 'setState' in plug-in 'servermgr_web'. I also get this error when turning on the Wiki service, even though I have not changed any wiki files. AARRGGHH!!

I have followed your instructions to a 'T' but now am hopelessly lost. Please help!

Thanks

Feb 23, 2013 9:05 PM in response to redshift82r

This is what I get in WebConfig log in Console:


E, [2013-02-24T17:59:40.098515 #5656] ERROR -- : Exception: undefined method `to_ruby' for nil:NilClass backtrace:

/Applications/Server.app/Contents/ServerRoot/System/Library/PrivateFrameworks/Se rverFoundation.framework/Resources/xswebconfig:294:in `getDefinedWebAppsFromRepository'

/Applications/Server.app/Contents/ServerRoot/System/Library/PrivateFrameworks/Se rverFoundation.framework/Resources/xswebconfig:293:in `each'

/Applications/Server.app/Contents/ServerRoot/System/Library/PrivateFrameworks/Se rverFoundation.framework/Resources/xswebconfig:293:in `getDefinedWebAppsFromRepository'

/Applications/Server.app/Contents/ServerRoot/System/Library/PrivateFrameworks/Se rverFoundation.framework/Resources/xswebconfig:287:in `initialize'

/Applications/Server.app/Contents/ServerRoot/System/Library/PrivateFrameworks/Se rverFoundation.framework/Resources/xswebconfig:1726:in `new'

/Applications/Server.app/Contents/ServerRoot/System/Library/PrivateFrameworks/Se rverFoundation.framework/Resources/xswebconfig:1726:in `initialize'

/Applications/Server.app/Contents/ServerRoot/System/Library/PrivateFrameworks/Se rverFoundation.framework/Resources/xswebconfig:2498:in `new'

/Applications/Server.app/Contents/ServerRoot/System/Library/PrivateFrameworks/Se rverFoundation.framework/Resources/xswebconfig:2498


and I get the following error in Terminal when I try to reset to defaults:


2013-02-24 18:04:25.090 serveradmin[5723:707] xswebconfig failed: Exception:

undefined method `to_ruby' for nil:NilClass


What do you think?

Installing Roundcube with postgres

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.