e-mail   
 Menu
  Home
  Download
  Top 10 Downloads
  Last 15 New Files
  Web Links
  Tips
  Last 15 New Tips
  NLM Programming
  Admins Club





Installation and Administration






Polish Forum SUSE




Novell Connection Magazine


 
Who's Online

 There are currently,
5 guest(s)
that is (are) online.
 


Technical Information

Back to List of Categories

Technical Information about
  A Little YaST Magic
  A Slideshow for Your KDE Wallpaper
  Add Novell Support to Your Firefox Search Engine
  Adding To The Panels In Gnome.
  Akregator - RSS News Reader
  An Introduction to WBEM and OpenWBEM in SUSE LINUX
  Authenticating SUSE LINUX to eDirectory via LDAP
  Basic Mounting Differences between Windows and Linux
  Beginner's Guide to Using Novell SUSE LINUX's Build Utility
  Browsing Files
  Card Readers on SUSE LINUX 9.2 Professional?
  Changing the Default Browser in Gnome
  Developing Perl CGI scripts on SUSE LINUX
  Do I Have Permission?
  Double SYNC -- Using RSYNC Simultaneously With and Without Branch Office for Data Backup
  Dumb Question: Mounting Linux CDs
  Easy Command-Line Introduction
  Easy Way to Debug SSL Connections
  Enabling an Interactive Startup in Novell/SUSE LINUX
  Exploring MySQL 4.1 and PHP 5 on SUSE LINUX
  Extend Your Panels Using Gnome Drawers.
  Firefox Speed Tip
  Fix Java Errors With ConsoleOne On Linux
  Fix Your Mouse Wheel...
  Gimp -- Closing In on Photoshop...
  Gimp Tips Part 1: Resizing Images
  Gimp Tips Part 2: Rounding Corners
  Gimp Tips Part 3: Fading Photography Edges
  Gimp Tips Part 4: Selective Colorization
  Gimp Tips Part 5: Plugins a Plenty - Adding Light
  Gimp Tips Part 6: Using The Clone Tool
  Google Auto-fill Replica for Linux
  How a Corrupted USB Drive Was Saved by GNU/Linux
  How to Implement Login Scripts into a Pure Linux Environment
  How to install and connect an External Modem on a Linux PC
  How to Install the Novell Client for Linux on SUSE Linux 10.0
  How to launch applications at login in Gnome
  How to Remote Control Linux
  How to setup a Linux application to automatically startup when you login.
  How to share Files and Printers Between Linux and MS Windows with Samba
  How to uninstall the Novell Client for Linux
  How to upgrade the Novell Client for Linux
  How to use SMB without turning off the firewall
  How's the Weather?
  HTML Development Tools in Linux
  Informative Bash Prompt
  Install and Use QEMU on SUSE 9.2
  Install Linux Frequently, Without the Hassle
  Installing Apache, PHP, and MySQL on SUSE LINUX Professional
  Installing RPM Files
  Integrating Novell Linux Desktop into a Novell NetWare network
  Introduction to Oracle 10g R1 (10.1.0.3) on SUSE LINUX Professional 9.3
  iPrint Printers on Novell Linux Desktop
  Linux Scheduling Priorities Explained
  Make a Misbehaving Program Quit
  Manually Mounting a USB Flash Drive in Linux
  Migrating To Linux, Advantages Over Windows 9.x And XP
  Minimize Your Maximizing with Multiple Desktops
  Mounting NetWare Volumes On NLD Illustrated
  Move Your /home to Another Computer
  Mozilla Mail Review
  Need a Backup?
  Novell Client Settings with Windows Terminal Server
  Novell Linux Desktop Equivalents of Windows Software - New and Improved
  Novell Linux Desktop System Upgrade How-To
  Partitioning Hard Drive for Linux Install
  Perform Remote SuSE Installations With Virtual Network Computing
  Quick Intro to Klipper
  Quick Shortcuts in The Gimp
  Reset Your Lost Root Password
  Resizing Your Gnome / KDE Panels
  Runlevels in SUSE LINUX
  Running Existing Win32 Applications on SUSE LINUX
  Service Command in /etc/init.d/
  Setting Shortcut Keys
  Setting up a Linux NFS Install Source for Your LAN
  Should I choose Novell Linux Desktop or SUSE LINUX Professional as my desktop?
  Starting Services From the Command Line On SuSE LINUX
  Sticky Notes for Gnome
  SUSE LINUX 9.3 Professional Review
  Sync Up The Taskbar and the Desktop in Gnome
  System Upgrade How-To
  Taking Screenshots in Linux
  The Basics of Messaging in the Cross-Platform GroupWise Client
  The Novell Client for Linux (beta).
  Transparent Panels in Gnome
  Trick Out Your KDE Desktop
  Understanding the YAST Software Module Options
  Updating Your Software with Red Carpet
  Using dsbk on Linux and Unix
  Using iFolder to Synchronize Firefox Bookmarks
  Using Multiple Swap Partitions In 2.4
  Using openSSH to Securely Access Remote Systems
  What FTP client should I use on Linux?
  What Is Logical Volume Management?
  What is so great about Firefox?
  Which Graphic Formats For What?
  Windows Shortcuts for Firefox Tabs on Linux
  Windows to Linux: A Beginner's Guide
  Windows Users Can Feel at Home Exploring Files in Linux
  WLAN interface as the Default
  Work With User Selection Icons In KDM
  YAST Online Update De-Mystified

