How I set up Greymatter for Weblogging

How I set up Greymatter for Weblogging. First things first: I’m sure everyone’s asking how much hardware you need. I’m using a Pentium-120 with 64 megs of RAM, and it’s plenty fast most of the time. It takes a little while to regenerate all the templates, but other than that it’s mostly sitting idle. Any Pentium-class machine should be plenty. I’d be hesitant about using a 486 because the templates will take an awfully long time to rebuild. Remember, Greymatter’s written in Perl, and Perl’s an interpreted language. Interpreters are slow for the same reason emulators are slow–the translation is real-time.
But Greymatter offers advantages. You can control your destiny. You have total control over your site–it’s running on your Linux box. And you’re free from FrontPage’s tyrrany. Did I hear cheers? Most importantly for me, I set the clock. I can set the clock ahead a couple of hours, make my post at 10 p.m., and it’ll be dated the next day. That can only mean… The return of the infamous Farquhar Time Machine. I can start sleeping in again! Or go to work earlier… Hey, I can start sleeping in again!

Anyway, I had the Pentium-120 already configured with Mandrake 7.2, but I discovered Mandrake 7.2 in high security mode doesn’t seem to allow Web traffic from the outside world. So I installed Mandrake 7.2 again in low-security mode. I used a server installation. The only things I really cared about were Apache and Perl, but I didn’t feel like de-selecting everything. Both will be in there by default. I think Perl’s part of the Development group during installation. I’m not sure what group Apache is in. I don’t recommend running XFree86 on your server. Those memory resources are better used for server purposes. Oh, and one last thing: Don’t use DHCP. Give your Web server a local, static IP address.

Once I was up and running, Apache wasn’t running by default, so I dinked around with a cp /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S45httpd so that Apache would start on boot. Then I started Apache by executing /etc/rc.d/rc3.d/S45httpd start. Of course there are plenty of other ways to accomplish the same thing. It was close to midnight and I just wanted the thing open to the world at that point.

Then I pointed my Web browser at the server’s address, and my embryonic Weblog came up.

It won’t happen that way for you, because I already had Greymatter installed and configured before I did all that. In other words, I did things bass-ackwards. You should do it differently. Get Apache working right first. It’s less frustrating that way.

With Apache installed and running, point a Web browser at it. You should see some kind of Apache welcome screen–it’ll vary based on your Linux distro, but it’ll basically be some kind of show-off screen. You see it? Great. You don’t? Get Apache working. How? I dunno. Make sure it’s running, first of all. Type the command pidof httpd. You should get a couple of numbers. Maybe a lot of numbers. If all you get is a blank line, then Apache’s not running. If it’s running but not responding, you’ve probably got a problem with the configuration file. The default configuration file for Apache, unlike the default configuration of a lot of programs, does work reasonably well. The defaults will certainly do for a Weblog. Start with the default config, get it working, then get fancy later.

Working? Great. Open up port 80 on your DSL router and point it to your server’s address. Don’t expose any other ports. This improves security immensely. Now go to www.grc.com and run Shields Up!, then Probe My Ports. Port 80 should be open. If it’s not, either your Linux box is too secure (I wish I could offer some advice there but I don’t know much about un-securing a Linux box) or your router’s not forwarding the port right.

By default, in Mandrake at least, Apache puts its HTML files in /var/www. So, first, clear out /var/www/html. Next, I put all of the Greymatter files in /var/www/cgi-bin. Then I created directories named Archives in both /var/www/cgi-bin and in /var/www/html. The documentation is pretty good about what files need permissions of 755 and what needs 777 (yuck!) and what needs more restrictive settings, like 644 or 666.

As an aside, the archives directory being chmodded to 777 makes me nervous. That means that if I install Greymatter to a server that shares space with someone else, the entire world can see that directory. They can’t manipulate anything inside there as long as the files inside have more restrictive permissions, but I always cringe every time I see anything with 777 permissions. I knew people in college who’d just chmod everything to 777 because then it meant everything just worked all the time. Unfortunately, anyone who had telnet access to the machine could then go into that directory and change anything. I’m not as concerned about that, since I don’t share this PC with anyone. But 777 still doesn’t give me warm fuzzies. Unix ain’t Christianity. In Unix, 666 is ok (but 644 is much better), and 777 is a hacker’s delight, and therefore, pure evil.

After you chmod all your files, assuming your server is at 192.168.1.2, go to http://192.168.1.2/cgi-bin/gm.cgi. Greymatter should pop up. Go to the configuration screen and run down the line:

Local log: /var/www/html
Local entries: /var/www/html/archives
Local CGI: /var/www/cgi-bin
Website log path: /
Website entries path: /archives
Website CGI path: /cgi-bin

