Installing Drupal on Linux: an epic adventure

来源:百度文库 编辑:神马文学网 时间:2024/04/30 18:37:22
Jan. 13, 2006
There's a certain class of programs that I refer to as the "cranky" ones. They may work great when all is said and done, but getting to that point can be really hard. For me, these include sendmail, QuarkXPress, and nowDrupal.
As you may know, Istarted looking a few weeks ago for an easy-to-use CMS (content management system) for my neglectedPractical Technology site. I just didn't have the time to keep it up to date manually withDreamweaver, Fookes Software'sNoteTab, andNvu.
So, after considering numerousopen-source CMS programs, I decided togive Drupal a shot on Kubuntu.
Kubuntu, while a great desktop, was not a good choice for me as a CMS server platform. So, I headed to Novell'sOpenSUSE 10.
Now, if I had been doing this in a business setting, I would have used eitherSLES (SUSE Linux Enterprise Server) orRHEL (Red Hat Enterprise Linux). I run both of them in my office. But, I wanted to see if I could do this on a "free as in beer" distribution, so I went withOpenSUSE.
Unlike Kubuntu, with OpenSUSE I was able to quickly and easily grab the server components I needed to set the stage for Drupal. These were: MySQL 4.1.13, Apache 2.0.54, and PHP 4.4.0-6.
With all this in hand, you should keep in mind that Drupal, like all CMSs I know of (both open source and proprietary), is not a "click a button and install" program. All of them require a lot of hands-on work with initialization files and the like.
You may have noticed that I'm not using the newest and shiniest versions of MySQL or PHP. That's right. The reason I'm not using MySQL 5 is that Drupal, or at least Drupal 4.6.5, doesn't work well with it.
This was the first of my fights with installing Drupal. I knew this was likely to be a problem because other programs had had trouble with them. Both the newest MySQL database and PHP scripting language may be faster and have more features, but neither excels atbackwards compatibility.
Unfortunately, many projects have not been doing a good job of updating their software to work with these new versions. Drupal, alas, is one of those.
For now, if you want to run MySQL 5 and Drupal together, you need to set MySQL to a mode in which it acts like MySQL 4. For details on how to that, you'll need to turn to MySQL'sThe Server SQL Mode page. For Drupal, the proper setting is "MYSQL40"
You'll also need to set PHP up with the following settings in its php.ini file: session.save_handler:user
session.cache_limiter:none
memory_limit:24M With Apache, you could set these instead with a .htaccess file, but I prefer to reserve the .htaccess file for security settings.
And, of course you have to have the proper database extensions installed for PHP. In my setup, for example, I had to have php4-mysql up and running.
You'll also need to manually set up a MySQL database for your Drupal-powered Web site. Fortunately, Drupal does supply a database schema, so you don't have to manually set up the database.
You can either do this at the MySQL command line, with a MySQL administration program likeNavicat, or with the open-sourcephpMyAdmin, which is what I use. It's not as powerful as Navicat, but for Drupal purposes it has more than enough capabilities.
Once you've got the Drupal database schema loaded, you can move the Drupal files to your Web directory. The default location, in my case, is /srv/www/htdocs. Check your Apache settings to make sure you know exactly where it's looking for its Web files. You'll also need to make sure that Apache's httpd.conf file includes index.php in its DirectoryIndex index.html index.php line as above, or your Web browser won't find Drupal when you head to your site.
As you install the program, you'll also need to pay close attention to where you install the files, and to their directory permissions.
The owner of the directory should be the Web server user, while the group should only contain people who will be working on the site. For my purposes, I'm using my developers group.
The files and directories should be given 755 permission with the command: chmod -R 755 For moving the files around on this project, I findMidnight Commander to be invaluable. I think Commander is a must-have in any serious Linux user's toolbox.
To do a lot of what I've just described, you're going to need to be logged in as root. Be darn sure while you're logged in this way that you only make necessary changes and that you log on to a normal user when your work is done.
Before you're done with your new Web server directory, you'll also need to get rid of any unnecessary Web files and add two directories: files and files/pictures. While Drupal doesn't create these automatically, you'll need them for users to enter blog entries.
Finally, underneath your Web root directory, you'll have to edit the sites/defaults/settings.php file with the correct MySQL database information for your Drupal site and its base URL. If you don't have a Web site URL yet, localhost will work nicely for the base URL.
You must be very careful in editing this file. Use only an ASCII editor, not OpenOffice.org or the like. That's because even a single excess space at the end of a line can cause your Drupal site to not run properly.
Presuming that everything has gone well, you'll be looking, as I was, at a Drupal login screen. The first user on Drupal is the administrator so be certain to keep that in mind with your login name and password.
That didn't sound too bad did it? Well, it's not, but to get to that point, I had to do a lot of digging around the Drupal and MySQL sites.
If you're going to follow my footsteps, let me suggest that you bookmark now theDrupal Best Practices Guidelines. It does a decent job of covering the fundamentals. You may also want to pick up a copy ofBuilding Online Communities with Drupal, phpBB, and WordPress from a bookstore. The first two-hundred pages are all Drupal and it contains some very handy material. Theonline handbook, which was, when I started the project, something of a mess, has recently been cleaned up and improved. That said, you're still likely to be spending a lot of your time looking for answers in theDrupal forums.
Still, when all is said and done, Drupal, as I start to set up my site, does work quite well and quickly. I'm looking forward to building a site in it. Setting it up in the first place, though, that was another story.
Good luck!