L is for Linux
When you’re writing for a large audience–you are a large audience, aren’t you?–you can’t predict what level of knowledge your readers have, so you have to pick a point to start, and then hope you won’t either overwhelm the less knowledgeable, or bore to death the experienced. With a book this problem becomes acute, and it’s one of the toughest tasks of technical writing: trying to define your audience and then focus the writing accordingly.
Writing to a weblog is much easier, because the experienced can just skip the section covering tech they’re familiar with, and the less experienced can ask questions of the author directly, in comments or in an email. In addition, others can contribute or correct, as the need arises. I suppose I could do this in a wiki, but I won’t.
Having sufficiently covered my butt, I hope, time for the next LAMP essay:
To install both WordPress and Textpattern, first I need to create or clear a location for the products. Then I need to download the application files from the tool sites, unzip them, and move them to their permanent home. At that point, I may have to change the permissions on one or more files to get them to work.
Chances are if you’ve installed software before, you’re familiar with this routine. One technique you can use is download the zipped file to your home computer, unzip the files there, and then FTP the files up to your site. You can also use FTP to create a subdirectory, and change permissions, if your FTP software provides this functionality, and most do. I use FileZilla and it does everything you can need to install software on your site.
However, there is a drawback to this approach, which is why I never use it if I can avoid it. First, you have to download the files to your computer; then you have to upload the files to your site. In addition, you have to use a tool that is really meant to transfer files to do site file and directory management, and again, this is just something I don’t care for. It’s not efficient.
Instead, what I do is use SSH (Secure Shell) to virtually log onto my site, where I can then move easily about, deleting and moving files, changing permissions, and even downloading files easily and quickly using any number of utilities and tools that are traditionally installed with more full featured versions of Unix.
SSH is a way of creating a virtual shell (operating environment) on your remote site, and then running commands at the command line. If you have a good broadband connection, accessing the command line using SSH is very fast. Even modem access can be acceptable. By using SSH, you’re also very secure when working with your remote site because all communications between you and the site are encrypted, and protected from prying eyes.
Not all hosting companies provide SSH support, but the more comprehensive ones do, though you may have to have the ISP turn SSH support on for your site. (To know if you have SSH access, check with your ISP.) If your ISP does support it, then you’ll also need to have client SSH software installed on your home computer.
Users of Mac OS X are lucky, because SSH is built into the underlying Unix-based environment for the operating system. To access SSH directly, you can open a Unix command window using the Terminal application installed as part of the operating system utilities. You can also locate it using Finder, typing in “Terminal”.
The Terminal application gives you a Unix command line interface, so you can play around within your home computer before logging into your remote server–just remember that some commands are quick to run, but slow to recover from. When you’re ready to access your site, type in a command such as the following:
ssh -l shelley burningbird.net
This allows me to create a secure shell into burningbird.net, specifying my username for the site. I’ll then be asked for my password, and the SSH application will also provide you some feedback that an exchange of necessary information has been made between the server and the client. This exchange, then, allows all communication between you and the remote server to be encrypted, and safe from prying eyes.
(Note, if you’re concerned about something Nasty invading your pretty TiBook, no worries – inbound SSH, as with FTP, is turned off by default at installation.)
If you’re a Windows user, you’ll have to install SSH client software. I use a commercial product called SecureCRT, and I’m very happy with the tool. However, why pay bucks if you don’t have to. According to the Wikipedia, PuTTY is a favorite free SSH client for Windows and Unix. (If you know of other good ones, please put a note in the comments.)
Your ISP may also provide an online SSH client that you can use. A word to the wise, though: these almost invariably work miserably. You’re better off just using SSH software for your computer, or using what’s already installed.
The steps I’m going to take to set up a working subdirectory for each of these tools assumes that you’re using SSH to access the site’s Unix interface.
Creating a home for your weblogging software, and pulling in the files
First, I’m going to create the subdirectories for the tools. I’ve decided for these tutorials to create a semi-permanent home for these products under their own subdomain names: wordpress.burningbird.net and textpattern.burningbird.net. If your hosting company allows you to create subdirectories, it will also provide you the software, or the instructions, or both to create these. When the subdomains are created, the physical sub-directories are also, usually created.
However, to create a subdirectory is easy in Unix, as long as you have permission to create directories. If you can create directories with FTP, you can create them at the command line.
To create a directory, and make it accessible via the Net, you’ll need to change to your public Web site directory. In my environment, when I log in using SSH, I need to change to the public_html (or www, which is an alias) directory using a command like the following:
The ‘cd’ command is ‘change directory’, and as you can see, it’s pretty simple to use. If you want to go to a specific absolute address, you specify the entire directory structure, such as the following:
If you want to move to the directory above your current location, use:
To move up three directories.
Once in the target directory, create your subdirectory as follows:
At this point, a subdirectory called ‘textpattern’ is created. Change to that directory (using ‘cd’), and you’ll be ready to download the software.
On many Linux systems, there are some very helpful utilities installed. One of the more common ones is an application called Wget. What this application does is access a file and download it to your current location, whether that file is an HTML file, or the compressed file containing the Textpattern files.
To get the recent Textpattern build, I find the link for the file and then download it:
If wget is not installed on your system, or you don’t have a comparable program from your ISP (check with them), then download the zipped file to your client machine, and FTP it down to your server.
Note that I’m accessing the Gzip file, not the zip one. Once you see how fast wget works–remember that you’re now taking advantage of your ISP’s superior connections–you’ll see why I rarely use FTP to install software on my server.
Once downloaded, I need to both unzip the file as well as pull the contents out of the packed tar file. Again, making use of existing facilities, one way to unzip the TGZ (or tar.gz) files is to use gunzip to uncompress it, and then tar to pull the files from the tar file:
tar -xf textpattern_g118a.tar
You can also use a Unix shortcut, which is to take the result from the gunzip operation and pass it to the tar program using what is known as a Unix Pipe:
gunzip -c packedfiles.tar.gz | tar -xf –
With this, the results of the gunzip program is passed as input to the tar application. It’s a shortcut, nothing else.
At this point, we’re ready to install Textpattern, but we’ll do that in the next essay, after we create the MySQL database for it. For now, what we’ll do is the same procedure for downloading WordPress:
- Creat the directory for WordPress, using your ISP’s tools or by creating the directory using mkdir:
- Change to the subdirectory just made using cd:
- Download the software using wget:
- Unzip it using gunzip and tar:
gunzip -c http://wordpress.org/nightly/wordpress-2004-05-05.tar.gz | tar -xf –
If you’ve not experimented around with the Unix command line interface before, at this point you officially be bad.
This has been a rather fast intro to some basic Unix commands. For a more detailed one, I’ve recovered my Ten Basic Commands of Unix, and re-posted as a Survival Guide entry.
After that, we’ll start getting into the database and install both products.