Unix All-In-One Installation for Kepler 1.1
Unix users can enjoy the latest release of Kepler using an all-in-one installer that includes everything you'll need (Lua, LuaRocks and Kepler itself).
Note: if you are using Ubuntu, you may need to install the readline and
build-essential packages using sudo apt-get install libreadline-dev build-essential
Get the Kepler installer from LuaForge. The kepler installer is called kepler-install-x.y-z where x.y refers to the Kepler version, and z to the installer version.
The documentation below uses x.y-z but you should replace that for the correct kepler and installer version numbers.
Make sure the script has the right permissions:
chmod +x kepler-install-x.y-z
Choosing where to install Kepler
To install Kepler in your home directory use
./kepler-install-x.y-z --prefix=$HOME
To install Kepler in the /usr/local default prefix (as root) use
sudo ./kepler-install-x.y-z
Note: if you need to use a different configuration, check ./kepler-install-x.y-z --help for the installer's options.
The installation
The installer will then show where everything will be installed and you cancel the process if needed. Once confirmed the configuration options, the installer installs Lua 5.1.3, LuaRocks, the base Kepler modules, and Xavante on the respective places.
Testing if everything is OK
Once the installer is finished, just run
xavante_start
and check http://localhost:8080 to see Xavante running!
Kepler with CGI
If you already have a web server like Apache, running Kepler via CGI is the simplest option.
Assuming you've installed Kepler in ~/kepler, just copy cgilua.cgi to your cgi-enabled directory:
cp ~/kepler/bin/cgilua.cgi ~/mysite/cgi-bin/cgilua.cgi
- With shared hosting your hosting company will tell you where you are supposed to put CGI scripts. On your own machine, this would probably
/var/wwwby default.
cgilua.cgi is just a wrapper, however, so you will need a LuaPage page to actually see something in the browser. You can start with the pages sitting in ~/kepler/htdocs, but you'll need to copy them to your site directory:
cp -r ~/kepler/htdocs/* ~/media.freewisdom.org/keplertest/
Now you can finally see Kepler in action: go to a URL like:
http://media.freewisdom.org/keplertest/cgilua.cgi/keplertest/test.lp
Note that what follows cgilua.cgi must be a path to the .lp file from the top of your site directory. I.e.,
http://media.freewisdom.org/keplertest/cgilua.cgi + /keplertest/test.lp
Notes:
If you get a "500" error when accessing the page, check your permissions. Some hosts, e.g. Webfaction, are picky about the permissions for your script. On the one hand, you must give other users permission to run it, on the other hand, some servers do not like it if you give other users ability to edit the file. (This is a security precaution.) "chmod 711" would usually work. ("711" = full access to yourself, only execute permissions for others.) You might need to set the same permissions on the directory where the cgilua.cgi is located. In our case, we would enter:
chmod 711 ~/media.freewisdom.org/keplertest/cgilua.cgi
chmod 711 ~/media.freewisdom.org/keplertest
Configuring CGI on a Mac
Assuming you have enabled Apache to serve pages on your Mac (start the System Preferences/Sharing/Personal Web Sharing service for that), you have two options to use Kepler - either in your home directory or in the system wide Apache directory.
In the first case, your HTML files should go to the ~/Sites directory and in the second they would go to the /Library/WebServer/Documents directory. But what about the cgi launcher?
If you want to access your Kepler scripts with a URL like servername/cgi-bin/cgilua.cgi/index.lp then you should copy the cgilua.cgi file to /Library/WebServer/CGI-Executables and things should work fine if the file index.lp is in the /Library/WebServer/Documents directory.
To reach documents elsewhere, say in your user-specific Sites directory, use a URL s.a. servername/cgi-bin/cgilua.cgi/~user/test.lp. Note that Finder localizes the name of the Sites folder for non-english users; it's still the same folder underneath.
For more details on how to configure Apache on your Mac you can check this O'Reilly article: Apache Web-Serving with Mac OS X. The Apache configuration file at /etc/httpd/httpd.conf has rather good comments, too.
Using Mod-Rewrite to Hide the URL
You should now be able to call a Lua Page or a Lua Script, but you must use a somewhat unwieldy URL. You can fix it with .htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^myapp/(.*)$ /keplertest/cgilua.cgi/keplertest/$1 [L]
Now instead of using the long URL, I can refer to test.lp file with just http://media.freewisdom.org/myapp/test