Categories
Technology

Survival guide to LAMP: Ten basic commands of Linux

L is for Linux

Before continuing the Survival tutorials, you’ll need some basic Unix commands. I’ve recovered the following, which provides a good intro to most of the commands you’ll need, from the now defunct weblog, Linux for Poets.

Once upon a time Unix used to be for geeks only – the platform of choice for godlike SysAdmins and obsessed hackers who muttered strange phrases and giggled over inside jokes, as they swigged gallon after gallon of Mountain Dew. Unix neophytes were faced with a blank screen and an uncompromising command line along with dire warnings about what not to do … or else. Extending the basic computer, adding in such esoteric devices as printers or modems, required recompilation of the kernel, ominous sounding words intimidating enough to send all but the most brave, or foolish, running for the safety of Windows.

Then a strange thing happened: Unix started to get friendlier. First, commercial versions of Linux such as Red Hat came along with easier installation instructions, integrated device support, and lovely graphical desktops (not to mention a host of fun and free games). Open source Unix developers started drinking microbrews and fancy cocktails instead of caffeine and realized that they had to make their software easier to install and well documented in addition to being powerful and freely available. Alternatives to powerhouse commercial applications, such as Openoffice’s challenge to Microsoft’s Office, minimized the cost of switching to desktop Unix platforms. Finally, that bastion of the Hide the Moving Parts Club, Apple, broke all tradition and built a lovely and sophisticated operating system, Mac OS X, on top of a Unix platform.

Today’s Unix: slicker, safer, smaller, better…but push aside the fancy graphics and built-in functionality and simple installation, and you’re still going to be faced, at one time or another, with a simple command line and dire warnings about what not to do. Before you contemplate drinking the Code Red kool-aid, take a deep breath, relax, and familiarize yourself with the Ten Basic Commands of Uinux.


First Command: List the Contents

You have a brand new Unix site to host your weblog. You’re given shell access, which means that you can actually log into the operating system directly, rather than access the site contents through a browser or via FTP. You’ll access the site through SSH, or Secure Shell, because you’ve been told that its more secure. To do so, you’ll install an SSH application recommended by your friends, or use one provided by your hosting service. Up to this point, you’re in familiar territory – start an application and provide your username and password. Simple.

However, once you log on to the operating system, you’re faced with a cryptic bit of writing on the left side of the screen, such as “host%” or some variation thereof, with the cursor located just to the right, waiting to reflect whatever you type. At this point, your mouse, which has been your friend and companion, sits idle, useless, because you’re now in the Unix command line interface, and you haven’t the foggiest what to do next.

Your direction at this point depends on what you hope to accomplish, but chances are, you’re going to be interested in knowing what’s installed in the space you’ve just been given. To do this, you use the Unix List directory contents command, ‘ls’ as it’s abbreviated, to list the contents of the current directory. You can issue the command by typing the letters ‘ls’ followed by pressing the Enter key:

host% ls

What results is a listing of all the files and directories located directly in your current location, which is likely to be the topmost directory of your space on the machine. Depending on the host and what you have installed, this listing could include a directory for all CGI applications, cgi-bin. If your site is web-enabled, it could also include web pages, such as an index.html or index.php file, depending on what you’re using for web pages. If you have a email box attached to your account, you might also see a directory labeled “mail”, or another labeled “mbox”.

This one simple command is highly useful, but there are parameters you can pass to the list command to see more detailed information. For instance, you can see the owner, permissions, and size of files by passing the -l parameter to the command:

host% ls -l

The results you’ll get back can vary slightly based on version of Unix, but the following from my forpoets directory is comparable to what you’ll see:

drwxr-xr-x 3 shelleyp shelleyp 4096 Jul 20 18:09 flavours
-rw-r–r– 1 shelleyp shelleyp 5255 Aug 16 16:28 forpoets.css
-rw-r–r– 1 shelleyp shelleyp 6064 Aug 10 15:14 index.php
-rw-r–r– 1 shelleyp shelleyp 1319 Aug 10 15:00 index.rdf
-rw-r–r– 1 shelleyp shelleyp 789 Aug 10 15:00 index.xml
drwxr-xr-x 10 shelleyp shelleyp 4096 Sep 25 16:21 internet
-rw-r–r– 1 shelleyp shelleyp 27638 Jul 23 00:06 jaggedrocksml.jpg
drwxr-xr-x 9 shelleyp shelleyp 4096 Sep 25 16:23 linux

