In this article I describe how to install WordPress (WP) on a general purpose webserver.
Before you begin
The assumption is that you start with a perfect FAMP server as described here.
1. Update the ports
# portsnap fetch
# portsnap update
2. Start mysql session
# mysql -uroot -p
Type the password and a MySQL session is started.
Do not end this session, continue with the following commands.
2a. Create WP database
create database mysite;
The name of the database is now mysite, you can change this if you prefer another name.
2b. Create WP database user
create user mysiteusr@localhost identified by ‘secretxyz’;
The name of the user is mysiteusr, you can change this if you would prefer.
You should change the password ‘secretxyz’ in a secret one.
2c. Grant permissions to WP database user
grant all on wpuser.* to mysiteusr@localhost;
2d. Finish the MySQL session
3. Install WP tarball
# mkdir -p /home/www
# cd /home/www
# fetch http://wordpress.org/latest.tar.gz
# tar zxvf latest.tar.gz
# mv wordpress mysite.com
You should change “mysite.com” with the name you prefer.
4. Fix permissions
# cd /home
# chmod -R www:www www
5. Edit httpd.conf – enable configuration virtual hosts
# vi /usr/local/etc/apache22/httpd.conf
Search the line with
and remove the #, so it reads
6. Edit http-vhosts.conf
# cd /usr/local/etc/apache22/extra
# vi httpd-vhosts.conf
Remove the VirtualHost examples (from the first <VirtualHost …> to the last </VirtualHost>.
Type the following lines:
Optios Indexes FollowSymLinks +ExecCGI
Allow from all
AddHandler cgi-script .pl .cgi
AddHandler application/x-httpd-php .php .phtml
6. Restart apache
# /usr/local/etc/rc.d/apache22 restart
7. Make sure www.mymysite.com points to IP of your webserver
There are to ways to finish the installation: the proper way, that makes the website visable to the world. And a non-proper way, to finish the installation quick and dirty.
7a. Proper way: create a DNS A record
Create a A-record for the hostname “www” of your domain “mysite.com” with the value of the IP of your webserver, for instance 220.127.116.11. Please contact the documentation of your DNS-provider for further information. Please note there is a TTL (time to live – delay) and upto an additional 24 hours to take worldwide effect.
7b. Non-proper way: trick with hostfile on your client system
A trick to be able to complete the WP installation and configuration is to add the following line to your hostfile (/etc/hosts for Linux or BSD-like systems):
18.104.22.168 www.mysite.com mysite.com
You shoud replace 22.214.171.124 with the IP of your webserver and mysite.com with your domainname.
Now you have mapped your domainname to the IP of your webserver, either a proper DNS record or the host-file trick, you are able to finisch the configuration.
Please note that your website is only visible from your client now.
7. Complete your WP installation
Start your favorite browser on your client and visit your domain
8. Follow the instructions of WP and you’re ready
9. Check if WP works
Visit your website again from your client
Now you should see a beautiful wordpress home page.
If you didn’t create A DNS A-record your website won’t be visible to the world. Don’t forget to finish this last step as soon as possible. If you did the trick with the hostfile, please delete the line once the DNS record is created. It can cause a lot of confusion later.