All posts by mahalie

Drupal 5.x on Ubuntu LAMP

The quick and dirty dev install of Drupal on Ubuntu

USE THIS INFORMATION AT YOUR OWN RISK. Any information found on this website is offered only as informational and includes no warranty, guarantees or support. The author claims no authority on any subject whatsoever.

Why Drupal, Why Ubuntu?

For me it's all about community. I've always enjoyed apache web development in part because of the active and helpful user groups, forums, irc channels, etc. I use Ubuntu as the operating system for my LAMP because it's really popular right now - it has a very active forum and pretty good documentation. Drupal is an open-source content management system, or you could look at it as a framework since it was built to make it easy for coders to override almost anything it does without hacking the core. This means you could make it do anything you want if you happen to be good enough at PHP and still take advantage of core development and security updates no matter how much you modify the product.

Why write installation instructions?

Good question? Well, the installation instructions at Drupal.org are good but they cover all sorts of environments (who wants to slog through all that?) and those in the Ubuntu Community Docs are great and pretty specific but cover Drupal 4.6.7 and 5.1. I probably should update the docs at Ubuntu, perhaps I will after I hash it out here and after a few people let me know they worked or what to change. Also, I like to search for instructions specific to my situation whenever I approach a new installation. It's good to see what other people in similar circumstances have encountered, I call it due diligence. I would suggest any user doing this install review the documentation mentioned above thoroughly. Also see related links at the end of this article.

Environment

These instructions don't cover the setup of your server environment. Mine happens to be:
  • Ubuntu 6.06 LTS server
  • Apache 2.0.5.5
  • PHP 5.1.2
  • MySQL 5.0.22

Get Drupal

wget http://ftp.drupal.org/files/projects/drupal-5.7.tar.gz
tar -zxvf drupal-5.7.tar.gz

I'm a big fan of apt-get but there were a lot of issues in the forum started by people having problems with Drupal in the repositories. Community Docs recommend getting the latest package from Drupal.org, right now that happens to be Drupal 5.7. (Drupal 6 is out now as well, and is very cool, but CCK/Views aren't ready for prime-time and I'm installing for the purposes of following tutorials written for 5.x.)

Move Drupal

