These steps are no longer required if you are using Postgres 9.3 or later on OSX. All current installers use Postgres 9.6 or later. |
The steps outlined are similar if you have a Mac Mini or Mac Pro running OS X 10.6.x or earlier. You will have an install DVD and can do most of the steps without connecting to the internet. |
The general process to prepare such a machine for optimal performance is:
The steps have a degree of technical complexity and assume you are able to interpret and adapt to variations in the process yourself.
Since Lion does not come with any install disks, you will need to follow a special procedure to stripe the drives on Lion servers as follows:
This step is no longer required -- the installers do it for you |
In most circumstances, you can skip this and the remainder of the steps if you are only installing a demo. If you are not, you will need to proceed to steps 3 and 4.
The database server needs a specific user called TheatreManager with specific privileges that will be assigned as the owner of each database. We also want to import a demo database. This step assumes that you have installed things into the /Users/Shared directory. If you did not, then you will need to edit the script and do this step manually.
1. | Go to /Users/Shared directory. You should see some files and folders with names that look like below. |
2. | Start terminal and change the user to 'postgres' by typing: su - postgres Press RETURN and then type the postgres user's password (password will not display anything) |
3. | Drag the script '/Users/Shared/CreateDemoDB.sql onto the terminal window. This shortcut saves typing anything. Click into the terminal window and then press RETURN to start the command. If it does not run, then possible issues are:
|
4. | The script will run and load up the TheatreManagerDemo database. You can modify this script to load up a customer database if necessary by editing it in BBedit or in TextEdit (make sure to save it as text if you use TextEdit - its preference, unfortunately, is to save as a .rtf document). Note, any WARNING messages from the TheatreManagerDemo database creation can be ignored. These warnings are normal.
|
This step is no longer required if you are using Postgres 9.3 or later. All current installers use Postgres 9.6 or later. |
Otherwise, this step is not required under most circumstances.
1. | Start Terminal and navigate to the home directory for postgres user.
Type: cd /Library/PostgreSQL/9.3 |
2. | Next, let's update the profile for Terminal to that it makes life easier in Postgres from this point on. Type
it will open with an empty window as below. Just like when using VI for the other two files, type: to put you in insert mode |
3. | Type the two lines into the file exactly as shown. When done, type, in this order: hit the ' ' key(the insert mode will dissappear) (the window will show the 'Entering Ex mode' message) and the window will clear and you will be back at Terminal. The next time you start Terminal under the Postgres user account, you will have access to the Postgres commands and data directory in a more convenient fashion. |
This step is no longer required if you are using Postgres 9.3 or later. All current installers use Postgres 9.6 or later. |
If you used the Theatre Manager Postgres installer, it will detect if you have more than 2 GB of RAM in your machine and automatically insert these into the /etc/sysctl.conf file for you. After installing Postgres the first time, simply reboot the server - these settings will have been done for you and you need not continue with the steps below.
BEFORE STARTING: Ensure you are in Terminal at your own user, not postgres. This is a fairly technical topic and the reference: http://www.postgresql.org/docs/9.0/interactive/kernel-resources.html
1. |
Open Terminal again and type: su - [Your UserName] Type vi /etc/sysctl.confType I to insert data Add the lines: kern.sysv.shmmax=1610612736kern.sysv.shmmin=1 kern.sysv.shmmni=256 kern.sysv.shmseg=64 kern.sysv.shmall=393216 kern.sysv.maxproc=2048 kern.maxprocperuid=512 These settings reflect the maximum size of a shared buffer. These settings assume you are running at least 2GB of RAM. If you have less RAM, these settings may need to be altered. shmmax is the key setting; it is in bytes. If the machine has more memory to use, then this could be increased as well. shmall is the shmmax setting divided by 4. Hit the Esc key Hit Shift Q Type wq Hit Enter Restart OS X after doing this. This is required to apply the changes. There is a sample of this file in /users/Shared/ from the install. If your machine has 2GB of RAM or more, you could move it to the right folder instead by: cd /users/shared sudo mv sysctl.conf /etc
Restart OS X after doing this. This is required to apply the changes. |