Set the other stuff the way you want it. Now hit Save Configuration. Now, immediately run Diagnostics and Repair. This will ensure that all files are where they need to be and permissions set correctly. If it can’t find something, do what you have to to satisfy it.

Now you’re ready to start editing templates and adding entries. You’ll need to exercise your HTML skills for that, or rip off someone’s templates. I didn’t look too hard, but I’m sure there are people out there offering Greymatter templates. If you have to, use an HTML generator to draw what you want, then take the code and put it in the template. I know HTML, so I coded mine by hand. That’s why they’re still sparse. The basic layout is there; I need to flesh it out. And I haven’t entered every template yet myself.

Now, for backups and stats… Backups are easy. I use the command tar -c /var/www >/home/dave/backup.tar. It only takes a second. You can compress the tar file and throw it on a floppy with the mcopy command. Or if Samba’s also configured and running, backup to a network-accessible directory and pull the file over to another machine.

For stats, I use LiveWebStats, but I don’t like it. Any Apache log analyzer will work.

There’s one other issue with Greymatter. It sends passwords plaintext, and thus, they’ll show up in your logs. So don’t make your stats public, at least not your referrers. If you’ll have remote editors, you need to consider that vulnerability–an editor’s password can potentially be intercepted.

Setting up Greymatter is a lot of work, but it’s a one-shot deal. You make your design, then it’s content-driven. Change your design, and it applies to the whole site. Nice. And when you publish, you only publish your new stuff.

But overall, I like Greymatter an awful lot.

6 thoughts on “How I set up Greymatter for Weblogging

  • May 1, 2001 at 3:53 pm
    Permalink

    I like the new site so far (hey! it seems to stay up – that’s good ๐Ÿ˜‰

    And yes, for applications like this, Linux or BSD are your friends…

  • May 1, 2001 at 10:56 pm
    Permalink

    Thanks.

    Yeah, BSD or Linux for free (or 50 bucks) plus Greymatter for free (buy the author a book if you like it) sure beats the price of Manila plus an NT server. That’s a lot of money. I think I paid $100 for this P-120 18 months ago. The cost of running this site is next to nothing. It uses resources I already had on hand.

    And so far (knock on wood) it’s fast and reliable. I’m thinking about loading Linux or BSD on one of my 486s to keep around just in case of disaster. Then I can just boot it up, redirect port 80 to it, pop in a recent backup of the site, be back in business, and take my time figuring out what went wrong with the P-120.

    Maybe I ought to download the free Solaris for Intel and run off that, just so I can say I administer a Solaris Web server… ๐Ÿ™‚

  • May 3, 2001 at 11:11 am
    Permalink

    Oh no! *Anything* but "Slow-aris" on Intel… ;-> Now, it’s not too bad on SPARC architecture, but even there I’d prefer OpenBSD if I didn’t need to run commercial applications.

    DISCLAIMER: I’m a DNS & Unix sys admin at work. We run BIND 8.x under Solaris 2.5.1., along with DHCP and LDAP server software (last two both commercial products, thus no OpenBSD)

  • May 3, 2001 at 9:23 pm
    Permalink

    Ah, so that means you know what you’re talking about. People looking out for my career advancement have suggested, over the past year or so, that I learn Solaris, which was why I brought it up.

    My first job was in an IBM shop, and now I work in a DEC shop, so I can count the number of times I’ve seen or used Solaris on one hand.

  • May 4, 2001 at 11:06 am
    Permalink

    Learning Solaris *really* means learning Unix, which you can do quite nicely with a Linux box ๐Ÿ™‚ Once you wrap your head around "the Unix way," then it’s a matter of learning Solaris’ eccentricities & such.

    A GREAT resource is "the red book" (tho’ the newest edition is purple, so I guess it’s the "purple book" ๐Ÿ˜‰

    Unix System Administration
    Handbook, 3rd Edition
    Nemeth, Evi, et al.
    August, 2000, Prentice Hall PTR
    ISBN: 0130206016

    Covers Solaris, Linux, BSD and HP-UX, and Evi’s been doing Unix since many of her readers were in grade school ๐Ÿ™‚

  • May 5, 2001 at 2:14 pm
    Permalink

    I’ll have to look into that book. I’ve got a ton of O’Reilly Unix and Linux books, the remnants of an aborted project, but what we know is never enough now, is it?

    Seems to me that every Unix has its quirks–even different Linux distros have quirks. I can adjust pretty easily between the RPM-based distros, but when I look at Debian and Slackware I get lost quickly. Having a book that covers Solaris, HP-UX and BSD would be very nice.

    Thanks for the tip!

Comments are closed.

%d bloggers like this:
WordPress Appliance - Powered by TurnKey Linux