Hey kids, here's an basic howto on how to get AOLserver & PostgreSQL setup in Linux. I've left out some of the details, but if you're running RedHat, LinuxPPC, or one of the RPM flavors of Unix, this should be pretty straightforward. If you're using RedHat 7, then skip the PostgreSQL install steps:
Ingredients: You'll need the following elements to accomplish this stuff.
- A PC or Mac running a fairly recent build of Linux (RedHat 6-7, LinuxPPC 2000 or YellowDog are my personal choices) that you have physical and root access to. I've changed the directions from my old LinuxConf based ones to using the setup command. LinuxConf isn't included in RedHat anymore, or in YellowDog, so we won't be using it.
- PostgreSQL. If you're running RedHat 7, you've got the version you need. You should be running version 7+ (7.0.3 is the latest). I've got instructions on how to set it up to run at boot, so if you don't have it yet, follow the directions below.
- A user that's going to own the AOLserver installation. I always use nsadmin and create the home directory as /home/nsadmin. All of my instructions will use that, so you might as well too. It should be a normal user, with no root access. You can create users in the LinuxConf control panel.
- A copy of AOLserver 3.x. This can be the source or a binary distribution from AOLserver.com. I'll go over how to build and install AOLserver below.
- The PostgreSQL driver from OpenACS. It's the most mature and provides more features than the one provided @ aolserver.com.
- The nsadmin package @ http://www.scriptkitties.com/projects.html. It provides the old 2.3.3 admin tools and makes managing db content VERY convenient. Instructions for installation aren't provided here, but are in the package.
- A basic knowledge of how to get around GNOME and Linux and use basic terminal commands like ls. I'm not going to tell you how to install Linux, because at this point, that's pretty easy. The Macs are still a pain in some respects, but I'm not going to cover that here.
The Directions:
- Install Linux (no more details than that... you're on your own). RedHat 7 comes with a 7.x version of PostgreSQL, so you don't need to do the next step.
- Install PostgreSQL. If it's not already installed, or is a version older than 7 (like for you LinuxPPC users), go to http://www.postgresql. org and download the latest RPMS. Follow the installation instructions.
- As root, cd to /var/lib and type in: "chown -R postgres pgsql" Next, type: "su - postgres", and hit enter. (the user should have been created when you did the install if it didn't exist already). Then, type in "initdb $HOME".
- Once PostgreSQL is installed, su back to root. Now, in your terminal window, type: "setup". Go to the System Services section and look for postgresql. Select it, the the spacebar then tab to the OK button and hit the spacebar. Quit the tool and from terminal, type /etc/init.d/xinetd restart. That should save you having to reboot and should start Postgres.
- Now that the db is running, and you've set up your default database, you need to create the database that you'll use with AOLserver. So, as the postgres user, go to the terminal and type in "psql template1" and hit enter. That should bring up a command-line prompt. Type in "create user nsadmin with password 'test' createdb createuser;" (don't forget the ;) and hit enter. A CREATE USER message should come up. Now, type in "create user root with password 'test' createdb createuser;" and hit enter. Now, type in "\q" and hit enter. You should be back to your basic command prompt. Now, type in "createdb mydb" and hit enter. You just created the database you're going to use later when we install AOLserver.
- Now that PostgreSQL is installed, we need to set up AOLserver. At the terminal, type in "su - nsadmin" and hit enter. If you're logged in as a user other than root, you'll need to enter the password.
- Next, create a directory called source by typing in "mkdir source" and hitting enter.
- If you downloaded the source distribution of AOLserver, copy it to $HOME/source. You'll also need to copy the Postgres driver you downloaded from OpenACS to the source directory.
- Next, go into the source directory and untar the two files by typing in "tar zxvf FILENAME" for each file.
- cd to the AOLserver directory and type "make install PREFIX=$HOME/aolserver". That will run through a thousand lines of text you don't need to pay attention to. When it's done, cd back to source and then get into the pgdriver directory. Now, you need to open up the makefile. It's easiest to do this through the file manager, but if you want to use vi, go right ahead. You need look for the NSHOME= line and change it to "NSHOME=/home/nsadmin/aolserver" Then, look for the section a little ways down that says "RedHat Linux with RPM PostgreSQL" and uncomment the three lines below it (that means take out the #'s at the beginning of the lines).
- Save and close the file. Now, in the terminal (you should still be in the pgdriver directory), type in "make install". That should throw up a few lines of text. Now, you need to make sure that the postgres.so was copied to the right directory. So, go back to $HOME and cd to aolserver/bin. Look in that directory and make sure that postgres.so is there. If it is, continue.
- Now, we've got everything installed. We just need to configure AOLserver to talk to the db and start up on port 80. If you're running Apache on port 80, and don't want to remove it, you can run AOLserver on any unused port.
- Go to $HOME/aolserver and type in "cp sample-config.tcl nsd.tcl". Why? Cuz I like my config file named that, so there.
- Now, open up nsd.tcl in either gEdit (or any other text editor) or vi. We need to make some changes!! Look for the "set httpport" line. Change that to the port you want to run the server on (80 is what I choose). Next, look for the "set hostname" line. If you have a hostname (and static IP), put that in. If not, put in "localhost". If you don't have a static IP, you probably want to run the server as the localhost so you don't have to go scrounging for your IP address every time you reboot. If you have a static IP, put it on the next line after "set address". If not, to run the server as localhost, put in "127.0.0.1".
- Next, scroll down to the bottom of the file, right above the "Modules to load" section, and paste in the following:
ns_section "ns/db/drivers"
ns_param postgres ${bindir}/postgres.so ;# Load PostgreSQL driver
ns_section "ns/db/pools"
ns_param main "Intranet Pool"
ns_section "ns/db/pool/main"
ns_param Driver postgres
ns_param Connections 20 ;# 5 is a good number. Increase according to yourneeds
ns_param DataSource localhost::mydb ;# Replace 'yourdb' with the name of your database in PG
ns_param User nsadmin ;# User and password AOLserver will use to connect
ns_param Password "test"
ns_param Verbose Off ;# Set it to On to see all queries. Good for debugging SQL.
ns_param LogSQLErrors On
ns_param ExtendedTableInfo On
# ns_param MaxOpen 1000000000 ;# Uncommenting these two cause AOLserver to keep the
# ns_param MaxIdle 1000000000 ;# db connection open. Can be a good thing, up tp your needs.
ns_section "ns/server/${servername}/db"
ns_param Pools "*"
ns_param DefaultPool "main"
- Save and close the file.
- Now, we're ready to see if this works! If you're going to run the server on port 80, you need to su to root. Now, cd to /home/nsadmin/aolserver and then type in "./bin/nsd -fzt ./nsd.tcl -u nsadmin" and hit enter. That command runs the server in the foreground so you see all the logging messages. If you see the line "accepting connections", you're up and running and should be able to open up a web browser and connect to the site. If you're running as localhost, you won't be able to access the site remotely and will have to check it out locally.
- If you can get to the site, you've successfully configured AOLserver.
- If you want AOLserver to run whenever the computer is on, and restart itself if it dies, you need to open up /etc/inittab and add the following line near the bottom right before the xdm lines: "as:235:respawn:/home/nsadmin/aolserver/bin/nsd -izt /home/nsadmin/aolserver/nsd.tcl -u nsadmin". Save the file. As root, go to the terminal and type in "telinit q". That should start AOLserver and you should be all set!