With the recent release of Lion and Lion Server we covered a few of the missing features we were previous used to seeing in an OS X Server release. One noticeable absentee was MySQL, which we later discovered to be replaced by PostgreSQL. In this article we will take a look at how to connect to Lion’s built in PostgreSQL services.
UPDATE: I have now made a video walkthrough on how to get Postgres up and running on Lion Server 10.7.4. Click here.
There is an alternate guide to PostgreSQL in Lion Server by using pgAdmin instead of phpPgAdmin, you can find the article here.
Open up the Server App and turn on the Web Server. Also check the box next to “Enable PHP web applications”.
Head over to the phpPgAdmin website and download the latest release. Unzip the contents and rename the folder to something like “phpPgAdmin” to make it easier to browse to. You need to place this folder in your web documents folder in the following location:
Open up Safari and browse to the phpPgAdmin folder on your localhost web server:
At this point the PostgreSQL server should have a red X next to it, as it’s not running.
There are two ways to start the PostgreSQL service. Either simply by opening Server App and starting the “Wiki” service. You may want to change the “Wiki Creators” to be Admin’s only or otherwise everybody can create Wikis. Or, by opening Terminal and running the following command:
sudo serveradmin start postgres
Now if you head back to the phpPgAdmin page in Safari and select the database you should now be able to login with the user “_postgres” and your administrator password.