Technical Information
 Installing Apache, PHP, and MySQL on SUSE LINUX Professional

Printer-friendly version

17 Jan 2005

SUSE Linux 9.1 Professional
KDE 3.2.1

Here's the deal. I've been a Windows user for the better part of my career. So, any way you go about it, I'm a Linux neophyte. I hope to get over that. Sooner would be better than later. I really like what I've seen others doing with Linux and I would love to take part in the rebellion.

For the past three weeks I've been working to install MySQL on my SUSE Pro 9.1 box. It's been quite an adventure. Maybe it was me and my lack of experience. Maybe it wasn't. Nonetheless, in an effort to make the trip shorter for the next guy or gal trying the same task, I've taken the time to outline the steps I took -- once I figured out where it was safe to step. I hope it helps someone.

Pouring the Foundation
One of the reasons I embarked on this adventure is so I could have a Linux web server in my lab. (Well, okay, in the laundry room.) I've done a lot of Cool Solutions work lately with a number of hosting providers and they're all running ... Linux. So it makes sense for me to have a development and/or test environment that runs the same.

The Main Ingredients
My end goal was to have a server running Apache web server software, the PHP scripting language, and the MySQL database engine. Few will argue that this combination is one of the most popular on the web today.

Before I start listing the steps, let me apologize in advance. The initial installation was actually quite easy, thanks to SuSE's YaST ("Yet another Setup Tool"). But, as is most often the case, the devil was in the details. And to complicate things, as I pointed out earlier, I'm terribly new at this. If I've made a mistake, please send in your suggestions and set me straight. That way we can all learn (and I can patch up my configuration).