In this output, the first set of parameters is the permissions for the files and directories, the owner and group associated with each is ’shelleyp’, the size is listed after the group name, as well as the date, and so on. If the permission character begins with the character ‘d’, this means the object is another directory. Easy.

Of course, at this point you might be saying to yourself that I find Unix easy because I’m aware of what the commands are and what all the different parameters mean and do, as well as how to read the results. I’m a geek. I’ve visited the caffeine fountains and drunk deep; I’ve wondered the halls and muttered arcane curses and behold, there is light but not smoke from the tiny little boxes. But how can you, the creative master behind the sagas recorded on the web pages and the color captured in the images and the sounds recorded in the song files, learn these mystical secrets without having to apprentice yourself to the SysAdmin?

That leads us to the second command, whereby you, the seeker, find the Alexandrian Library embedded within the heart of most Unix installations.

Second Command: Seek Knowledge

Cryptic as Unix is, there is an amazing amount of documentation installed within the operating system, accessible if you use the right magic word. Originally, this word used to be man for manual pages; more recently the command has been replaced by info, though most Unix systems provide support for both.

Want to discover what all the parameters are for the list command? Type in the world man, followed by the command name:

host% man ls

What returns is a wealth of information such as more detailed information about the command itself, as well as a listing of optional parameters, and how each impacts on the behavior of the Unix command. Additionally, documentation for some commands may actually contain examples of how to use the command.

Nice, but what if you don’t know what a command is in the first place? After all, Unix is a rich environment; we can assume that one does more than just list directory contents.

To provide a more introductory approach to Unix, the info command, and the associated Info documents for the Unix system provide detailed information about specific commands, and can be used in a manner similar to man:

host% info ls

What follows is less cryptic information about the command, written more in the nature of true user documentation rather than arising from the ‘less is more’ school of annotation. Still, you have to know about the command first to use the system. Or do you?

If you type ‘info’ without a command, you’ll be introduced into the Info system top level node, which provides a listing of commands and utilities and a brief description of each. Pressing the space bar allows you to scroll through this list until you find a utility or built-in Unix command that seems to provide what you need. At this point, you can usually type ‘m’ to enter menu item mode, and then type the command name to get more detailed information. For instance, if I’m looking for a way to list directory contents, scrolling through Info on my server the first command that seems to match what I want is ‘dir’ not ‘ls’. By typing ‘m’ while still in Info, and then ‘dir’, I find out that ‘dir’ is a shortcut, an alias for a specific use of ‘ls’ that provides certain parameters by default:

`dir’ (also installed as `d’) is equivalent to `ls -C -b’; that is,
by default files are listed in columns, sorted vertically, and special
characters are represented by backslash escape sequences.

Suddently, Unix doesn’t seem as cryptic or as mysterious as you once originally thought. Still, it helps to know some basic commands before diving into it headfirst, and we’ll continue with our basic Commands of Unix by exploring how to traverse directories, next.

Third Command: Move About

Unix systems, as with most operating systems including Windows, are based on a hierarchy of directories following from some topmost directory basically represented by an empty slash ‘/’. However, unlike a Window-like environment where you click the directory name to open it and continue your exploration, in a command line environment you have to traverse the directories via command. The command you use is the Unix ‘Change directory’ command, or ‘cd’.

For instance, if you have a directory called cgi-bin located in your current directory, you can change to this directory by using the following:

host% cd cgi-bin

Typing the ‘ls’ command displays the contents of the cgi-bin directory, if any.

To return to the directory you started from you can use the ‘..’ value, which tells the cd command to move up one directory:

host% cd..

You can chain your movement requests to move up several directories with one command by using the slash character between the ‘..’ values. The following moves up two levels in the directory hierarchy:

host% cd ../..

Additionally, you can move down many levels by typing the names of directories you want to traverse, again separated by the slash:

host% cd shelleyp/forpoets/cgi-bin

Of course, you have to be directly in the directory path of a target directory to be able to use these shortcuts; and you have to know where you’re at relative to the target directory. However, what if you want to access a directory directly without messing with relative locations? Let’s say you’re in the full directory path of ‘home/username/forpoets/cgi-bin’ (assuming your home environment is /home/username) and you want to move to ‘home/username/web/weblog/logs’? The key to directly accessing a directory no matter where you are is to specify the complete directory path, including the beginning slash:

host% cd /home/shelleyp/forpoets/cgi-bin

Once you’ve discovered the power of directory traversal, you’ll go crazy, winging your way among directories, yours and others, exploring your environment, and generally snooping about. At some point, you’ll get lost and wonder where you are. You’re at X. Now, what is X.

Fourth Command: Find yourself

In Unix, to paraphrase Buckaroo Bonzai, no matter where you go, there you are. To find your location within the Unix filesystem of your machine, just type in the Unix Print Working Directory command, ‘pwd’:

host% pwd

Your current directory location will be revealed, and then you can continue your search for truth, and that damn graphic you need for your new page but you placed somewhere and can’t remember where now.

Of course, to traverse to a directory in order to place a graphic in it, the location of which you’ll then promptly forget, you have to create the directory, first.

Fifth Command: Grow your Space

Directories are wondrous things, a way of managing your resources in such a way that you can easily find one JPEG file without having to search through 1000 different items. With this simple hierarchical, labeled system, you can put your images in a directory labeled ‘image’, or put your weblog pages in a directory labeled ‘weblog’, and add an ‘archives’ directory underneath that for archive pages.

You can go mad, insane, with the impulse to organize – organizing your pages by topic, and then by month, and then by date, and then…well, the limits of your creativity will most likely be exhausted before the system’s ability to support your passionate embrace of your own self geekness.

Making a new directory is quite simple using the Make Directory command, ‘mkdir’. At the command line, you specify the command followed by the name of the directory:

host% mkdir image

When next you list the contents of the current directory, you’ll now see the new directory, ready for you to traverse and fill with all your bits of wisdom and art. Of course, there is a caveat. This is Unix – there is always a caveat.

Before you can create a directory or even move a file to an existing directory you have to either own the directory, and/or have permissions to write to the directory. It wouldn’t be feasible, in fact it would be downright rude, if you could create a directory in someone else’s space, or worse, in the core operating system directories.

We’re assuming for the nonce that you’re the owner of your domain, as far as your eye can see (as allowed by the operating system) and that you can create things as needed. But what if you want to magnanimously change the permissions of files or directories to allow others to run applications, access pages, or create their own directories?

Sixth Command: Grant Devine Rights

Earlier when playing around with the ‘ls’ command, we looked at more detailed output from the command that showed a set of permissions for the directory contents. The output looked similar to:

-rw-r–r– 1 shelleyp shelleyp 789 Aug 10 15:00 index.xml
drwxr-xr-x 10 shelleyp shelleyp 4096 Sep 25 16:21 internet

In the leftmost portion of the output, following the first character, which specifies whether the object is a directory or not, the remaining values specify the permissions for each object listed by owner of the object (the first set of triple characters), the group the owner belongs to (the second set of triples), and basically the world. Each triple permission states whether the person accessing the object has read access, write access, or can execute (run) the object – or all three.

In the first line, I as owner had read and write access to the file, but not execute because the file was not an executable. Any member of the group I belong to (the same name as my user name in this example, though on most systems, this is usually a different name), would have read access to the file, only. The same applies to the world, not surprising since this is a web accessible XML file. For the second line, the primary difference is that all three entities – myself, group, and the world – have executable permission for object, in this case a directory.

What if you want to change this, though? In particular, for weblog use, you’ll most likely need to change permissions for directories to allow weblogging tools to work properly. To change permissions for a file or a directory, you’ll use the Change Mode command, ‘chmod’.

There are actually two ways you can use the chmod command. One uses an octal value to specify the permission for owner, group, and world. For instance, to change a directory to all all permissions for the owner, but only execution permission for a group and the world, you would use:

host% chmod 755 somefile

The first value sets the permissions for the owner. In this case, the value of ‘7′ states that the owner has read, write, and execute permission for the object, somefile

-rwxr-xr-x 1 shelleyp shelleyp 122 Sep 27 17:48 somefile

If I wanted to grant read and write permission, but not execute, to owner, group, and world, I would use ‘chmod 666 somefile’. To grant all permissions to owner, read and write to group, and read only to world, I would use ‘chmod 764 somefile’.

To recap the numbers used in these examples:

4 – read only
5 – read and execute only
6 – read and write only
7 – read, write, and execute

The first number is for the owner, the second for the group, the final for the world.

Another approach that’s a bit more explicit and a little less mystical than working with octal values, is to use a version of chmod that associates permission with a specific group or member, without having to provide permissions for all three entities. In this case, the use of the plus sign (’+’) sets a permission, the use of the subtraction sign (’-‘) removes it. The groups are identified by ‘u’ for user (owner), ‘g’ for group, and ‘o’ for others. To apply a permission to all three, use ‘a’, which is what’s assumed when no entity is specified.

This sounds suspiciously similar to that simple to put together table you bought at the cheap furniture place, but all’s clear when you see an example. To change a file’s permission to read, write, and execute for an owner, read and execute for group, and execute for the world, use the following:

chmod u+rwx,g+rx,o+x somefile

In this example, the owner’s permissions are set first, followed by the permissions for the group and then ‘others’, or the rest of the world.

To remove permission, such as removing write capability for owner, use the following:

host% chmod u-w somefile

Though a bit more complex and less abbreviated than using the octal values, the latter method for chmod is actually more precise and controlled and should be the method you use generally.

(Of course, there’s a lot more to permissions and chmod than explained in this essay, but we’ll leave this for a future Linux for Poets writing.)

Once you’ve created your lovely new directory, and made sure the permissions are set accordingly, the next thing you’ll want to do is fill it up.

Seventh Command: Be fruitful, copy

One way you’ll add content to your directories is to create new files, or to FTP files from another server. However, if you’re in the midst of reorganizing your directories, you’ll most likely be copying files from an existing directory to a new one. The command to copy files is, as you’ve probably guessed by now, Copy, or ‘cp’.

To copy a file from a current directory to another, use the following:

host% cp somefile /home/shelleyp/forpoets

With this the source file, somefile, is copied to the new destination, in this case the directory at /home/shelleyp/forpoets. Instead of copying the file to another location, you can copy it in the same directory, but use a different name:

host% cp somefile newfile

Now you have two files where before there was one, both with identical content.

You can copy directories as well as files by using optional parameters such as -a, -r, or -R. For the most part, and for most uses, you’ll use -R when you copy a directory. The -R option instructs the operating system to recursively enter the directory, and each directory in that directory and so on copying contents, and to preserve the nature of certain special files such as symbolic links and device files (though for the most part you shouldn’t have these types of files in your space unless you’ve come over to the geek side of the force):

host% cp -R olddir newdir

The -a option instructs the operating system to copy the files and directories as near as possible to the state of the existing objects, and the -r option is recursive but can fail and hang with special files.

(Before using any of the optional flags with copy, it’s a good idea to use the previously mentioned ‘info’ command to see exactly what each flag does, and does not do.)

When you’re reorganizing your site, copying is a safe approach to take but eventually you might want to commit to your new structure and that’s when you make your move. Literally.

Eighth Command: Be Conservative, Commit

Instead of copying files or directories, you can move them using the Unix Move command, abbreviated as ‘mv’.

To move a file to a new location, use the command as follows:

host% mv filename /home/shelleyp/forpoets

Just as with copy, the first parameter in this example is the source object, the second the new destination or new object name – you can rename a file or directory by using ‘mv’ command with a new name rather than a destination. You can also move a directory but unlike ‘cp’, you don’t have to specify a an optional parameter, or flag, to instruct the command to move all the contents:

host% mv olddir newdirlocation

Up to this point, you’ve created, and you’ve copied, and you’ve moved and over time you’re going to find your space becoming cluttered, like Aunt Minnie’s old Victorian house filled with dusty lace doilies and oddities like Avon bottles, forming canyons of brightly colored glass for the 20, or so, cats wondering about.

It’s then that you realize: somethings got to go.

Ninth Command: Behold, the Destroyer

There is a rite of passage for those who seek to enter geekhood. It’s not being able to sit at a keyboard and counter the efforts of someone trying to crack your system; it’s not being able to create a new user or manage multiple devices. The rite of passage for geek candidates is the following:

host% rm *

Most geeks, at one time or another, have unintentionally typed this simple, innocuous phrase in a location that will cause them some discomfort. It’s through this experience that the geek receives a demonstration of the greatest risk to most Unix systems…ourselves.

The simple ‘rm’, is the Unix Remove command and is used to remove a file or directory from the filesystem. It’s essential to keep a directory free of no longer wanted files or directories, and without it, eventually you’ll use up all your space and not be able to add new and more exciting material. However, it is also the command that most people use incorrectly at some point, much to their consternation.

To remove a specific file, type ‘rm’ with the filename following:

host% rm filename

To remove an entire directory, use the following, the -r flag signaling to recursively traverse the directories removing the contents in each:

host% rm -r directoryname

When removing an entire directory, you’ll be prompted for each item to remove, and this prompt can be suppressed using the -f option, as in:

host% rm -rf directoryname

So far, the use of remove is fairly innocuous, as long as you’re sure you want to remove the file or directory contents. It’s when remove is combined with Unix wildcards that warning signs of ‘Ware, there be dragons here should be entering your thoughts.

For instance, to remove all JPEG files from a directory, instead of removing each individually, you can use a wildcard:

host% rm *.jpg

This command will remove any file in a directory that has a .jpg extension. Any file. Simple enough, and as long as that’s your intent, no harm.

However, it’s a known axiom that people work on their web sites in the dead of night, when they’re exhausted or have had one too many microbrews. Our minds are befuddled and confused and tired and not very alert. We’re impatient and want to just finish so we can go to bed. So we enter the following to remove all JPEG files from a directory:

host% rm * .jpg

A simple little space, the result of a slight twitch of the thumb, and not seen because we’re tired – but the result is every file in that directory is removed, not just the JPEG files. And the only way to recover is to access your backups, or seek the nearest Unix geek and ask them to please, pretty please, help you recover files you accidentally removed.

And they’ll look at you with a knowing eye and say, “You used rm with a wildcard, didn’t you?”

Which leads us to our last Command, and the most important…

Tenth Command: Do Nothing

You can’t hurt anything if you don’t touch it. If you’re unsure of what a command will do, read more about it first, don’t type it and hope for the best. If you’re tired and you’re removing files, wait until you’re more rested. If something isn’t broken, don’t fix it. If your site is running beautifully, don’t tweak it. If you’re trying something new, back your files up first.

Unless you’re a SysAdmin and need to maintain a system, in which case you don’t need this advice anyway, you can’t hurt yourself in Unix unless you do something, so if all else fails, Do Nothing.

The easiest mistake to recover from in Unix is the one that’s not made.

Categories
Connecting

Zero to sixty in ten seconds

Mr. Allan Moult, my friend as well as my boss at Leatherwood Online is celebrating an important birthday tomorrow, tomorrow in this case being May 8th.

Allan is a journalist, photographer, a writer, an editor, and a very interesting person who has traveled more than most people I know. He is also a tireless defender of the natural beauty of Tasmania, and seems most happy when he’s out doors, in the wild he loves so much. As a digital birthday greeting, I thought I would post photos from today’s hike for him, interspersed with some philosophy appropriate to the occasion.

(By the way, today’s hike was several miles over some wicked nasty hills and I hiked it in 90 degree (that’s Blinken’ Hot in Celsius) temperatures. It’s reassuring to people like me and Allan and others of our friends who are no longer young pups, to realize that we’re not getting older, we’re going insane.)

three days climbing
this old heart
goes no further.

Loren Webster

Found on the Net: some ways to know you’re getting older:

1. Everything hurts and what doesn’t hurt doesn’t work.
2. The gleam in your eyes is from the sun hitting your bi-focals.
3. You feel like the morning after and you haven’t been anywhere.
4. Your little black book contains only names that end in M.D.
5. Your children begin to look middle aged.
6. You finally reach the top of the ladder and find it leaning against the wrong wall.
7. Your mind makes contracts your body can’t meet.
8. You look forward to a dull evening.
9. Your favorite part of the newspaper is “20 Years Ago Today”.
10. You turn out the lights for economic rather than romantic reasons.
11. You sit in a rocking chair and can’t get it going.
12. Your knees buckle, and your belt won’t.
14. You’re 17 around the neck, 42 around the waist, and 95 around the golf course.
15. Your back goes out more than you do.
17. Your Pacemaker makes the garage door go up when you see a pretty girl.
18. The little old gray haired lady you helped across the street is your wife.
19. You sink your teeth into a steak, and they stay there.
20. You have too much room in the house and not enough in the medicine cabinet.
21. You get your exercise acting as a pallbearer for your friends who exercise.
22. You know all the answers, but nobody asks you the questions.

“You can’t help getting older, but you don’t have to get old. ”

George Burns

“Age is not a particularly interesting subject. Anyone can get old. All you have to do is live long enough.”

Groucho Marx

(Though my particular favorite is, “It isn’t necessary to have relatives in Kansas City in order to be unhappy.”)

“Just remember, once you’re over the hill you begin to pick up speed.”

Charles Shultz

Crimson flames tied through my ears
Rollin’ high and mighty traps
Pounced with fire on flaming roads
Using ideas as my maps
“We’ll meet on edges, soon,” said I
Proud ‘neath heated brow.
Ah, but I was so much older then,
I’m younger than that now.

Half-wracked prejudice leaped forth
“Rip down all hate,” I screamed
Lies that life is black and white
Spoke from my skull. I dreamed
Romantic facts of musketeers
Foundationed deep, somehow.
Ah, but I was so much older then,
I’m younger than that now.

Girls’ faces formed the forward path
From phony jealousy
To memorizing politics
Of ancient history
Flung down by corpse evangelists
Unthought of, though, somehow.
Ah, but I was so much older then,
I’m younger than that now.

A self-ordained professor’s tongue
Too serious to fool
Spouted out that liberty
Is just equality in school
“Equality,” I spoke the word
As if a wedding vow.
Ah, but I was so much older then,
I’m younger than that now.

In a soldier’s stance, I aimed my hand
At the mongrel dogs who teach
Fearing not that I’d become my enemy
In the instant that I preach
My pathway led by confusion boats
Mutiny from stern to bow.
Ah, but I was so much older then,
I’m younger than that now.

Yes, my guard stood hard when abstract threats
Too noble to neglect
Deceived me into thinking
I had something to protect
Good and bad, I define these terms
Quite clear, no doubt, somehow.
Ah, but I was so much older then,
I’m younger than that now.

My Back Pages by Bob Dylan

“Life is like riding a bicycle. To keep your balance you must keep moving.”

Albert Einstein

“Everyone here who is damn glad you’re no longer 18–madly wave your hand!”

Shelley Powers

Happy Birthday, my friend.

Categories
Weblogging

Points to ponder

Joi Ito pointed to the article from the Telegraph, which interviews the mother of one of the women involved with the photos of the torture of the Iraqi prisoners.

First: Why the focus on the women soldiers? Why not the men? Or both?

Second: Remember when you read this article that the folks in New York, Boston, and San Francisco aren’t the only ones disturbed by the possibly officially encouraged torture of Iraqi prisoners–most of the country is also, including I imagine, most of the people in West Virginia.

In every country, and with every culture, there are insular pockets of people who categorize the world as Us and Other, with Other being somehow less in value. Yes, even in San Francisco. This country cannot be represented by a map of Smart People in a few coastal areas, and a big word, “Racist Stupid Hick” everywhere else. Before you start to generalize this article–and you know you want to, I can hear the rhetoric and jokes now–keep this in mind.

David Weinberger writes about despairing of finding a middle ground when it comes to opinion of the Iraq prison photos:

Can we get even to that common ground? Can we as a nation say that we abhor torture, except in the rarest of cases? That we do not believe in the institutionalizing of torture? That we will fight it around the world? That we believe in the rule of law and that no one is above the law? That we believe in treating even our enemies with dignity? That we support the established international conventions for treating prisoners? That we are sorry about what went on at Abu Ghraib?

If left and right can’t agree on those points, then I do fear that the division in our country is unbridgeable. If we can’t agree to condemn torture, if we can’t feel shame at what we did at Abu Ghraib, then what can we agree on?

I commented at David’s site, but came up with an additional thought: why do we have to agree?

When I wrote about all of us being angry all the time, and swimming in a sea of surety, I didn’t mean to imply that we had to find agreement; sometimes the divisions are too far apart, and we can’t agree. But that doesn’t mean other opinions aren’t valid, or just as real to the people who hold them, or that we can’t be wrong.

But we don’t have to agree.

Finally, Mike Golby has responded to both the Sea of Surety posting, and the Can We Still Be Friends essay, where he’s referenced:

I do not believe my being ‘for’ or ‘against’ the United States or its citizens as a whole is at issue here. Shelley puts it bluntly. Friendships are at stake. I’ve been mulling this over. She’s right. They are. Why? I believe it’s all about the tone we adopt on our blogs and the respect we show for others’ views and realities. Anger affects the first and does away with much of the latter. So, what is my tone? Born of anger, it’s self-righteous, prescriptive, arrogant, and cocksure. With just a couple of words, I transform a justifiable anger into a demand that others adopt my thinking, change their lives and man the barricades. Doing that reduces even anger to little more than a vituperative and impotent frustration. Hell, even I can’t accept that. Motivated by anger (but fuelled by frustration), I become dogmatic. I assume the right to tell others how and what to blog. In other words, I become prepared to ride roughshod over others’ views and realities. In short (and in tone), I become Bush. It’s my right to want to do that but what conceit would make me want to exercise such a right? No sensible conceit that I can think of. Anger, poorly expressed, can do great harm.

Anger, poorly expressed, can do great harm. That’s why Mike Golby is, and will remain, my friend.

Categories
Technology

Survival guide to LAMP: Basic ingredients

Recovered from the Wayback Machine.

I’ve heard from several people interested in moving to an open source weblogging tool like WordPress or Textpattern, but they’re concerned about having to manipulate PHP code in order to modify the templates or make the changes to the tool to incorporate modifications some of us have created.

What happens, then, is these folks stay with a hosted and/or proprietary tool, even if they aren’t happy with it, and this bothers me. I’m cool with folks remaining with other tools because they’re not interested in tweaking an open source product, or because they like the tools; but I think those of us who support the open source effort have an obligation to make the products of open source obtainable to everyone interested, tech or not. I have never felt that there should be a division between the techies and the non-techies when it comes to our physical environments. A better divider, to me, is interest: there are those who are interested in using open source products, or tweaking the product to fit their needs; and those who just want to use a weblogging tool, as is, no mods. Packaged product, end of story. Regardless of technical skill.

I’ll get into this further, but first a little digression:

Today’s Web environments are different from the environments we endured back in the Web stone age. Years ago I remember that the only thing you could depend on within a web environment was that a web server was installed. There might, just might, be other software installed that you could use–usually Perl for CGI applications. If you hosted with a Windows ISP, you also had access to ASP, and sometimes even SQL Server. If you were hosted on Unix, you had Perl and some limited ability to install a rather intimidating array of programs that usually caused havoc with your system at one time or another.

If you had your own server–and this wasn’t that common long ago–you had to maintain everything yourself, and you had to know what you were doing. Even today, with the increased sophistications of hosting options and environments, an independent environment does require a great deal of expertise with Internet and usually Linux facilities. Still, long ago, this was the only option for people who wanted to run a database, applications, and various languages.

Today the web hosting environments are different. First the reduced costs for co-location or virtual servers has increased the number of people running independent servers. However, most of us have a hosted site on an ISP, like my own on Hosting Matters, where the cost is less and, more importantly, much of the server administration is handled by the ISP. Considering the number of security releases for even a reliable product such as Red Hat Linux, having that aspect of administration handled by the ISP is worth the loss of some independence.

However, just because we don’t have total server independence doesn’t mean we don’t have access to a great deal of software. Most of us are served through the Apache web sever, with several modules compiled in increasing our ability to customize our own environment. In addition, most ISPs now offer database access, usually MySQL but other databases are supported. As for code — I don’t know of any ISP that doesn’t have PHP and Python installed in addition to Perl, and with today’s beta release of Mono for Linux, we should soon see support for C#, too. Personally, I’m looking forwared to this one–I’ve always liked C#.

We also have access to applications that help us manage our environment. My own ISP provides cPanel, a very sophisticated interface that allows us to easily add and remove users, databases, files, security, and even applications. Integrated with this control panel is a host of other tools such as PHPMyAdmin, which greatly increases the simplicity of working with the MySQL database.

There are some limitations, of course. For instance, if you want to run a beta release of a product, you might have to negotiate with the ISP to have it installed, and if it proves a problem, they’ll yank it. And forget asking to install an EJB (Enterprise Java Bean) framework on most systems. Frameworks tend to be notorious CPU hogs, not to mention tempermental and easily crashed.

However, for the most part, this shared hosting environment, with the administrative tasks handled by the ISP but with access to a plethora of tools for us to do dama.., urh, interesting stuff is an optimum solution for most of us, and is how many of us are currently hosted. At a minimum, these hosts provide what most of us ask for, which is LAMP.

O’Reilly long ago coined the term LAMP to encapsulate the web environments used, incidentally, for most weblogging tools, and hosted by most ISPs. LAMP stands for a set of open source product encompassing Linux (or one of the BSD Unix variants) as operating system; Apache as web server; MySQL as database; and one or more of PHP/Perl/Python as scripting language.

I am inordinately fond of LAMP, though most of my development expertise in the past has been non-LAMP. For instance, I’ve developed with Visual Basic/C++, within ASP and not; I’ve also worked with Delphi and Powerbuilder, in addition to spending a number of years working with C, C++, and Java on Unix boxes. There was some Perl here and there, but for the most part, much of my experience has been Windows development or Java and the aforementioned EJBs.

However, over time I’ve come to appreciate the cleanliness of LAMP–the simplicity of the development process; how lightweight and accessible it is. There is no initial investment of thousands to install the infrastructure, as is necessary (usually) with EJBs; there isn’t even a significant learning burden put on the developer to obtain expertise in LAMP. After all, anyone can install Linux on their PCs, and once that’s installed, download and install Apache, MySQL, and PHP–for free.

Okay, okay–free as in beer.

Bluntly, aside from my interest in Mono, I have no interest in returning to work with Java or huge infrastructure environments. Give me simple. Give me clean. Give me open source, and make it free.

What does this mean to you, the innocent weblog writer? Well, nothing much if you’re using a tool such as Blogger that manages your weblog for you. However, if you have to install your weblogging tool, you and your environment are going to, at some point, have to meet and greet. I know enough about weblogging tools to know that most are LAMP-based (okay, okay, .NET folks, don’t crawl all over my case with this one–I know you’re out there, in numbers to big to ignore).

How far you take the greeting, though, is up to you. That’s where we go back to webloggers who are interested in open source and tweaking, as compared to webloggers who just want to push a button and have a weblog instantly created. For most folks, LAMP exists but they don’t have the training to take advantage of it. This, then, makes installing something like WordPress, with its PHP exposure, intimidating. But there’s nothing about these tools that require a person have a technical background in order to be comfortable with installing products like WordPress or Textpattern, running updates on MySQL, or modifying an .htaccess file in order to redirect web pages.

I haven’t done a tech series for a long time, and I think I’m overdue. So, for the next few weeks, I’m going to write a number of tutorials about LAMP, targeted for the non-tech, to see if I can’t increase the comfort level with those of you using Linux, or Apache, or PHP, or MySQL. I will be focusing on PHP, of the three P’s: PHP, Perl, and Python. Personal preference you might say.

During these, I’ll install and configure WordPress 1.2 beta for one of my web sites, and then walk through modifications I’ll make with the basic product to fit my needs. In addition, I’ll also install Textpattern and do the same.

(Previously I had thought that Textpattern was proprietary, only to find out it is open source, and so to make amends, I’ll work with both products. )

Even if you aren’t interested in WordPress or Textpattern, if your site is hosted on Linux, you’ll benefit from the tutorials covering the simple line commands, not to mention SSH access. If your weblog tool uses MySQL, or you’re just interested in it, you’ll also benefit from the essays discussing this popular database. Same with PHP and Apache.

All entries in the Survivor Guide to LAMP are designated with the lava lamp icon (I thought this was apropos), and are featured in a separate category for easier access. If you have anything specific you’d like covered, drop me a note or put in a comment.

Oh, and these tutorials are also open–I’ll be attaching a Creative Commons license to these essays (but only these essays, specific to the posting only, if I can figure out how to do this). Hopefully these tutorials will be incorporated into WordPress’s documentation wiki, and elsewhere, to continue being useful long after I’m gone.

Categories
Political

National day of prayer

Thursday is this country’s National Day of Prayer. This day was set aside back in the 1950’s, the same era when “In God We Trust” was added to the coins, and “Under God” added to the Pledge of Allegience. The purpose of the event is to bring people together from all denominations to pray for the country and to give thanks. Normally I don’t even notice when this day occurs. This year, though, it has several very interesting aspects to it.

First of all, I read that all are welcome to pray on Thursday, but only those members from certain Christian churches can lead prayer sessions. This has peeved the Mormon Church who have been told that they may not lead prayer sessions–in Utah, no less.

Of course if you’re Jewish or Muslim, Hindu, or a member of a Christian sect outside of those classified as a “evangelical Christian Church”, you also can’t lead a prayer session on this day. Well, I suppose you could. I don’t think you’ll get arrested if you do. In fact, if you don’t pray, you probably won’t get arrested.

That’s kind of reassuring.

Now, Oliver North is leading a prayer session. He’s been designated as the Honorary Chair for this year’s events (oh, and by the way, you can order his book here, at the NDP site). Yes, that is the Oliver North of the Iran-Contra illegal gun sales.

(In case you don’t know US history that well, that was when we sold guns to Iran (fighting Iraq–we also supplied arms to Iraq) and then used the money to fund terrorists in Nicaragua.)

Yeah, that Oliver North.

I’m not giving an opinion about this day of prayer led by evangelical Christian churches, to pray for our ‘campaign of freedom’ in Iraq and elsewhere, led by a man who was involved in one of the worst scandals to have ever hit this country.

Nope. No opinion at all.

By the way, what are you doing this Thursday during the Day of Prayer?