Archive for Tutorials

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 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/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 Installationb 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

Comments

Installing Plone 3.0 on Ubuntu 6.06

Plone on Ubuntu
Plone 3.0.2 on an 32-bit Ubuntu 6.06 LTS ‘Dapper Drake’ LAMP

What is Plone? - Plone is a pretty cool content management system (CMS). Well, I think it’s cool based on some videos and documentation on their site. After comparing a lot of CMS options (including some really expensive closed-source stuff and 2 weeks of developer training on Sharepoint) I’m trying out Plone because a) open source is cool. b) Google people are smart, c) it supports LDAP authentication which I need for my all-M$ work enviro, d) there’s training/conferences/books/commercial support!? available and d) I’ve read some great reviews and CMS comparisons that rated it #1.

That was the good, now the most common complaint: hellish learning curve. Well, if you’re a developer and you’re going to customize beyond the existing system and available plugins. Why? Well, you’ll have to learn some python and the database is the rather obscure Zope instead of MySQL or SQL. In fact, I just read this on 456 Berea St (one of my fav dev blogs) and it gave me the shivers:

And the inital learning curve, even though I was a fairly good python programmer, was insane.

Then again, people told me Perl was insane too and I loved working with Perl. Besides, we’re just playing right now, right?

What is Ubuntu? - Ubuntu is a community developed, linux-based operating system that I use for a web server. ‘Dapper Drake’ is the release name for 6.06 LTS. (Keyword: LTS - long term support). It’s surprisingly easy to install. If you’re bored, geeky and/or have extra VMs or boxes lying around you should try a LAMP install and get your web server up in 15 minutes!

There’s already a Plone From Scratch HOWTO on the Ubuntu Forums, however it is for a previous version of Plone (2.0.5) and uses the apt-get method which I’ve noticed a lot of people in the forums having trouble with. Disclaimer: I do not provide ‘undo/uninstall’ instructions, other than, whip up a a LAMP on VMware and test it first or backup your system. I would welcome uninstall directions if someone who knows what they are doing could provide them.

Doesn’t Plone provide installation instructions? Well, yes. But when I started to read them I got real nervous. What the heck is gcc? libssl? TLS? etc. Those poor geeks at Plone don’t realize how noob noob can be! I tried to find better instructions (for me) at the Ubuntu Forums and instead I found a lot of people having problems trying to install Plone via Synaptic or apt-get instead of using Plone’s instructions. So here ya go.

You should already have gcc, g++, make and tar installed by default, but if you want to be anal do this:

sudo apt-get update
sudo apt-get install gcc g++ make tar

Sidetrack > (Possibly totally unnecessary step!) If you’re a fair server noob like me you have no idea what libssl and readline libraries and development headers are and what the heck is TLS? Google suggests it has something to do with mail encryption. I read some confusing stuff on Ubuntu Forums about RPM and a program called Alien that converts RPMs to DEB packages seemed probably unrelated but like a handy utility to have and so:

sudo apt-get install alien

Download the Plone Installer Package. I saved it in my home folder - it doesn’t really matter where you put it so long as you can find it.

wget -c http://plone.googlecode.com/files/Plone-3.0.2-UnifiedInstaller-Rev2.tar.gz
tar zxf Plone-3.0.2-UnifiedInstaller-Rev2.tar.gz
cd Plone-3.0.2-UnifiedInstaller

Here’s where you have to pay attention. You can do a ZEO or Stand-Alone install. “WTF?” you say? Yeah, well just pick your poison after reading all about it. Me, I’m doing a Stand-Alone as root install.

According to the README.TXT in the installation package my choice of standalone instance installed as root will result in Plone being installed to /opt/Plone-3.0.2 and libz and libjpeg libraries getting built in /user/local. A “plone” user will be added and Zope will be configured to run under that user id. You need to start Zope as root user (via sudo).

sudo ./install.sh standalone

Then a whole bunch of stuff happens. Lots of gcc (compiling) and checking for things (lots of yes and a few no-s in my case). Just wait, watch, hail Mary and knock on wood. This is a good time to read about the rest of this tutorial or creating new Zope/Plone instances if you want to do that. Or just catch up on your RSS feeds and I’ll hold your hand some more ;o)

If you’re real lucky, this is what you’ll see when it’s all said and done:


#####################################################################
###################### Installation Complete ######################
Use the account information below to log into the Zope Management Interface
The account has full ‘Manager’ privileges.
Username: admin
Password: XXXXXXX
Before you start Plone, you should review the settings in:
/opt/Plone-3.0.2/zinstance/etc/zope.conf
Adjust the ports Plone uses before starting the site, if necessary
To start Plone, issue the following command in a Terminal window:
sudo /opt/Plone-3.0.2/zinstance/bin/zopectl start
To stop Plone, issue the following command in a Terminal window:
sudo /opt/Plone-3.0.2/zinstance/bin/zopectl stop
Plone successfully installed at /opt/Plone-3.0.2
See /opt/Plone-3.0.2/zinstance/adminPassword.txt
for password and startup instructions
Ask for help on plone-users list or #plone
Submit feedback and report errors at http://dev.plone.org/plone
This installer was created by Kamal Gill (kamalgill at mac.com)
Maintainers for Plone 3 are Kamal Gill and Steve McMahon (steve at dcn.org)

First, write down your admin password!! Then, check zope.conf to ‘review settings’. I’m not familiar with them, so I just scanned for the port. Found it on line 969 (YMMV), set to the default Zope/Plone standalone install grabs, port 8080.

sudo vi /opt/Plone-3.0.2/zinstance/etc/zope.conf

