I have a Mac Mini as a web server. It runs Apache and MySQL and today I decided to install WordPress as well.
Here’s the steps I took:
1. Connect to server via SSH and go to a folder where you want to install your blog. In my case it’s ~/Sites/blog
ssh username@hostname
mkdir ~/Sites/blog
cd ~/Sites/blog
2. Download the latest WordPress to the server, unpack it, move the contents of wordpress folder to your blog folder and remove the empty folder along with the archive.
curl -o wordpress.tar.gz http://wordpress.org/latest.tar.gz
tar -xzvf wordpress.tar.gz
cd wordpress
mv * ..
cd ..
rm -r wordp*
3. Edit wp-config.php to include the MySQL settings of database name, user and password you plan to use.
cp wp-config-sample.php wp-config.php
vi wp-config.php
4. Add the domain to /etc/hosts
127.0.0.1 themworks.com
127.0.0.1 www.themworks.com
I have a few virtual hosts in /etc/apache2/extra/httpd-vhosts.conf. Add another one
<VirtualHost *:80>
ServerName themworks.com
ServerAlias www.themworks.com
<Directory /Users/username/Sites/blog>
Options +FollowSymlinks +SymLinksIfOwnerMatch
AllowOverride All
</Directory>
DocumentRoot /Users/username/Sites/blog
</VirtualHost>
Finally, restart Apache
sudo apachectl -k restart
5. Now, configure MySQL. You can use PHPMyAdmin, I didn’t have it so I’m back at terminal
/usr/local/mysql/bin/mysql -u username -p
After entering a password I can execute SQL
CREATE DATABASE blog;
GRANT ALL PRIVILIGES ON blog.* TO "username"@"localhost" IDENTIFIED BY "password";
FLUSH PRIVILEGES;
exit
6. Now it’s time to change the DNS settings with your registrar and when the ping returns the Mac Mini’s ip address go to http://themworks.com and find a fresh installation of WordPress. Pretty easy.
Please let me know if you think I missed something.