skyBuilders timeLines GNU/Linux/Apache/PHP/PostgreSQL HOWTO Add Additional Sites
Interesting links (in no particular order):
RedHat
The GNU Project
The Apache Software Foundation
The Comprehensive Perl Archive Network
PHP Hypertext Preprocessor (documentation)
PostgreSQL (documentation)
Open Secure Shell
The National Institute of Standards and Technology
WebMin
To add an additional site:
- Create all DNS records for the domain
- Create a new postgres user for the site
- Create a new postgres database for the site
- Create a new directory for the site
- Download the timeLines application software, untar it into the site directory
- Create a virtual host entry for the site in the apache (or ssl) configuration file
- Run the timeLines Installation script
Create all DNS records for the domain:
Create DNS Forward Zone file and Reverse Name Records on all appropriate name servers. If skyPipes is involved, make sure that zones and records for the nonroutable space are also created.
Create a new postgres user for the site:
- Get to a shell as root
- Run a shell as the user postgres (the postgresql administrative user).
# su postgres
- Create a new database user. The name of this new user should correspond to the fully qualified domain name of the site that the database will be supporting, subtituting underscores for the dots. For example, if your domain name is "www.example.tld", the corresponding user name should be "www_example_tld". This should also be the name of the database. Permissioning restricts users other than the admin user "postgres" to connect only to the template database "template1" and to the database with the same name as the user.
The command to create a postgresql user is createuser
. It looks like:
bash-2.05a$ createuser <options> <username>
The options that should be used in this case are:
-d = user is allowed to create databases
-P = the command will prompt for a password
-A = user is not allowed to create users
Using our example:
bash-2.05a$ createuser -d -P -A www_example_tld
- The password for the new user will now be prompted for. This should be another equally secure password, preferably different from the postgres user password, especially if there will be multiple timeLines installations on this machine. This password will be required by the timeLines installation script later in order to initialize the database and enable the application.
Enter a password for user "www_example_tld":
- The password will be challenged for a second time for confirmation.
Enter it again:
- Finally the postgres admin password will be asked for, to authorize the new user. Enter the postgres admin password.
Password:
createuser
should reply CREATE USER
The new user has now been created!
(man createuser
for details, man dropuser
for deleting users, and ALTER USER from inside psql
to change settings for a user)
Create a new postgres database for the site:
-
Exit the postgres shell to get back out to the root shell.
bash-2.05a$ exit
-
Connect to template1 as the new database user. You will be challanged for the new user's password. (Notice that the terminal prompt ends with a ">" rather than a "#", to show that you are not a superuser (postgres).)
# psql template1 <username>
-
The
psql
command will now challenge you for a password. Enter the password for the new database user at the prompt:
Password:
Upon authentication, the postgresql interactive terminal will open, allowing database queries:
Welcome to psql, the PostgreSQL interactive terminal.
Type: copyright for distribution terms
h for help with SQL commands
? for help on internal slash commands
g or terminate with semicolon to execute query
q to quit
template1=>
-
Create the database for this user, named with the new user's username. Ownership of the new database is automatically assigned to its creator. The terminal should respond "CREATE DATABASE".
template1=> CREATE DATABASE <username>;
Using our example:
template1=> CREATE DATABASE www_example_tld;
-
Connect to the new database. This will confirm its existence.
template1=> c <dbname>;
The terminal should respond You are now connected to database <dbname>.
The database for this timeLines installation has now been created!
-
Exit the psql terminal to return to the root shell:
www_example_tld=> q
Create a new directory for the site
- Navigate to the directory above the default web root (in this case "/var/www/html/"):
# cd /var/www/
- Make a new directory using the fully qualified domain name of the new site (in our example "www.example.tld").
# mkdir www.example.tld
- Move into the new site directory:
# cd www.example.tld/
Download the timeLines application software, untar it into the site directory
-
Download the installation archive file (currently ~2.3MB) from downloads.skybuilders.com using the command
wget
(or your favorite http download tool).
# wget http://downloads.skybuilders.com/skylatest.tar.gz
The wget
command will output the progress of the download. Wait for it to complete.
- Decompress the installation archive into the the new directory. All necessary application server pages, directories, and image files will now be in place.
# tar -xvf skylatest.tar.gz -z
The tar
command will output the name of each file it extracts to display its progress.
-
Permissions must be set on the application directory. Change the group setting for the site directory (recursively, for all the files and directories below it).
# cd /var/www
# chown -R apache:skyApp www.example.tld
-
Set permissions for the site directory (recursively, for all the files and directories below it).
# chmod -R 770 www.example.tld
Create a virtual host entry for the site in the apache (or ssl) configuration file
- Open the file /etc/httpd/conf/httpd.conf for editing using
emacs
or your favorite editor:
# emacs /etc/httpd/conf/httpd.conf
- Add these lines to the virtual servers section (substituting the appropriate machine name and domain name), with an extra VirtualHost section for each timeLines installation:
NameVirtualHost *
<VirtualHost *>
ServerName example.tld
ServerAlias www.example.tld
DocumentRoot /var/www/www.example.tld
AddType application/x-httpd-php .php .php4 .php3 .phtml .html .xsd .xml .rss .rdfs .rdf
</VirtualHost>
Note: Apache 2.0.40-8 (RedHat 8.0 distribution) does not currently support the IP wildcard, '*' in the example above. This version requires IP number(s) to entered directly into the httpd.conf entries for NameVirtualHost and VirtualHost entries.
- Save the file
- Restart the web server
httpd
.
# service httpd restart
Run the timeLines installation script
This script will build the new database's schema and populate it with initial data.
- Open a timeLines-compatible browser (Mozilla > 1.1, Netscape > 4.0, Internet Explorer > 4) and navigate to the following URL (where <domain name> is the domain name of your new site):
http://<domain name>/timelines/Install.html
timeLines will now challenge for the database password for the new site (as set in the section Create a new user in postgres). Initialization should take around two minutes.
skyBuilders timeLines installation should now be complete!
Please report any bugs at our interactive Bug Report. Thank you.