Sample Linux Server Documentation
Sample Linux Server Documentation
Christopher J. Pace
Wordpress Documentation
In order to install Wordpress, you must first meet the requirements of the Wordpress environment.
Wordpress requires a common environment called a LAMP environment (LAMP stands for Linux,
Apache, MySQL, and PHP). Although you can use any OS, Linux is the most common Operating
System chosen for a LAMP environment. The requirements for a LAMP environment are simple.
First, you must install the MySQL server. Next, you should install the PHP scripting language,
configured with support for MySQL. Last, you must install Apache, and insert the PHP module into
the Apache configuration.
Installing MySQL
MySQL is available directly from the OpenBSD repository on ftp.openbsd.com. You can use pkg_add
to install MySQL, using the version number reported from:
ftp://ftp.openbsd.org/pub/OpenBSD/3.8/packages/i386/
Pkg_add will also satisfy any dependencies of MySQL. Once MySQL has been installed, follow the
instructions to set the root password for the MySQL database. The root password that I set was the
same as the root password for your server.
Next, you must install PHP with support for MySQL. To do this, find the package named “php-mysql”
from the OpenBSD repository. For instance, this command will install PHP-MySQL:
pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/3.8/packages/i386/php4-mysql-4.4.1p0.tgz
If there is a package conflict (such as an existing version of PHP already installed), remove the
conflicting package by typing:
pkg_remove php4-4.4.1
Next, edit the /var/www/conf/httpd.conf file, and add the following line in the modules section:
LoadModule php4_module /usr/local/lib/php/libphp4.so
It is extremely important to copy that line exactly, as any deviance will result in a failure to start
Apache.
Lastly, you need to restart Apache. To do this, type the following command:
/usr/sbin/apachectl restart
Now, you should have a working LAMP configuration. If you want more information on setting up a
LAMP environment, please read the following tutorial that I wrote:
http://hnsg.net/tutorials/lamp.html
Now, we need to cover installing Wordpress. For the initial installation, instructions can be followed
from the below link:
http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install
To copy Wordpress to another website, several steps are required. You must first copy the source
directory, then you must create the database for the new site (and “install” Wordpress), and lastly you
must enable wildcard DNS lookups.
To copy the source files to another site, issue the following command (assuming that your working, or
current directory is /var/www:
cp -R wordpress sitename
Where sitename is the name of the site that you want to copy Wordpress to. For instance, if we were to
copy the Wordpress site to the site sample.com, we would issue the following command:
cp -R wordpress sample.com
Next, you need to create a new database for the new site. To do this, issue the following commands:
mysql -u root -p
MySQL will then ask you for your root password, which is DFhudf8. Next, you will enter the
following commands in the MySQL console:
CREATE DATABASE sample;
quit;
Next, you need to edit the file sitename/wordpress/wp-config.php. You will need to edit the third line
in this file, from scienceindex, to the name of your database, which is in this case sample. This line
should look like this now:
define('DB_NAME', 'sample'); // The name of the database
Now, you must enable wildcard DNS lookups in your BIND configuration, and you must also enable
your site to function with wildcard DNS lookups with Apache (since Apache is currently setup just to
allow www.domainname.com. To do this, edit the following files:
/var/named/master/sitename.com
For instance, in our example, we will edit /var/named/master/tfqha.com. You then need to insert a line
at the bottom of this file, which will read:
* IN A 127.0.0.1
Next, you must restart BIND. To do this, type the following command:
ps -waux | grep "named"
_syslogd 26381 0.0 0.1 292 548 ?? S 6Apr06 0:02.63 syslogd -a /var/named/dev/log -a
/var/empty/dev/log
root 16904 0.0 0.1 1548 564 ?? Is 1:12AM 0:00.01 named: [priv] (named)
named 2823 0.0 0.6 2368 2724 ?? S 1:12AM 0:03.01 /usr/sbin/named
Next, we will need to “kill” these processes, and re-launch BIND. To do this, locate the process ID
field numbers, in this case 16904 and 2823, and then enter the following command:
kill -9 number
Once those two processes have been stopped, start BIND by typing:
/usr/sbin/named
Lastly, edit the Apache virtual host file located in /var/www/conf/vhosts.txt. Add the following line
after your sitename virtual host entry:
ServerAlias *.sitename.com
For instance, our site virtual host will now look like this:
##BEGINsample.com
<VirtualHost 127.0.0.1:80>
ServerAdmin [email protected]
DocumentRoot /var/www/sample.com
ServerName www.sample.com
ErrorLog logs/sample.com-error_log
CustomLog logs/sample.com-access_log combined
Options +Includes
ScriptAlias /cgi-bin/ "/var/www/sample.com/cgi-bin/"
ServerAlias *.sample.com
</VirtualHost>
##ENDsample.com
Now, you can restart Apache. Restart Apache by entering the following command:
/usr/sbin/apachectl restart
Lastly, you may enable your plugins, and everything should work perfectly.