Topic: Mac OS X Installing Required Software
Topic type:
Describes the steps necessary for installing Kete's required software on a Mac OS X host.
Originally written by Walter McGinnis, Kete Project Lead for Katipo Communications, Ltd.
Part of the Installation Guide
Note: This section covers Mac OS X 10.6.6 (Snow Leopard) and Mac OS 10.7.x (Lion). Mac OS X 10.4 (Tiger) and Mac OS 10.5.1 (Leopard) are covered in earlier versions of this topic. Please refer to 'History' of this topic to view earlier versions if you want to install based on those versions of Mac OS X. Note, Leopard (10.5) will probably work fine with this version of instructions, but hasn't been tested.
Install Homebrew (MacPorts installation depreciated)
Follow the instructions at https://github.com/mxcl/homebrew/wiki/installation to install Homebrew software package manager system on your system. Homebrew requires that XCode is installed.
A note about Homebrew and root/sudo
Homebrew is designed to work as much as possible without sudo. You use your own user account or the Kete user account you set up to install software. Pay attention throughout the guide for notes telling you when you should skip "sudo" or using the root account.
More information on why Homebrew doesn't use root permissions and sudo can be found in Homebrew's installation guide and project pages.
Install Required Software for Running Kete
So lets get installing. Run the followig from the command line (i.e. Terminal.app or another shell):
$ brew install git zebra mysql memcached imagemagick
(optional - enables conversion of uploaded HTML, Plain Text, PDF, and Microsoft Word documents to the description of the document)
$ brew install poppler wv lynx
(optional - enables support for harvesting embedded metadata in uploaded files, see mini_exiftool gem step later)
$ brew install libexif exiftool
Installing the Rails framework
For the moment at least, Kete standardizes on the Ruby Enterprise Edition version of Ruby 1.8.7. It is a product from the same people that make mod_rails/Passenger (discussed at the bottom of this page). It's optimized to run faster than a standard installation of Ruby. It requires a few extra installation steps, but it's well worth the effort. (for instructions on using debians packages, see an older version of this topic)
$ brew install ruby-enterprise-edition
Additional Setup Instructions
Some of these do actually require 'sudo'. Use as noted.
MySQL
Initialize and configure mysql to start at boot time. We'll also set the mysql root password and set up unicode to be the default charset. Make sure you save your mysql root password, you'll need it later!
$ unset TMPDIR
$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp # note commands for root password change
$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/Cellar/mysql/5.x.xx/com.mysql.mysqld.plist ~/Library/LaunchAgents/ # replace x.x.xx with version found under that directory
$ launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist $ mysqladmin -u root password 'new-password'
$ # run second command to change host specific root password as noted after mysql_install_db command
Memcached
We'll turn it on as a daemon that will run at boot. You may want to start it only when you are doing development, since it can eat up RAM. You may just want to manage it directly from the command line via the "memcached" command itself.
$ cp /usr/local/Cellar/memcached/x.x.x/com.danga.memcached.plist ~/Library/LaunchAgents/ # replace x.x.x with actual version number directory
Now it is ready to run:
$ launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist
If you aren't running your development Kete server, you probably want to turn off the Memcached daemon with the following (just remember to turn it on again when you do!):
$ launchctl stop local.danga.memcached
HTTP Request Server
We recommend Apache 2 in combination with Ruby Enterprise Edition for optimal performance.If you'd prefer to use Nginx with Mongrel, see an older version of this topic.
Apache 2 comes preinstalled on Mac OS X and Passenger comes with Ruby Enterprise Edition, which we installed earlier so, go ahead and install the passenger module for Apache.
$ sudo su -
root@host: # passenger-install-apache2-module
Copy (using a text editor as root user) the Apache2 config lines it gives you at the end of the file to the end of your apache2.conf configuration file at /etc/apache2/apache2.conf. The lines look similar to this (paths may differ depending on which ruby implementation you're using):
LoadModule passenger_module
/usr/local/Cellar/ruby-enterprise-edition/1.8.7-20XXXXXX
/lib/ruby/gems/1.8/gems/passenger-x.x.x/ext/apache2/mod_passenger.so
PassengerRoot/usr/local/Cellar/ruby-enterprise-edition/1.8.7-20XXXXXX/
lib/ruby/gems/1.8/gems/passenger-x.x.x
PassengerRuby/usr/local/Cellar/ruby-enterprise-edition/1.8.7-20XXXXXX/
bin/ruby
Some of Kete's downloading functionality requires an authorization step. If used a lot this potentially can slow all requests being served from the site. Thankfully there is an easy solution that Kete knows to use if enabled; X-sendfile. First, visit https://tn123.org/mod_xsendfile/ and get the latest .tar.gz source code. You need to do the following to set it up:
root@host: # cd /usr/local/src/; cp ~/Downloads/the_file ./ # substitute downloaded filename
root@host: # tar xfz mod_xsendfile-0.xx.tar.gz
root@host: # cd mod_xsendfile-0.xx
root@host: # apxs -cia mod_xsendfile.c
Then you need to add the following to your Apache2 config file (either global, or in a virtualhost):
XSendFile on
And force a reload of apache:
root@host: #
apachectl
force-reload
Open up /etc/apache2/httpd.conf in your favourite editor, and change the following settings:
User <- the user running the kete app(s). Usually kete or yourself.
Group <- the group of the user running the kete app(s)
In the same file, uncomment the following line:
Include /private/etc/apache2/extra/httpd-vhosts.conf
In /etc/apache2/extra/httpd-vhosts.conf, uncomment the following line:
NameVirtualHost *:80
And finally, to make the apache restart command more consistant for the rest of the guide, type
root@host: # mkdir /etc/init.d
root@host: # ln -s /usr/sbin/apachectl /etc/init.d/apache2
With those changes made (and files saved), restart Apache:
root@host: # /etc/init.d/apache2 restart
and then look for any errors causes by bad configuration by running:
root@host: # tail -n 200 /var/log/apache2/error_log
Important Note: At this point, Apache2 and Passenger are installed but not yet configured for our Kete site. We'll handle that in a separate step once we have Kete installed. Until then, web requests will throw an error until you have actually deployed your Kete application.
Next step:
Setting Up the Environment
Discuss This Topic
There are 10 comments in this discussion.
Read and join this discussion
nlk
said edit files
I think the install went find. I am having problems editing or finding any of the config files. Also unable to find the ~/profile files or .bash_profile or .bashrc files. I am using the find and still have no luck. I am trying to get this working by the 15th of
Hi nlk,
I'm not sure what level your command line proficiency is, so I apologize if this seems obvious and doesn't help.
Could you do a simple "ls" in from the Terminal to list files under /etc/apache2/ to make sure you have the httpd.conf file please? Something like this:
$ ls -l /etc/apache2/
If you don't see the file in httpd.conf listed in the results or if that directory (/etc/apache2) doesn't exist, there is something strange about your Mac OS 10.5.6 installation. If you do see it, note that you have to edit the file as the super user (i.e. use "sudo" before the command to open the file in your text editor of choice).
As far as "~/.profile", "~/.bash_profile", or "~/.bashrc" files. You understand that the "~" means the home directory of the user you are logged in as, correct? For example, if I was logged in as myself on my laptop "~/.bash_profile" in Mac OS X would actually correspond to "/Users/walter/.bash_profile". Also, there is an "a" option to the ls command to list these special files (files that begin with a "." in their filename) that may help. Try this to list what is in your home directory:
$ ls -la ~
I've also deleted your redundant comments and left the most complete one.
Hope this helps.
Tags: Installation, apache, Mac OS X
nlk
said command line
Walter sorry for the duplicates not sure what happened and thank you for removing.
You are right on the money I need to work on command lines. I was able to get into my ~.profile and update.
when I open the httpd as myself it opens in text editor but like you said I have to use sudo but then there is no application to open
off to learn MAC command lines
thanks for all of your help
Give this howto a try:
http://www.tech-recipes.com/rx/2754/os_x_edit_file_using_textedit_as_root_superuser/
You'll want to replace "/etc/hosts" with "/etc/apache2/httpd.conf", but otherwise I believe that should give you what you want.
Tags: Mac OS X, apache2, httpd.conf, sudo, command line, editor
nlk
said restart apache
that helped able to edit items now
Why when I try to restart I get no such file or directory but the line before says file exists. All the files are saved with the above information.
bash-3.2# ln -s /usr/sbin/apachectl /etc/init.d/apache2
ln: /etc/init.d/apache2: File exists
bash-3.2# /etc/init.d/apache2 restartbash: /etc/init.d/apache2: No such file or directory
nlk
said apache error log
Do I need to install my app (kete) to /Library/WebServer/Documents/kete
bash-3.2# tail -n 200 /var/log/apache2/error_log
[Tue Dec 23 11:36:01 2008] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 23 11:36:02 2008] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 23 11:36:02 2008] [notice] Digest: done
[Tue Dec 23 11:36:02 2008] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 configured -- resuming normal operations
[Tue Dec 23 12:38:22 2008] [notice] caught SIGTERM, shutting down
[Tue Dec 23 12:39:00 2008] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 23 12:39:01 2008] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 23 12:39:01 2008] [notice] Digest: done
[Tue Dec 23 12:39:01 2008] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 configured -- resuming normal operations
[Tue Dec 23 16:10:31 2008] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://localhost/
[Sun Dec 28 09:26:19 2008] [notice] caught SIGTERM, shutting down
[Sun Dec 28 09:26:45 2008] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server's fully qualified domain name, using michael-e-caseys-mac-mini.local for ServerName
[Sun Dec 28 09:26:52 2008] [notice] Digest: generating secret for digest authentication ...
[Sun Dec 28 09:26:52 2008] [notice] Digest: done
[Sun Dec 28 09:26:52 2008] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 configured -- resuming normal operations
[Mon Dec 29 11:38:15 2008] [notice] caught SIGTERM, shutting down
[Mon Dec 29 11:38:40 2008] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server's fully qualified domain name, using michael-e-caseys-mac-mini.local for ServerName
[Mon Dec 29 11:38:48 2008] [notice] Digest: generating secret for digest authentication ...
[Mon Dec 29 11:38:48 2008] [notice] Digest: done
[Mon Dec 29 11:38:48 2008] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 configured -- resuming normal operations
[Mon Dec 29 14:59:38 2008] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://localhost/
[Mon Dec 29 15:25:24 2008] [error] [client ::1] File does not exist: /Library/WebServer/Documents/kete
[Mon Dec 29 15:25:38 2008] [error] [client ::1] File does not exist: /Library/WebServer/Documents/apps
[Mon Dec 29 15:51:08 2008] [error] [client fe80::21f:f3ff:fefa:d2f2] File does not exist: /Library/WebServer/Documents/usrs
[Mon Dec 29 15:51:08 2008] [error] [client fe80::21f:f3ff:fefa:d2f2] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://michael-e-caseys-mac-mini.local/usrs/nancy/apps/kete
[Mon Dec 29 15:51:27 2008] [error] [client fe80::21f:f3ff:fefa:d2f2] File does not exist: /Library/WebServer/Documents/usres
[Wed Dec 31 09:34:06 2008] [error] [client ::1] File does not exist: /Library/WebServer/Documents/apps
[Wed Dec 31 09:35:05 2008] [notice] caught SIGTERM, shutting down
[Wed Dec 31 15:41:29 2008] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Dec 31 15:41:29 2008] [notice] Digest: generating secret for digest authentication ...
[Wed Dec 31 15:41:29 2008] [notice] Digest: done
[Wed Dec 31 15:41:29 2008] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 configured -- resuming normal operations
[Wed Dec 31 15:41:39 2008] [error] [client 10.200.0.54] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://10.200.0.54/
[Wed Dec 31 15:41:52 2008] [error] [client 10.200.0.54] File does not exist: /Library/WebServer/Documents/kete
[Fri Jan 02 11:51:24 2009] [notice] caught SIGTERM, shutting down
[Fri Jan 02 11:51:25 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri Jan 02 11:51:26 2009] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 02 11:51:26 2009] [notice] Digest: done
[Fri Jan 02 11:51:26 2009] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 configured -- resuming normal operations
[Mon Jan 05 11:06:24 2009] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://localhost/
[Mon Jan 05 11:22:42 2009] [notice] caught SIGTERM, shutting down
Hello again,
Check the note at the bottom of this step of the installation:
Important Note: At this point, Apache2 and Passenger are installed but not yet configured for our Kete site. We'll handle that in a separate step once we have Kete installed. Until then, web requests will throw an error until you have actually deployed your Kete application.
In other words, at this point in the installation Apache will throw errors. Please carry on with the next steps and let us know if that doesn't fix things for you.
Tags: apache, Installation, Mac OS X, passenger, mod_rails
If like me you have upgraded to Snow Leopard (10.6) to Lion and previously had an earlier version of Xcode installed, you may encounter some problems when installing various required pieces of softare from Homebrew.
The solution is painless, but the tricky thing is it is in two stages:
- get Xcode 4 from the Mac App Store (free)
- run the Xcode Installer (this was the step I missed)
If you don't do the second step, you won't have your various command line utiliies, such as the C compiler, in place and things will fall a part in strange ways.
See here for background:
Tags: Mac OS X, Installation, Lion, 10.7, Xcode 4, Xcode
nlk
said installation help
I am working with MAC OS X 10.5.6 and Apache2 my problem is I am new to all and having problem locating the httpd.conf files that I need to update. I did a find but doesn't look right I don't have the line that has to be un-commented.