|
|
|
| Prerequisites |
|
| A Note About Security |
This system connects not only parts of your computer system, but also parts
of your house to the Internet. Therefore, security should be foremost on your
mind when setting this up. As software vulnerabilities are popping up all the
time, you should take the necessary precautions to ensure that there are no
glaring security holes in your system. That includes the procedures I am
listing here. Even if I say "run httpd as 'root'," which I won't do, you should
say "I don't think so" and adjust your setup accordingly. (HINT: Do NOT run
httpd as 'root'!) So, please do a
sanity check as you are installing this system and apply the security precautions
that you feel are adequate.
|
| Testing The Environment |
Before we install the system that I designed and/or wrote, first
we need to ensure the parts of the system work from the command line.
- Install and start the httpd daemon.
This is usually accomplished by typing
"/usr/local/apache/bin/apachectl start" if you
installed Apache in the default location.
Connect to the server from a web browser (preferably not on the
same machine). You should get the Apache "It Worked!" page, unless
you already have a web site set up.
- Install and start PostgreSQL.
I've never installed PostgreSQL from an RPM, so I don't know if
--with-perl is enabled in the default install. If it isn't,
download the source and compile it manually. You need --with-perl
for this to work.
Switch to the unprivileged user account that PostgreSQL will be
running as. This will be something like "su - postgres".
Start the postmaster daemon. If your web server and database server
are not on the same machine, you will need to start postmaster with
sockets enabled. This will be something like "./postmaster -i -d2"
The "-d2" option sets a high level of logging that will be useful
for debugging, but you'll want to set this to "-d0" when you go into
production. Note that this will output to STDOUT. Feel free to
redirect to a file such as "./postmaster -i -d2 > /var/log/pgsql.log".
Type "psql template1" and press [Enter]. You should get a
"Welcome to psql, the PostgreSQL interactive terminal" message and a
prompt that looks like "template1=#"
- Type "\q" to exit the terminal.
- Test the X10.
Plug the X10 wireless receiver module into a wall outlet. Plug
a lamp into it.
The address of the wireless receiver is "A1" unless you changed
the house code. Please note that the lamp must be in the "on" position.
You can flip the switch a couple times and the X10 module should turn
on the lamp. Turn the lamp off, and then on again so the switch is
in the "on" position, but the lamp itself is off (like it is not
getting any power).
Plug the X10 Firecracker module into the Serial A port on your web
server. You can use other serial ports, but to make these instructions
easier, I'm using Serial A. Feel free to change it to suit your needs.
Ensure your web user (probably "nobody") has permission to write to
the serial port. You can do this by adding "nobody" to the "tty" group
in /etc/group, or changing the permissions on /dev/ttyS0 with the
command "chmod 666 /dev/ttyS0" Please note this is a potential
SECURITY HOLE!
Test the flipit program with the command "./flipit -t /dev/ttyS0 flip
A1 on" The lamp should turn on. Turn it off with "./flipit -t
/dev/ttyS0 flip A1 off"
|
|
|