sudo mkdir /var/www/drupaltest
sudo mv drupal-5.3/* drupal-5.3/.htaccess /var/www/drupaltest
sudo mkdir /var/www/drupaltest/files

My apache install is pretty much setup to default config. /var/www is my web root, yours may vary. Because I'm just using this particular install as a test which I plan on destroying later I'm going to put it in the boring old subdirectory 'drupaltest', actually I named mine d57_test_01 but thought drupaltest would be more comprehendable in the example.

In the mv command we explicitly move .htaccess because it's a hidden file.

Database Setup

mysqladmin -u root -p create db_drupaltest
mysql -u root -p

Create the database for Drupal to use - you can replace 'db_drupaltest' with whatever you'd like to call the database. You'll need to enter your mySQL root password. If you get an access denied error make sure you're using the mySQL root password and not your login or Ubuntu root password. The second command puts you in mySQL monitor, the command line interface for managing your MySQL server. The commands in the next code section are SQL. You could also run this in phpMyAdmin if you'd rather have a GUI.

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON db_drupaltest.* TO 'drupal_usr'@'localhost' IDENTIFIED BY 'secretpassword';
FLUSH PRIVILEGES; \q

Change the datebase name, the username 'drupal_usr' and 'secretpassword' to whatever you like. Just don't forget to write it down somewhere safe because you'll need to know it later.

Edit Settings.php

sudo vi /var/www/drupaltest/sites/default/settings.php

Using vi (or whatevs) change the $db_url line. Note: If you use a fancy charcters or dashes in your user, password or database names replace them URI hex encodings, this is detailed in database settings comments section in the settings.php file.

$db_url="mysql://drupal_usr:secretpassword@localhost/db_drupaltest";

Up Your PHP Memory Allocation

If you have a new LAMP install the default memory setting for scripts is 8M. This is redonkulous and Drupal will suck. Look for the 'Resource Limits' section and change memory_limit to 32M and then restart apache.

sudo vi /etc/php5/apache2/php.ini sudo /etc/init.d/apache2 restart

Final Steps

Go to http://localhost/drupaltest/install.php (or your servername instead of localhost if DNS is setup). You should see this:

Screenshot of Drupal Installation Message

One last thing, if you click Administer you will probably get a 'one or more problems were detected' error message. Two things: your files directory isn't writable and you cron job hasn't run. The first one is easy - just make the files area writable by all:

sudo chmod 777 /var/www/drupaltest/files

As for cron, you can just click 'run cron manually' on the Status report page - but you'll need to do this anytime you want to update the index. For a quick dev install you're likely to trash soon it may not be necessary but for a production or long-term dev install you'll want to set up a cron job to hit http://localhost/drupaltest/admin/logs/status/run-cron every few minutes depending upon your site's traffic and requirements. See Configuring cron jobs in Drupal's Getting Started guide for more.

That's it. Good luck folks, now enjoy surfing the Drupal learning curve...heheh.

Related Links

Kill is Your Friend

Ah, slowly I am earning my beans in Ubuntu land. Tonight I had my first legitimate need to use kill and even found out what a PID number was and EVEN read my LOG FILES!! Wow. If you’re just learning Apache admin stuff and just can’t reload or restart your web server, head on over to /var/log/apache2 and check out your error.log file. You prolly shouldn’t randomly kill .pids but if you’re getting a repeated httpd error like mine: “httpd (pid 5347?) not started” it could be that the server was manually shut down (oops, old Windows debugging tactic) and the process just needs to be murdered.

kill 5347

Worked like a charm. Another hint for you fellow newbs…maybe reading an Apache admin book would actually SAVE you time, eh? All I needed to do to enable my dern rewrite was to change AllowOverride None to AllowOverride all in my sites-enabled config. Hmmm….I bet a quick doc on configuring sites in Apache2 would have saved me all that. But then I wouldn’t have ever found out how to kill stuff on linux…so then again, maybe it was all worth it.



Awesome drawing by pure evil bunny on Flickr.

Website Contact Pages

Contact Page vs. Mailto Link

Oh the contact page. So boring, so obligatory. And not as simple as it may seem. I was hoping to jazz up the contact page at BuildCarbonNeutral.org with some sort of slick Ajax contact form. You see, I built the site in a really big hurry could spare not time for extras like protecting raw email addresses. By the way, email address protection is not an extra, usually! It’s something I meant to rectify as soon as possible and sure enough, our general contact alias is already receiving spam. I thought I might take the email address off completely and post a contact form instead.

The Problem with Contact Forms

Even the best form is an obstacle. Users don’t like filling out forms and what’s more, you introduce an opportunity for error. Everyone commits a typo now and again, and what if someone sends you information you’d really like to follow up on but lo and behold, their email address bounces. Even if you add the extra email confirmation input (make the user enter it twice), there’s still the case of people using an incorrect email address just to harass you. But really it all comes down to user experience. Don’t make your user fill out a form if they don’t have to.

The Simple and Sincere Mailto Link

So it’s back to the good ‘ol mailto link for me. The added benefit is people can save the email address in their contact list of choice and can format the email and send attachments if they choose. An email link is more personal, less corporate. Of course you all know that any email address present in the code of a public website is crawlable by spambots. Therefore be sure to put measures in place to protect all email addresses!

There’s Always an Exception

Sometimes you really should use a form. A common use for them is on high-traffic sites where they actually want to make it a little harder for users to get in contact. This approach is especially prevalent on sites that offer a product or service that results in a lot of support email and they want to encourage users to troubleshoot their own problem using existing documentation (FAQs, support forums, etc) before contacting the company/authors directly. Some sites don’t provide contact info at all for this reason. Chances are though, if your site is for a small business or is personal, you want to make it easier for people to contact you.

Don’t use Main Street Host for Web Hosting!

Someone just called me at work about “Main Street Host Dot Com”. Now, whether that’s mainstreethost.com or main-street-host.com or mainsthost.com, whatever. They telemarket, so they obviously can’t make money by offering good/fair service. Don’t use them. And as long as I’m on a rant about crappy web hosts, if you want to procrastinate whatever it is you’re doing and have a laugh read this account of Lunapages misguided insertion of link farms on their customers’ 404 pages. The comments become puerile and ranty. In fact, I haven’t seen such childish bantering since 1996 bbs flame wars.

2009.03.09 Update Since this rather random little post continues to get a lot of traffic and comments, I thought I’d offer some useful links on SEO [via Lifehacker 2009.02.28]

2009.10.26 Update I have noticed that a lot of the relatively few pro-MSH and most of the name-calling rude comments are coming directly from mainstreethost.com IP addresses. I try to occasionally post their IPs publicly when I find this. Note however, it’s very easy to use a proxy server to fake your IP address so any comments could be by MSH employees and I would not be able to trace it. I am not saying they have zero happy customers, but I would caution that based on simple statistics so far, to use a healthy dose of skepticism while reading the following comments.

2011.08.03 Update Officially closing comments on this post. Some other blog will have to carry the torch as a place for the continually disgruntled customers and near-customers of Main Street Host to kvetch.

If you are looking for a web host recommendation, check out my post What Web Host Should I Use?. Though written in 2006, I still use and recommend Dreamhost (for shared hosting). Good luck!

How To Make Your MediaWiki Private

USE THIS INFORMATION AT YOUR OWN RISK. Any information found on this website is offered only as informational and includes no warranty, guarantees or support. The author claims no authority on any subject whatsoever.

I've been using an amalgamation of hacks to track all the information I want to be able to recall later: del.icio.us for bookmarks, gmail for contacts and random notes, private blog entries for some organized content, and tracks for tracking projects. Blech. It's just too much. My memory is too weak. What I really want is a comprehensive PIM (Personal Informatio Manager). And so I installed MediaWiki because that's what Wikipedia uses and that's what Dreamhost offers as a One-Click Install (e.g. the path of least resistance).

I thought I'd share with you all the the process of customizing the default install to create a private wiki. Following are the specifics to my install but this will probably be helpful to many with a different host or newer version.

  • Create a subdomain for your MediaWiki install, such as, wiki.yourdomain.com. Select PHP 5.x (not 4.4.2) and leave Extra Web Security.
  • Install MediaWiki. Dreamhost walks you through this and it's also covered at the Dreamhost Wiki so I'm not going to go into detail here. But be sure to move the newly generated LocalSettings.php to the parent directory, and delete the config directory with its content.
  • Chmod LocalSettings.php to 600
  • Create a backup copy of LocalSettings.php, rename it something like .BAK instead of .PHP or something. Put it back in your Wiki install directory right away so it's safe and available if you need it later.

Restrict Wiki Access

Before bothering to put up our own cute logo or other fun stuff like enabling image linking and using clean urls, we're going to lock down our install. I didn't find a lot for this particular intent on the official MediaWiki Docs or the Dreamhost Wiki, but I did find this old Meta Wiki Article

  • Prevent new user registrations. Add the following line to the bottom of LocalSettings.PHP:
    # This snippet prevents new registrations from anonymous users
    # (Sysops can still create user accounts)
    $wgGroupPermissions['*']['createaccount'] = false;
  • Make sure it's working by trying to create an account. You should receive an error message that says username not found, please create an account. To change the message login as yourself (you should have set up a Sysop login when you configured your wiki) and point your browser to wiki.yourdomain.com/index.php?title=MediaWiki:Nosuchuser&action=edit.
    I changed my message to:
    There is no user by the name "$1". This wiki is private and therefore closed to new accounts. Please contact Mahalie if you have any questions.
    I intentionally failed to provide contact information. If a user doesn't even know how to contact me, they really don't need an account on my private wiki!
  • Prevent anonymous users from reading by adding the following to LocalSettings.php: # Disable reading line, for anonymous (not-logged-in => * ) :
    $wgGroupPermissions['*']['read'] = false;

    # ... and enable anonymous to read the followings pages :
    $wgWhitelistRead = array( "Main Page", "Special:Userlogin", "-", "MediaWiki:Monobook.css" );

    # ... same in an other language (French, with one UTF-8 special characteres) :
    # $wgWhitelistRead = array( "Page Principale", "Special:Userlogin", utf8_encode('Aide en français'));
  • Verify setting by logging out of your wiki and attempting to browse. You should get a 'Login Required. You must login to view other pages.' when clicking on any local link and the page should redirect to the main page after a few seconds.
  • If you want to hide the side navigation if the user isn't logged in (because, perhaps you have private project names or something) edit includes/Skin.php and change the function buildSidebar(). Add these lines near the very top, after the globals.: global $wgUser; if (! $wgUser->isLoggedIn()) { return array(); } This will hide the navigation on sup-pages (not the default main page)

p.s. WebWorkerDaily just published 15 Productive Uses for a Wiki in case you're wondering why someone would want to do this!

Update: Check out a new tutorial on Lifehacker, Customize Mediawiki Into Your Ultimate Collaborative Website - it's not a PIM implementation but it offers some good information on quickly re-skinning and mods to consider.

Grok?

I have a geek confession. I always thought grok just came from Unix. Oh no, I’m a dork, not a geek! How embarrassing….

The word “grok” comes from Robert A. Heinlein’s Zen-hippie science fiction opus Stranger in a Strange Land. It’s a verb from the Martian language that means something along the lines of “to understand completely.” To grok something is to achieve a deep, intuitive comprehension of it. – How to Grok Web Standards by Craig Cook on A List Apart

Web 2.0 – When is enough enough?

Ong Bak fan site on FanPop
Screenshot of the Ong Bak fan portal on FanPop!

I have internet ADD. I try every new web 2.0 app out there – I have a good spam filter (gmail) and I always use the same password and the my username of choice is never taken so I don’t hesitate to try out a new website. I recently stumbled upon the Ong Bak spot I started on FanPop! when they were first accepting beta memberships. FanPop! is a site where you can find existing ‘spots’ for things you are interested in or start your own if it doesn’t exist. Each spot is a user community dedicated to a specific topic where people can go to find and share related information. Because the site offers RSS feeds you can subscribe to the content and always be in the know when someone posts something about what interests you.
I’d totally forgotten about my ‘spot’ and the site altogether, but a few users had posted some interesting Ong Bak related links so I decided to subscribe to the feed and look up a few more topics.
We’ll see how many of these sites earn a permanent spot on my feed list. The problem with all of these user-contributed social sites (much like 43things/people/places) is that there are so many sites like them vying for attention and not enough aggregation.  Studies have shown that for all the Web 2.0 community-driven sites out there, the vast majority of traffic is comprised of non-participators/spectators and the content is contributed and driven by a tiny percentage.  These sorts of people are also likely to have blogs and as the author of three blogs and frequent user of web applications flickr, digg and 43places, I can personally attest to how spread thin I am with my time and attention.

While each of these and hundreds of other sites have amazing potential that I could explore more deeply, there’s just too darn many. For instance, if I really like a restaurant and want to share my enthusiasm there are scores of places I could post a review – so how do I choose? Well, personally I choose my own blog first because I know the content will always be there and I can find it later, but because only my friends read my personal blog, I might post it on 43places because I like and use that site. But I kind of want to post it to CitySearch so non-geeks can find it, what about Yelp?, Epinions? Oh, I could post the review with a photo on Flickr, a lot of people are using Flickr as a blog these days. The list goes on and on, and on!

At what point are there too many user-contributed websites and not enough contributers? Too many content receptacles and not enough content?
What’s Web 3.0 going to look like? Web-based office…maybe. Productivity, I believe, and relevancy are definitely going to be major themes as we all struggle with the information overlap and overload.

Something I’d like to see is an easy way for people to customize display of, input and then push out content. I’d love to be able to just open up my WordPress admin panel, through it, upload my photos to Flickr, have them all link back to the post they originated from, push out the post as a comment or review of various sites like 43places or Epinions, etc. Because, like I said, I have internet ADD, I don’t necessarily want to pick my battles, but these days I have to!

Keyboard Lust

Okay, I still want dasKeyboard. Now I want one even more, in fact, because they’ve come out with a new and improved version. But there are a couple other keyboards that look pretty sweet – the Combimouse and the TypeMatrix EZ-Reach 2030.

The EZ-Reach 2030 moves the important shift, enter and backspace keys to the center, where your strong fingers are. Not only can you order it with DVORAK layout, but there’s a button to switch back and forth to QWERTY. (Great if you share the computer or are not sure about switching.) It is totally flat, which can be good or bad – I personally find skinny flat keyboards a little uncomfortable, but the good news is you can put it right on top of your laptop keyboard.

Combimouse keyboardThe Combimouse is, like it sounds, a combination keyboard and mouse, basically splitting the keyboard in two and allowing the right side to function as a mouse as well. I love the concept, however, it’s not in production yet, I probably would want to wait for a second generation product and the keyboard inflexible for other mods, like layout changes not to mention the inability to switch mouse hands, which I do periodically to spread the click-impact load.

Yep, dasKeyboard is still the front-runner…I have some hesitations though. For one, I’ve been on a spending spree and just purchased Clocky, an alarm clock that runs away from you after one snooze, this morning. Also, it hasn’t been featured on Cool Tools yet (how great can it be?!?). I also want to read more reviews…but I’m willing to gamble at such a potential productivity boost. Maybe I can do a quick side-job to fund my gadget wish list…anyone need a WordPress install customized for their business? Or maybe you want to get me one (it’s on my ThinkGeek wishlist).

Das Keyboard by Flickr User polyG0o

Related posts: Blank Keyboard on mahalie.com, The Combimouse on Engadget, Top 5 Creative Keyboards on Tech E Blog.

Killer Keyboard Skillz

I remember when I first met my boyfriend Tim, he impressed me by alt-tabbing and exporting paths from Photoshop to Illustrator. I was mesmerized by his Illustrator work flow: no visible tool bars, full screen mode. He was a keyboard master. Then I saw his desktop and realized he was an application-savant. Still…the impression was made during that critical get-to-know you phase.

Get L337 skills that impress the geekiest of your friends by becoming a mouse-free keyboard Jedi. Not only is it cool, it’s a major productivity booster.

Here’s some links to get you started.

Hack Attack: Become a Gmail Master

Now, don’t go off and try to learn everything at once! Unless you have an amazingly spongy memory it will be a waste of time. I usually learn a couple at a time by writing them on a post it and sticking it to my monitor. Once I have them down, I find new ones. The key is to actually use the shortcuts…force yourself, it’s harder than you think to start breaking the mouse addiction. It will feel awkward. But once you have, you’ll feel liberated.PDF of Firefox browser's keyboard shortcuts

I’ve got the basics of most my apps down, so now I have a cheat sheet for Firefox Shortcuts pasted to my monitor. Here’s a pdf of it, it’s a tri-fold that will eventually have a section for Gmail shortcuts and one for my macros and custom shortcuts in my text editor and various IDEs.

And once you’ve learned all the keyboard shortcuts you need, it may be time to take it to the next level and use an application like Hotkeys (freeware) that extends windows keys shortcuts.

Top 10 Web 2.0 Apps

Seth Godin posted a great list of 937 Web 2.0 applications ranked by traffic (according to Alexa). I compared it to my top 10 (most used and most loved):

  1. Flickr – photo site, browse photos and store your own
  2. WordPress – blogging platform either on your own server or theirs
  3. Gmail – Google’s web based email client
  4. Wikipedia – free community-written encyclopedia
  5. Google Reader – I started with Bloglines, then Rojo, but Reader is the best!
  6. Del.icio.us – Find your bookmarks no matter what computer you’re using, it’s a great discover tool as well as you can search other people’s bookmarks. I love the Firefox plugin as it works better than their default web interface.
  7. JetEye Jetpacks – I use this as a Firefox add on as well, although there’s a regular web interface so you can access your ‘packs’ any time. It’s like del.icio.us but you can save just an image, an excerpt of text, a movie and your own notes and package them into packs which can be shared with others – see my ‘Shoes I love‘ collection.
  8. 43Places – read and write reviews of places from Fremont to Dhaka, India. I use 43people and 43things too, but not as much.
  9. Google Maps
  10. Myspace

I use everything on this list daily, except for myspace. I hate myspace, but I must acknowledge it’s extreme power. The UI is horrible. Everything requires multiple clicks, I constantly run into error messages, what they allow their users to do to their pages is almost as bad as the ads that do anything but grace the screen. Myspace is not a site you want to be seen looking at at any respectable workplace. Yet I also love Myspace – because so many people use it. I have three friends including my 11-year old neighbor (*ahem* I mean 14 yo) who I’ve communicated with more in the last 4 months than in the last year, easily. It’s cheesy, it’s silly, it’s scary, but it’s also infectious. I actually don’t use it very often, but if I want to get a hold of certain people, it’s the surest way.
Related:Web 2.0 for designers.