Here's where I started:
  1. Power up the server.
  2. Log in as user (not root).



  3. Start up YaST. (Do this by clicking the SUSE toolbar's "Start" button (that would be the green button with the smiling gecko) => "System" menu => "YaST"
  4. YaST dialog opens telling you that you need to enter root's password before you can continue.



  5. Enter the root password.
  6. In the YaST window that opens, click the "Software" icon in the left menu and then the "Install and Remove Software" icon to the right.



  7. YaST takes a moment to inventory what you already have installed and what you can install. Then it opens a window with a search dialog (and a few other options that I've yet to explore).



Install Apache
  1. Type "apache" in the search field and click the "Search" button.
  2. Select the modules you want to install. I wanted to start out with the basics so I selected "apache2", "apache2-mod_php4".



  3. Click the "Accept" button.
  4. This is where YaST gets cool. Like a good guardian angel, YaST evaluates your selections, tells you what's missing, and gives you some ideas about resolution. In my case, YaST suggested a few other modules that were required to make the install successful. It took a few minutes to evaluate the suggestions and (sometimes) choose between the options, but I was happy to have the help and used every bit of the YaST information to complete the installation.

    This screen informed me that there was a conflict and gave me a few logical choices that would need to be made in order to resolve the conflict.



    I clicked the radio button next to "install apache2-prefork" and pressed the "OK - Try Again" button.



  5. YaST notified me that not that I had resolved the pending conflicts, and that two other packages were being installed to "resolve dependencies".



  6. As I said, I was happy for the direction and clicked the "Continue" button without hesitation.
  7. Now you'll want to set Apache to start up when you boot. To do that, click the "System" icon in the left pane of the YaST window.
  8. Click the "Runlevel Editor" in the right pane.



  9. Click the "Expert Mode" radio button at the top of the YaST window.
  10. Select "apache2" from the scrolling list.



  11. Under the "Set/Reset" dropdown in the lower-right corner, choose "Enable the Service".
  12. This should automatically select the appropriate runlevels that will be used when starting the service.
  13. Under the "Start/Stop/Refresh" dropdown, select "Start now ..."
  14. The Apache service should start and the runlevel editor screen will look like this:



  15. Click "Finish".
  16. Save the changes.
Install PHP
  1. Type "php" in YaST's search field and click the "Search" button.
  2. This time, YaST shows that I've already installed "apache2-mod_php4" and "php4".



  3. Since I know I'll be working with MySQL, I select "php4-mysql" and "phpmyadmin" (a browser-based admin tool for MySQL databases).
  4. Click "Accept".
  5. Survey the suggested additions.



  6. Click "Continue".

Test our Progress
Let's take a minute to test what we've just installed before we dig ourselves a hole that's too deep to get out of. We can test both Apache and PHP by dropping a .php file in the server directory and seeing if Apache will serve it up.

  1. Open a text editor. (Remember, I'm a Windows guy. I just want to create a text file, not learn a new paradigm for editing.) "Start" menu => "Utilities" => "Editor" opened up the perfect text editor (Kate) for a guy like me. She was graphical and familiar and knew what to do with a mouse. What more could a guy want?
  2. Type the following into a document:



  3. Save the file as info.php to the "/home/kmillecam/public_html/" directory. (You'll want to replace "kmillecam" with your username, not mine).
  4. One of the neat features of Linux and Apache, is that every user has their own personal directory that they can use to host their content.
  5. Launch a web browser and access the info.php file using this URL: http://localhost/~kmillecam/info.php
  6. You should see a web page that displays all the configuration details of your PHP installation. WooHaa! Apache is running. PHP is running. Two down, one to go.



Install MySQL
  1. Type "mysql" in YaST's search field and click the "Search" button.
  2. Add "mysql" and "mysql-client" to the list of previously installed components.
  3. Click "Accept".
  4. Survey the suggested additions.
  5. Click "Continue".

We There Yet?
If you're still with me, thanks. YaST stops a little short of fully installing MySQL. So, the best is yet to come. The following was not easy fare and came only after much pizza and many a caffeine-charged cola. I found the following in various and sundry support databases, list servers, and documentation pages.

I immediately (actually, it took me a week to figure out this one) checked the /var/lib/mysql/ directory only to find it empty! This directory is supposed to include the MySQL foundation files that are necessary to make it all work.

Feedback from reader Jim Pye:

The /bin directory is in your path so the need to change to this directory first is not needed. As the script is located in the /bin dir you can invoke it from anywhere in the file system eg. your home dir (the prompt with the ~) by typing:

mysql_install_db --user=mysql

If you want to run a command that is in a directory not in your path then there are 2 options; Change to the directory and run the command with special syntax or use the full path to the command.

If your current directory is the one that contains the command then you must use the following syntax to run the command:

./mysql_install_db --user=mysql

The leading dot and forward slash are required because the shell (bash in this case) does not automatically look in the current directory for files to execute, this is unlike DOS. The ./ syntax tells the shell to look in the current directory for the command to run.

The other way to run a command is to specify the full path to the command.

/bin/mysql_install_db --user=mysql

would work from anywhere as it uniquely specifies the file to run.

I found the following in the MySQL documentation:

  1. Log in as the root user. ("Start" => "Switch User")
  2. Open a terminal window (the icon that looks like a monitor behind a clamshell).
  3. Type "cd /bin" enter (no quotes).
  4. Type "mysql_install_db --user=mysql



  5. If you typed carefully, after a few seconds of processing, you'll be reading a screen of kudos and congratulations.

Adding the MySQL Group
In order for the mysql, the root, and the daemon user accounts to be able to startup and work with the databases you've just created, you'll need to create a group for these members.

  1. Open YaST.
  2. Click "Security and Users" in the left pane.
  3. Click "edit and create groups" in the right pane.



  4. Click "Add" from the bottom of the "User and Group Administration" window.



  5. Type "mysql" in the "Group Name" field.
  6. Check the checkboxes next to the "daemon", "mysql", and "root" names in the "Members of this Group" window.
  7. Click "Next".



Fixing the Permissions
Don't pat yourself on the back, quite yet. I'm not sure why, but the new directories, databases, and files that were just created in the /var/lib/mysql/ directory do not have enough rights and permissions to allow the MySQL service to start up.

So, before you log out of the root account, you'll need to grant the appropriate rights. Here's how I went about it.

  1. Open the Konqueror file browser by clicking on the "House" icon in the toolbar.
  2. Browse to /var/lib/ and right-click the /mysql/ directory.



  3. Select "Properties"
  4. In the Properties window that opens, click the "Permissions" tab.



  5. Under "Access Permissions", select "Can View & Modify Content" from the "Group" dropdown menu.
  6. Under "Ownership", type "mysql" in the "Group" field.
  7. Click the "Apply changes to all sub folders and their contents" checkbox. This will apply these rights (that are set at the /var/lib/mysql/ level) to the files, folders (and databases) below.



  8. Click "OK"
  9. Log out of the Root account.

Starting the MySQL Service

  1. Open YaST.
  2. Click the "System" icon in the left pane of the YaST window.
  3. Click the "Runlevel Editor" in the right pane.
  4. Click the "Expert Mode" radio button at the top of the YaST window.
  5. Select "mysql" from the scrolling list.
  6. Under the "Set/Reset" dropdown in the lower-right corner, choose "Enable the Service".
  7. This should automatically select the appropriate runlevels to use when starting the service.
  8. Under the "Start/Stop/Refresh" dropdown, select "Start now ..."
  9. If we haven't' made any missteps, the MySQL service will start.
  10. Click "Finish".
  11. Save the changes.

Testing MySQL
If you installed phpMyAdmin, you can test your MySQL installation by going to http://localhost/phpMyAdmin/. With Linux, URLs are case sensitive so it is important to capitalize the "M" and the "A" in phpMyAdmin or you'll get an error.

WooHoo! You should see the following screen if you have phpMyAdmin using Apache to communicate with MySQL. (We'll take care of the warnings -- the ones in BOLD RED type -- next.

Taking Care of Warning #1

  1. Log into the root account.
  2. Use Konqueror to browse to /srv/www/htdocs/phpMyAdmin/
  3. Right-click on config.inc.php
  4. From the menu that opens, select "Open With ..."
  5. Select "Utilities" => "Editor" => "Kate"
  6. Click "OK"
  7. Change line 39 from "$cfg['PmaAbsoluteUri'] = ''" to "$cfg['PmaAbsoluteUri'] = 'http://localhost/phpMyAdmin/'"

    I've discovered that this string works if you plan to use phpMyAdmin from the server machine but if you want to access it from another computer, you'll want to use the fully qualified domain name, like this: http://www.example.com/phpMyAdmin/

  8. While you're in the configuration file, enter 'localhost' between the quotes on line 69.
  9. Enter the username 'root' on line 83.
  10. Enter the root password 'password' on line 84.
  11. Save the file and close the editor.
  12. Log out of the root account.
  13. Reboot your server.

    I've learned that this is a gaping security hole. Since you've hard coded the root username and password into the configuration file, anyone can access (and toy with) your databases if they know the URL to phpMyAdmin =-) Yikes!

    Avoid this by 1) removing the user and password info from the config.inc.php file and 2) either a) changing the 'auth_type' to 'http' which asks whomever is accessing the site for the appropriate username and password (Keep in mind that the password travels in plain text, unless you are using the HTTPS protocol.) or b) Changing the 'auth_type' to 'cookie', where the password is stored, encrypted with the blowfish algorithm, in a temporary cookie.




Taking Care of Warning #2
MySQL is initially installed without passwords. You should follow the steps in the MySQL documentation ([url]http://dev.mysql.com/doc/mysql/en/Default_privileges.html) to add passwords to all accounts.

Here are the steps I took:

  1. From my user account, open a terminal window.
  2. Type "cd /bin" (no quotes)
  3. Type "mysql -u root" [enter] to log into the "MySQL monitor" tool as the root user.
  4. Type "UPDATE mysql.user SET Password = PASSWORD('rock0n') WHERE User = 'root';
  5. Enter.
  6. This will secure your database with a password.








Portal posiada akceptację firmy Novell Polska
Wszystkie materiały dotyczące produktów firmy Novell umieszczono za zgodą Novell Polska
Portal has been accepted by the Novell Polska
All materials concerning products of Novell firm are placed with Novell Polska consent.
NetWare is a registered trademark of Novell Inc. in the United States and other countries.
Windows is a trademark or a registered trademark of Microsoft Corporation in the United States and other countries.
Sybase is a registered trademark of Sybase Inc. in the United States of America.
Other company and product names are trademarks or registered trademarks of their respective owners.