Sysadmin Sunday: Updated OAMP: OpenBSD 4.5 Apache MySQL PHP

FYI - There's now a page that covers OAMP for all recent versions of OpenBSD.

It turns out that, just like with OpenBSD 4.4, It's a cinch to get a rock-solid web application hosting environment up and running with OpenBSD 4.5. In fact, the only thing that really changed is the version numbers. Just remember to either run these as root, or preferably add your user account to sudoers.

I'll keep this quick and easy. You can just reference my OAMP walk-through from 4.4 if you want to see some more output, but otherwise you can simply run these commands:

# sets up the path for pkg_add (I usually add these lines to my .profile)
export PKG_PATH
# Installing these two packages will fetch all the dependencies
sudo pkg_add php5-mysql mysql-server
# Copy the sample files into place
sudo cp /var/www/conf/modules.sample/php5.conf \

sudo cp /var/www/conf/php5.sample/mysql.ini \
# Get MySQL started and the default database installed
sudo /usr/local/bin/mysql_install_db

sudo /usr/local/share/mysql/mysql.server start

sudo /usr/local/bin/mysqladmin \
-u root password 'your-password'
# Set apache to start on boot by editing /etc/rc.conf
sudo vi /etc/rc.conf
#(find httpd_flags once editing the file)

# use -u to disable chroot, see httpd(8)
# Launch apache (unless you plan on rebooting when this is done)
sudo httpd
sudo httpd -u
# Set MySQL to start at boot
sudo vi /etc/rc.local
(add the following line to the end)
/usr/local/share/mysql/mysql.server start
That's really all there is to it!

If you run httpd in its default chroot mode, it can be difficult to get some AMP packages running properly due to the location of the MySQL socket and the php configuration. If you run httpd -u, most PHP5-compatible packages should just work with minimal effort.

I have never actually installed Wordpress before, and I got it up and running on OAMP (without chroot) in about 3 minutes by following the Wordpress instructions.

Next Sysadmin Sunday, I'll hopefully cover the things you should be prepared to do in order to run AMP packages in OpenBSD's default chroot environment. I've done it before (whilst working at a startup in 2006) but I'm a bit rusty.

blog comments powered by Disqus