Use :q! to quit vi without messing anything up

Use netcat to see what ports you have open already. (Netcat comes with Ubuntu install)

nc -z -v -w2 localhost 1-65535

After confirming that 8080 is avail (or changing it in zope.conf if it is not available) continue following directions.

sudo /opt/Plone-3.0.2/zinstance/bin/zopectl start #that last part is an L not a 1, took me a while...

Then go to: http://localhost:8080 (or sub servername for localhost to test from other computer). If you’re lucky AGAIN you’ll see the Zope Quick Start page!! Wahoo! Hii Fiiiiveh to self! Then look at the example site: http://localhost:8080/Plone, and then check out the management interface at http://localhost:8080/manage. Have fun. I hope it was as good for you as it was for me!

BTW: I suggest the Ubuntu Support Forum and Plone Support Forum for help. I am totally new at server administration, I prolly shouldn’t even publish this and I definitely can’t support your lazy arse!

Comments (8)

DRAFT: How To Make Your MediaWiki Private

THIS ARTICLE IS A DRAFT. I still need to smooth out some bumps, and even then any instructions found here are for your information and include no warranty or support. Use at your own risk and all that...

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!

Comments (22)

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.

Comments

Learn Web Design

Web Design is not what it used to be. It’s now a sort of nebulous term that encompasses a LOT of technologies. No matter what sort of sites you plan on designing, I feel there’s no substition for a good understanding of standards-compliant xhtml and css. Of course, it helps if you know some graphics programs too, like Photoshop or the cheaper alternative, Paintshop Pro. Notice I didn’t mention any web design programs…well, I said learn web design not make a website real quick and dirty like.

Here’s some of my advice under ‘Learn Web Design‘ at 43things…a place where people tag, discuss and connect about things they’ve done and would like to do.

Getting started.
A word on web standards.

Comments

How to Start Your Own Blog in 30 Seconds

This post is just some emails I’ve sent and resent. It deserves some editing for flow, but the info is good. Thought I’d put it out there cuase people keep asking! (Following is MHO and YMMV and all those other typical disclaimers)
Here’s an email I recently sent to a co-worker that wanted to start a blog:

Get your blog…if you use one that is hosted elsewhere, you can be
set up in about 2 minutes.
http://wordpress.com/ (they host for you. you can also install the
software on a server yourself, that site is http://www.wordpress.org
and that is what I use)
http://www.blogger.com/start another very popular blogging system.

If you don’t host your own blog, or even if you do, managing photos
is easy and fun with Flickr. In fact, some people use Flickr as their
blog…they just create a “group” and discuss things there or add
really long notes/descriptions to their photos.
http://www.flickr.com/

Once you start blogging, if you meet other bloggers and you want to
keep track of them, instead of remembering to visit a bunch of sites
you can just subscribe to their content using a feed reader (any blog
software you use will automatically generate feeds). Btw, you can
subscribe to the NYT, Seattle-PI and content like that too.

http://www.rojo.com - a new one, I switched from Bloglines.
http://www.bloglines.com - probably a little more stable, rojo is
new, but not as cool!

“I have been told today that I need to set up a blog for [an event] by Monday, and I have no experience in blogging whatsoever. Here are the requirements:

  1. Multiple editors
  2. Ability to make a page template that looks like our site
  3. The ability to redirect the blog URL so it appears to be coming from our own website

Your easiest bet is to go with Blogger or Wordpress. I set up a
Blogger blog for a band many years ago and here you can see it
incorporated into their site with no problems:
http://www.jessesykes.com/notes/index.html

In this case there’s only one author, but they do support multiple authors:
http://help.blogger.com/bin/topic.py?topic=20

The wordpress.com public docs are pretty sparce, but I just logged in
to one I set up in 30 seconds to show people how easy is it (I’m not
kidding about the 30 seconds) and you can set up multiple blog authors
with different levels of authority with the click of the button. In
general I would say the admin area looks almost identical to the one
you install and host yourself:
http://codex.wordpress.org/Blog_Design_and_Layout

I started with Blogger, it’s super easy, and you can always import to
Wordpress later if you wanted. (Most blogs allow export/import so
don’t worry too much about your first choice). You can customize the
look with both but I think that Wordpress offers you more
power/flexability as there are a lot of plugins and documentation on
tweaking it - of course that means more to learn/read too.

There are other choices as well, but I don’t have experience with them
(except for MovableType, which I didn’t care for in comparison).

It’s is seriously so easy to set up…you should try both and see what
you like better and what looks easier to adapt to your site.

Oh, for the record, typepad is very popular as well. And to clarify, wordpress.com (hosted) is to wordpress.org (you install on your own server) what typepad is to movabletype.

To expand on why I prefer Wordpress to Movabletype/Typepad, all the following are true of Wordpress:

  • All services are completely free, the software is completely free.
  • It’s easier to install on your server (if you go that route - it was way easier for me anyway…)
  • Wordpress is supported by a huge and rabidly enthusiastic community - this equals free support and hundreds of cool plugins that you can use to extend and customize your blog.
  • Movabletype may have improved since I used it, but I must say, since the release of Wordpres 2.0 and the Askimet plugin (installed by default), I have virtually no blog spam. If your blog ever gets hit you’ll understand why this is so important!

Comments

Complex CSS Dynamic Lists

A List Apart offers yet another excellent dynamic list tutorial. As usual, it is an in depth, yet easy to follow tutorial that covers all of its bases, going so far as explaining why they don’t use Ajax for this particular trick (a usability consideration). The result of their demo isn’t exactly sexy - but I could imagine it working beautifully for a very tight, symmetrical site structure.

Comments