linux, Technology

The Final Guide to WordPress on your Ubuntu LAMP Server

I’ve gone over all the setup and nit-picky details of setting up my own web server. However, the one thing I could never get quite right was my WordPress install.  If you peruse the WordPress (and Ubuntu) user forums, you will see countless examples of people trying to get their permissions set right for one reason or another.  WordPress recommends, rather irresponsibly, CHMODing everying 777.  To compliment that, you should really find a theme with a large header saying “HACK ME.”  The problems range from being unable to upload pictures to having serious trouble with plugins, some of which won’t work at all without (again) CHMODing several parts of your WordPress Install to 777.

I’ve lived for several months with my blog like this…balancing usability with security, and totally unable to use the “Upgrade Automatically” feature in the plugins page.  If you’ve setup your own WordPress Server and worked with plugins much, you know how the process typically goes.  You Upload your plugin to the plugins folder.  Then via terminal, chown -R your new folder to www-data, perhaps chmod 777, depending on the plugin, and then go into your WordPress Admin page and activate.  Time for an update?  Same process.  Such a pain, with nary a solution in sight… at least that I could find on the forums.

The problem lies with this:  your files are uploaded (via ftp, or whatever) under your Ubuntu user name.  Apache owns web processes under the user name and group www-data.  So when WordPress tries to work on a folder owned by your username, it gets denied, because it is trying to work with it as www-data.  To fix this, I attempted to add my username to the www-data group, but that was unsuccessful.  And then I discovered the envvars file under /etc/apache2.  In this beautiful file, is the designated Apache username, www-data.  It looks something like this:

envvars – default environment variables for apache2ctl

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/

Just change the information to match your user name and group for Ubuntu, restart Apache, et voila!  Permissions and Ownership issues are resolved.  Now Apache is working with files under the same ownership and permissions set they were uploaded with.

One important caveat here:  I’m unsure about the security issues with this.  I’m going on the assumption that it is significantly more secure than CHMODing everything 777, and it certainly makes your Ubuntu/Wordpress Web Server much easier to use for upgrade purposes.  Plugins install and upgrade with no hassle now!

Hope this helps all of you with these issues.

linux, Technology

Server Headaches

Over the last… oh… 8 months or so, I’ve been casually putting together a LAMP server to host my blog and personal website on, and give myself access to files from work, etc.  Last week, I believed I had it reasonably prepared for entrance into the World Wide Web.  My CPU then jumped up, slapped me in the face, called me a B!%^#, and attempted to destroy my server.
I forwarded my ports, and nothing worked.  So I decided to go editing config files for Apache.  That was all well and good, until I really screwed something up . . . not sure what.  This led me to uninstall my server programs: Apache, MySQL, PHP, and supporting modules.  I attempted to reinstall, but the computer flipped out everytime.
Several reboots, and some manual file cleaning later, I just wiped the hard drive and resinstalled Ubuntu.  Their sudo tasksel command, which I learned during this process, made the reinstallation of the LAMP server super easy and quick.  I had a little trouble using phpMyAdmin, until I linked it to my /var/www folder, reinstalled WordPress, et voila!  Back where I started.  With ports forwarded, I was still unable to access the server from the web.  I noticed later that I was connected to the IP for my modem, not the USABLE IP assigned to me by my ISP.  I must be honest:  I have no idea what that means.  Hopefully I’ll get the opportunity to call tech support and have them walk me through what to do with those IP addresses.
Anyone know if Apache should be configured past its initial installtion?  Is the server ready to go as soon as the IP address route properly, or do I need to configure apache for my domain?
All of this has led me down a very interesting chain of ideas.  In the coming months, I have a new website that should be launching, and I’m pretty excited about the idea.  It will hopefully be different from other things you’ve been seeing.


All Grown Up: Installing WordPress

Back in years gone by, when I had a respectable amount of traffic, and instigated more than a few squabbles in the blogosphere, (Before InTheAgora ruined 3 separately good blogs), I had a big-boy web server, with for-reals blogging software installed.  A marriage, 2 children, and a lapsed contract later . . . I moved to blogger to get started blogging again.  It was easy, and free . . . and ugly.  But I’ve never been a huge fan.

As a do-it-yourselfer, I like to try new things just for the experience, so several months ago, I undertook the laborious task of setting up my own LAMP server, using Ubuntu.  For the tales of this undertaking, my old temporary blog (pre-blogger, post webhost…confusing I know) tells more about that.  It was easier than I expected, but I really enjoyed learning about the setup and configuration of servers.

With that setup, I’ve never taken the next leap to actually getting a blog setup.  So, last night, I finally bit the bullet, revived my home-grown server, and installed WordPress.  This, unlike the original setup of the server, was actually a bit more difficult than I expected.  Nevertheless, it went quickly.

First of all, WordPress has great documentation.  This helped tremendously, as the instructions for setting up your databases and DB users was outlined in detail for whatever tool you used (phpmyadmin, cpanel, terminal, etc).  It was geared toward people paying for hosting, obviously, as only masochistic crack-tards like me actually attempt to setup their own server.  Right off the bat, I ran into a few problems.

