Step-by-step Install Guide for Leopard
From Hypertopic
Contents |
Requirement
We will need to install the following software dependencies:
- Xcode (from the Leopard DVD or Apple Developer connection )
- Readline (http://tiswww.case.edu/php/chet/readline/rltop.html)
Install PostgreSQL
Download the source from http://www.postgresql.org
Uncompress
Create the Postgres User
Firstly, you need to find the uid and gid of your new postgres user. The following commands display a sorted list of existing gids and uids. You just need to pick a gid and uid that's not currently being used. Make them match for simplicity's sake. In my case it was 102.
dscl . -list /Groups PrimaryGroupID | awk '{print $2}' | sort -n
dscl . -list /Users UniqueID | awk '{print $2}' | sort -n
Secondly, create the pgsql group by following commands:
sudo dseditgroup -o create -i 102 -r "Web Development Users" web
Thirdly, we'll now open dscl[1] to create the user. Running this program brings up a prompt where you enter your commands.
sudo dscl . > create /Users/postgres > create /Users/postgres UniqueID 102 > create /Users/postgres UserShell /bin/bash > create /Users/postgres RealName "Postgres Administrator" > create /Users/postgres NFSHomeDirectory /usr/local/pgsql > create /Users/postgres PrimaryGroupID 102 > create /Users/postgres Password * > quit
Finally, create the pgsql home dir.
sudo mkdir -p /usr/local/pgsql/log sudo chown -R postgres:web /usr/local/pgsql
Set Environment Variables
We need to make sure the PostgreSQL command-line tools are accessible from any path. To do this you need to edit the global Bash profile:
sudo mate /etc/profile
Add this line:
export PATH=/usr/local/pgsql/bin:$PATH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib
Last, exit Terminal with “exit” command and relaunch it.
Compile and install PostgreSQL
Change to the postgres user and run ./configure to set the compilation options.
./configure --prefix=/usr/local/pgsql make su - postgres make install
Set Default Character Set to UTF-8
PostgreSQL comes defaulted to “SQL ASCII”. To use Argos we should set the default character set to UTF-8. You cannot change the encoding of a database once it is created. The only way is to completely delete it and recreate it:
sudo rm -R /usr/local/pgsql/data
Now recreate the database. Note that you must be the “postgres” user to do this, which we are doing with the “sudo -u postgres” portion below. The -E parameter of initdb tells PostgreS to use UTF-8 – the standard, modern, universal character set:
sudo -u postgres initdb -E utf8 /usr/local/pgsql/data
All new databases, from that point on, will default to UTF-8.
Add PostgreSQL to Autostart PostgreSQL When System Boot
Use a text editor such as textmate to create the PostgreSQL Launchd file:
mate /System/Library/LaunchDaemons/org.postgresql.PostgreSQL.plist
Copy and paste the following content into the file.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.postgresql.PostgreSQL</string> <key>OnDemand</key> <false/> <key>ProgramArguments</key> <array> <string>/usr/local/pgsql/bin/pg_ctl</string> <string>-D</string> <string>/usr/local/pgsql/data</string> <string>-l</string> <string>/usr/local/pgsql/data/server.log</string> <string>start</string> </array> <key>ServiceDescription</key> <string>PostgreSQL Server</string> <key>UserName</key> <string>postgres</string> <key>GroupName</key> <string>web</string> </dict> </plist>
Next reboot your Mac and check to see if postmaster started up. Or you can try the following commands:
sudo launchctl load /System/Library/LaunchDaemons/org.postgresql.PostgreSQL.plist sudo launchctl start org.postgresql.PostgreSQL
Install Apache
Download the source from http://www.apache.org
Uncompress
./configure --prefix=/usr/local/apache2 \ --enable-dav \ --enable-dav-fs \ --enable-so \ --enable-rewrite=shared \ --enable-speling=shared make sudo make install
To start the apache you had installed, you need to edit the file:
/System/Library/LaunchDaemons/org.apache.httpd.plist
and replace the string:
/usr/sbin/httpd
to point to your own installation of apache.
/usr/local/apache2/bin/httpd
Install PHP
Download the source from http://www.php.net
Uncompress
./configure \ --with-apxs2=/usr/local/apache2/bin/apxs \ --prefix=/usr/local/php5 \ --with-config-file-path=/etc/ \ --with-pgsql=/usr/local/pgsql \ --with-curl=/usr/bin \ --with-curlwrappers \ --with-zlib-dir=/usr \ --enable-mbstring \ --with-pdo-pgsql=/usr/local/pgsql \ --enable-debug \ --without-iconv \ --enable-cli make sudo make install
You should now have a functioning PHP. Next, we need to move the leopard-bundled PHP out of the way and move the new PHP into its place with this:
sudo mv /usr/bin/php /usr/bin/php-leopard sudo ln -s /usr/local/php5/bin/php /usr/bin/php
To tell Apache how to handle PHP files. Edit Apache's configuration file:
/usr/local/apache2/conf/httpd.conf
Add these lines:
AddHandler application/x-httpd-php .php AddHandler application/x-httpd-php-source .phps
Configure PostgreSQL
Create user for PostgreSQL
We now need to create the database user 'argos'.
sudo -u postgres createuser -D -A -P argos
Enter in a DatabasePassword here, then answer 'N' to the question.
Create database
We now need to use command createdb[2] to create the database 'argos' for the user 'argos'. You'll need to enter the password that you just created.
sudo -u postgres createdb -W -E utf8 -O argos argos
Configure Apache
Create Argos documents root directory.
cd /Library/WebServer/ sudo mkdir argos.domain.com
Enable virtual host
To enable virtual hosting functionality, scroll down to the end of the httpd.conf file and uncomment the following:
# Include Include conf/extra/httpd-vhosts.conf
You need to make an entry in the httpd-vhosts.conf file like so:
<VirtualHost *:80>
ServerName argos.domain.com
ServerAdmin yourname@domain.com
DocumentRoot "/Library/WebServer/argos.domain.com"
<Directory "/Library/WebServer/argos.domain.com">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog logs/argos.domain.com-error.log
LogLevel warn
CustomLog logs/argos.domain.com-access.log combined
ServerSignature On
#Allows URLs which contain encoded path separators to be used.
AllowEncodedSlashes On
</VirtualHost>
Install Argos
Get Latest Argos Code
Check out the latest version from subversion:
cd /Library/WebServer/tech-ada.utt.fr sudo svn checkout https://argos-viewpoint.svn.sourceforge.net/svnroot/argos-viewpoint/trunk .
Press Y to continue.
In the future you will be able to update to the latest version using:
svn update
Directory & File Permissions
Set correct permissions for all your configuration files. Installation process can not be completed until you set writable permissions for config.inc.php and .htaccess in your Argos root directories.
Run Installation Script
Run the Argos installation script by accessing install/index.php in your favorite web browser.
- If you installed Argos in the root directory, you should visit: http://example.com/install/index.php
- If you installed Argos in its own subdirectory called myargos, for example, you should visit: http://example.com/myargos/install/index.php
IMPORTANT! After installation is complete remove install/ subdirectory in your Argos script directory.
Finnally, you're finished. Congratulations!