First, by default, Ubuntu has root disabled.  While in the process of trying to find a quick and easy way to move my wordpress files into my web folder, I discovered a new command: gksudo.  During my test of the server, and playing with some php editing, I would create my page in bluefish, then open the terminal, and sudo mv the file to /var/www.  That was fine for single files, but moving every file in wordpress was not something I wanted to do.  Enter gksudo:  Simply hit Alt-F2, type “gksudo nautilus” (in the standard gnome installation, you KDE people would probably use gksudo konqueror), and hit enter.  Up pops the nautilus file explorer, but with root privileges!  Next step…copy and paste, just like any other folder.

After copying the contents of WordPress (I don’t want my blog in a subfolder) to the /var/www directory, it was time to initiate the installation…BUT WAIT!  We have to setup a database for WordPress, and a user!

I had long ago forgotten how to access MySQL via the terminal.  This was something I did just to learn about the commands, which come in handy when coding php to access your database, but I couldn’t even remember how to get into MySQL, and couldn’t seem to make it work (mysql -u root -p ***** gave me a database not found error).  Luckily, I installed phpmyadmin.  This made it relatively simple, however I apparently have an older version installed, so the process was slightly different from the instructions.  It was straightforward enough: create database named “blog.”  Create user named “wordpress” then give wordpress all permissions on “blog.”

Time to install…right?  That’s what I thought…I pointed my browser to http://localhost/wp-admin/install.php and … aaaaaannnddd … error.  Wonderful.  In WordPress’s instructions, they direct you further down the page to find specific instructions for your database tool, but fail to instruct you to go back up the page to find the next step.  It was a frustrating few minutes as I read “Troubleshooting” until it said, “If none of these solutions work, go back up to step 2 and 3 and repeat them.”  WHAT?!  There’s a step 3?!


Back to Step 3:  Change the wp-config-sample file to wp-config.  Then edit it with your database name, username, and password.  There are some other fancy options you can configure, but I left those alone, and it seemd to go fine.

Now…back to install.  It works this time, and I name my blog (The Limitless…I need a new name…but then I’d have to get a new domain…and that’s just too much to think about), it gives me the admin password, which is a confusing string of random characters which I promptly change to something more memorable.  I create a new account for me, and then call myself done!

Over the weekend, I hope to forward my ip to that computer (a task that I’ve been quite confused about) and see if I can access my site over the interwebs!

. . . I am such a geek.


Ubuntu is installed

It didn’t take long at all.  I skeptically reburned my CD at a lower speed, not really expecting that to solve my problems…but apparently looks are not always deceiving.  The way-too-helpful error message was exactly right.  Ubuntu Gutsy Gibbon installed quickly and easily.

Listen.  I can’t count the number of times I’ve formatted my hard drive and reinstalled Windows because my system got slow and buggy.  This was much easier to install than Windows.  I was a bit unsure of the partition options.  I had Suse 9 running on my system, and I wanted to wipe it out and start over.  I selected the option “Use entire hard drive,” but while naming partitions later, it almost appeared to be prepping a dual boot.  But, I trudged on through, determined to give Ubuntu’s user friendly claims a true test.  It did exactly what I had hoped, and totally wiped the hard drive.

I have installed a few programs (games and Bluefish), and it was so easy, I almost didn’t realize that it was done!  And I just can’t get over how well-polished and pretty the UI is.  I think Apple no longer has the monopoly on the “it just works” slogan.  Easy, beautiful…this is the new major player in the open source movement.

I have 2 main comments:

Education games – Tuxpaint is amazing…as are many of the other games that come automatically in the Edubuntu package.  My little girl will love it, and I’m really looking forward to playing those games with her.

Desktop vs Server edition – I’m pretty upset that the special and easy LAMP server package install is only available with the Server edition, which has no GUI be default.  So either way, you have to jump through hurdles to have both.  It seems that the apt-get command will make quick work of this issue with my desktop installation, but I still think it’s stupid to not include it as an option, since it’s the same base OS.  I’m sure I’m not the only standard desktop user who wants to install lamp, and the Ubuntu forums backs me up on that.  So what gives Gutsy Gibbon?  Why do I have to manually install those?  I could at least be an option in the super easy and awesome Add/Remove Programs.

linux, Technology

Ubuntu 7.10: Installation Attempt 1

Well, by the title, you can see that I did not succeed in my first installation attempt.  The installation CD is also a live CD.  Basically meaning that you can run Ubuntu totally off the CD, without installing on your hard drive.  I played with a few features in the live boot.  In short, Ubuntu is beautiful.  It looks like a third major OS, next to Windows and Mac.  It runs smoothly, and is easy enough for a first time or clueless computer user to use.  The installation instructions were in plain English.  Actually, I would say installation was easier than Windows…significantly so.  I believe that a total computer novice could install Ubuntu first time…given that it works right…
…which brings me to my first issue.  An easy to understand an informative error box popped up and explained that I had an error on my CD, that I should reburn it at a slower speed, or move my computer to a cooler area.  Huh?
My computer is cool enough, thank you.  I didn’t have the time to reburn the CD…I will try that.  This is the only negative thing I have to say about Ubuntu thus far.  It looks like an amazing OS, and I’m pretty excited to try out more.