SUSE & openSUSE

Tips,Tricks, Tutorials,How Tos and Troubleshooting suse linux

Install & Configure LAMP (Apache/MySQL/PHP) in openSUSE 11.0

Posted by admin on July 15th, 2008


One of the many popular combinations in Linux is the LAMP setup. LAMP to expand is Linux Apache MySQL PHP. Most of the websites running on the internet these days or LAMP servers where

Linux is your flavor opensource operating system (openSUSE for us :-) )
Apache2 is the master webserver on the planet
MySQL is your favorite opensource database
PHP is the popular web programming language


The easiest way to get the LAMP server installed would be to install LAMP from the YaST GUI as follows:

1. Computers – YaST – Install Software – Set filter to “Patterns” then select and accept “Web and LAMP” under Server functions. But, this installs things we don’t need from LAMP perpesctive like DNS, Perl modules etc.
LAMP Installation from YaST

I prefer the manual option to setup a LAMP Server.

So without wasting much of time, lets proceed to get LAMP up and running on your openSUSE in no time. I’m using openSUSE 11.0 but the procedure should equally work on earlier 10.3 and other 10.2 versions.

Install & Configure Apache2 Webserver

Install Apache webserver

opensuse11:~ # yast2 –install apache2

This should install apache webserver. To check try the following command:

opensuse11:~ # rcapache2 status
Checking for httpd2:                                          unused

That tells you, the Apache webserver is installed but just not started yet.

To test if the webserver serves pages, add a file index.html into /srv/www/htdocs/ directory. This is the default web root directory for apache on your system.

opensuse11:~ # cd /srv/www/htdocs
opensuse11:~ # vi index.html

and enter some text say “Welcome to openSUSE 11.0

Start Apache2 Webserver

Now start the Apache 2 webserver so we can check if it works OK.

opensuse11:~ # rcapache2 start
Starting httpd2 (prefork)                                         done

Now, open a web browser like Firefox and go to http://localhost and you should see the ext you entered (here “Welcome to openSUSE 11.0″)

Let’s proceed to install PHP5

Install PHP5

opensuse11:~ # yast2 –install php5 php5-mysql apache2-mod_php5

This should install PHP5, PHP5-MySQL module and the Apache2 PHP5 module.

For Apache2 to enable the PHP5 module, restart for changes to take effect.

opensuse11:~ # rcapache2 restart
Syntax OK
Shutting down httpd2 (waiting for all children to terminate)          done
Starting httpd2 (prefork)                                                          done

Install & configure MySQL

opensuse11:~ # yast2 –install mysql mysql-tools

This should install MySQL Database Server and options mysql-tools (for administration) on your openSUSE. To check the installation, run the following command:

opensuse11:~ # rcmysql status
Checking for service MySQL:                                           unused

The above indicates that the MySQL Server is installed but not started yet.

Start MySQL Server

opensuse11:~ # rcmysql start
Starting service MySQL                                                done

By default there is no root password set for MySQL and it is important to set the password for the ROOT account.

Set Root Password

opensuse11:~ # mysqladmin -u root -p rootpassword

This should set the root password as “rootpassword”. Set the password to something more appropriate.

To check if Root password is set and the MySQL Client can logon to the MySQL Server try the following:

opensuse11:~ # mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51a SUSE MySQL RPM

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
| test               |
+——————–+
3 rows in set (0.04 sec)

mysql>

In the above, I used mysql client to logon as root, entered the password and list the databases. That completes the installation of LAMP on openSUSE 11.0

To administer MySQL database, the easiest and the popular tool is phpMyAdmin, given that we have discussed PHP5, apache2 setup here which are required for phpMyAdmin, it makes sense to look at quickly setting up and configure phpMyAdmin

Install phpMyAdmin

opensuse11:~ # yast2 –install phpMyAdmin

This installs phpMyAdmin and setup a website at /srv/www/htdocs/phpMyAdmin directory. Change directory and use the sample config file to quickly setup phpMyAdmin.

opensuse11:~ # cd /srv/www/htdocs/phpMyAdmin
opensuse11:~ # cp config.sample.inc.php config.inc.php

Edit the file and look for


$cfg['blowfish_secret'] = ‘mysqladmin’;

Enter a value for blowfish secret (I’ve set it to mysqladmin here)

Thats done and has the default configs on it. Logon to phpMyAdmin from http://localhost/phpMyAdmin with the MySQL root username and password.

For advanced documentation, click here

phpMyAdmin Login

phpMyAdmin in Action

Related posts

45 Responses to “Install & Configure LAMP (Apache/MySQL/PHP) in openSUSE 11.0”

  1. Anselmo Perroni Says:

    Perfect…

  2. joseph Says:

    nice……

  3. Uwe Haenssler Says:

    Well done, exactly what the doctor ordered :-)

  4. Luke Says:

    can’t install mysql-tools

  5. admin Says:

    any details? errors?

  6. Luke Says:

    Tryed yast2 –install mysql-tools
    but it can’t find it

  7. admin Says:

    There is a formatting issue on this website “–” reads as one single”-”

    Try this

    yast2 –i mysql-tools

  8. Luke Says:

    I keep on getting this
    Following packages haven’t been found on the medium:
    mysql-tools

  9. index.php wont load openSuse cd version - openSUSE Forums Says:

    [...] maybe….? This is the setup of the webserver i did and works fine on DVD installed pc’s: Install & Configure LAMP (Apache/MySQL/PHP) in openSUSE 11.0 | SUSE & openSUSE please [...]

  10. Alcyon Says:

    Here’s another thank you – I kept running into this problem with phpMyAdmin after installing – didn’t know what the problem was. Creating the config.inc.php as suggested here finally makes it work!

  11. Edward Says:

    Very helpful post. Used YAST2 LAMP pattern directly rather than install. Otherwise only phpMyAdmin is not on Suse 11.0 demo DVD. Therefore this administration looks like a personal favorite and is downloaded separately? Overall this was a real assist for novice users.

  12. yltang Says:

    Thanks for the post. I have followed every step suggested for installation, and every systems, Apache2, MySQL, and PHP, seemed to work just fine. However, my PHP code has problem connecting to MySQL using mysql_connect() function. There were no error message even if I turn the “display_error” ON in the php.ini file. Can anybody suggest some directions I may follow, or something I have to check to solve the problem. Thanks.

  13. Werner J Says:

    All but the root password sets correctly for me.
    I do the line and it gives me a new line with ‘Enter password:’ on it.
    It just stops dead there though I can get into everything since it has
    no password defined. Might add that this worked flawlessy on ubuntu with
    a bit of editing of apache2.conf and php.ini but neither here in OpenSuSE 11
    has been mentioned. I look into php.ini but couldn’t find the line with
    extension = mysql.so
    to uncomment to make sure it connects to it and neither did I find
    apache2.conf to add Include phpadmin/apache.conf

    It’s on a server that’s runs locally but still nice to have it working
    properly

  14. tonio32 Says:

    ho seguito la guida ma quando arrivo ad attivare apache con il comando rcapache2 start mi da questo errore :

    Starting httpd2 (prefork) (98)Address already in use: make_sock: could not bind to address [::]:80
    (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs
    startproc: exit status of parent of /usr/sbin/httpd2-prefork: 1

  15. Chris Says:

    Same problem as Werner with the setting of the root password using
    mysqladmin -u root -p password
    I can’t set the password:

    Enter password:
    mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Access denied for user ‘root’@'localhost’ (using password: YES)’

    How can I work around this?

  16. L. Says:

    I was also getting the root password setting problem.
    I have a MySQL book by Paul DuBois for MySQL4, and I tried typing in
    mysqladmin -h localhost -u root password "rootpass"
    and it worked.

    Give it a try.

  17. sidi Says:

    cool

  18. Pedro Says:

    Funciono a la perfeccion. Gracias

    It did work perfectly. Thank you very much.

  19. Gary Diamant Says:

    Hi! Thank you very much! It it the best ‘HowTo install LAMP’ I’ve seen so far!

  20. tjamieson Says:

    To correctly set the MySQL password enter the command:

    set password = password(”yournewpassword”);

    Enter this command at the mysql> prompt.

  21. syn Says:

    thx .. merci super vraiment bien
    nice thank

  22. Buya Says:

    Thank you very much this was very helpful the most helpful I have run into
    GodBless you and the OpenSource community

  23. NB Says:

    Perfect one. Thankyou very much.

  24. stefan Says:

    Hi there.

    whenever I tried to install either mysqhl or php I get the following message:

    – Cannot determine type for repository factory-non-oss.

    and later on it says it can’t find the mysql mysql-tools or certain php-tools, which means it doesn’t install mysql at all, I’m not sure about php.

    Also, when I open the web browser, going to http://localhost/ it would say access denied also I tried to change the rights with chmod… Because of that I also can’t add any files – only as root, but I was too frustrated to lear how vi works.

    Thanks in advance

  25. Asteway Says:

    While installing mysql I typed my password wrong and I couldn’t crack it. I have done this before, so can you send me the code to crack?

  26. Toni Says:

    i ‘ve installed apache2 server, but i get the following error when trying to run

    linux-fk7c:/srv/www/htdocs # rcapache2 start

    code>
    Module “include” is not installed, ignoring.
    Check the APACHE_MODULES setting in /etc/sysconfig/apache2.
    Module “log_config” is not installed, ignoring.
    Check the APACHE_MODULES setting in /etc/sysconfig/apache2.
    Starting httpd2 (prefork) Syntax error on line 11 of /etc/apache2/mod_log_config.conf:
    Invalid command ‘LogFormat’, perhaps misspelled or defined by a module not included in the server configuration

    The command line was:
    /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
    [/code]

    Did i forget to install something?

    when i check for status i get:

    [code]

    linux-fk7c:/srv/www/htdocs # rcapache2 status
    Checking for httpd2: unused

    [/code]

    [/code]

  27. admin Says:

    @Toni: You are missing the mod_include, mod_log_config apache modules. Installing that should fix the problem.

  28. Dario Says:

    Hi guys,
    I tried to follow the guide to install LAMP on SLES10 but I’ve some problems.
    I can’t install the mysql-tools and the phpMyAdmin.

    I tried so:
    yast2 -i mysql-tools / the error is that the following package haven’t found on the medium.

    yast2 -i phpMyAdmin / Same error like above

    Thank you all!

  29. Moh'd Says:

    Use XAMPP, much more easier to install and use.

  30. Dario Says:

    No thanks, I prefer to use LAMP ;)

    However I found a solution :)
    Thx all

    Bye,

  31. edwards Says:

    Thanks for the tutorial. I’ll try it :)

  32. alisa Says:

    I*ve installed apache2 and php5 but when e try rcmysql status after i*ve used yast2 -i mysql-tools
    in screen appears rcmysql not found please can you help me because i realy need to install mysql

  33. surya padhy Says:

    I followed the exact steps as mentioned. The three packages – mysql-tools and apache2-mod-php5 and phpMyAdmin are not found on the DVD. so I downloaded the two apache2-mod-php5 and phpMyAdmin.

    I can see the index.html on local host,phpMyAdmin is fine and mysql is also fine. Everything is ok till now.
    But when added some php code in the index.html I am not getting those displayed in the output. Following is the index.html content

    testing

    Could you please help me admin ? Do i need to do some extra configuration for php?

  34. surya padhy Says:

    A small correction for above post. I tried to provide the html code but it seems it will not work here. So just for information I used the ?” for php code.

  35. Sandeep Dhindle Says:

    Thanks a lot.
    Very straight forward.

    Best of its kind.

  36. xpd Says:

    newbie here:

    i get this error.

    administrator@zion:~> yast2 -install apache2
    bash: yast2: command not found

  37. admin Says:

    @xpd: Use “yast2 –install apache2″ (note two “-” before install)

    or

    use “yast2 -i apache2″

  38. Goobeguru Says:

    Hi, I get an error message “Media is not accessible”. Does it mean that apache2 is not a part of my SuseLinux 11.0 installation? Where do I find Apache2 download for this SuseLinux version?

  39. rEdLiNe Says:

    mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Access denied for user ‘root’@'localhost’ (using password: YES)’

  40. Nils Says:

    great site and many thanks to Admin and all the other posts.The mysql password and the revised install post where great.

    But….

    Have not found the phpMyAdmin.
    Tried both yast2 -i phpMyadmin and using the yast GUI.
    is there a site to download just that?

    Dario, what was your solution?

    thanks again!

  41. Nils Says:

    got phpmyadmin going.Download from the php site.

    Still getting access forbidden message when i tried the http://local/phpmyadmin thing.

    good old error 403

  42. netwrkspider Says:

    hey when i start apache server..it’ll giv error

    linux-aqop:~ # rcapache2 start
    Starting httpd2 (prefork) /usr/sbin/httpd2-prefork: error while loading shared libraries: libaprutil-1.so.0: cannot open shared object file: No such file or directory

    The command line was:
    /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
    failed
    pls help me

  43. MySQL Socket error - openSUSE Forums Says:

    [...] Install & Configure LAMP (Apache/MySQL/PHP) in openSUSE 11.0 And it works like clockwork, now. Thank you very much for your help! __________________ Folding@Home Help save lives with Folding@Home [...]

  44. siva Says:

    hello sir

    Thank u so much for helping me out
    this is a very good posting

  45. spiranha Says:

    Hello Guys.

    I don’t understand the workflow like this:

    change the directory from follows:

    “This installs phpMyAdmin and setup a website at /srv/www/htdocs/phpMyAdmin directory. Change directory and use the sample config file to quickly setup phpMyAdmin.

    opensuse11:~ # cd /srv/www/htdocs/phpMyAdmin
    opensuse11:~ # cp config.sample.inc.php config.inc.php

    Edit the file and look for

    $cfg['blowfish_secret'] = ‘mysqladmin’;

    Enter a value for blowfish secret (I’ve set it to mysqladmin here)

    Thats done and has the default configs on it. Logon to phpMyAdmin from http://localhost/phpMyAdmin with the MySQL root username and password.

    1.) edit? how? in a terminal? I’ve done this local, but i think that isn’t it.

    2.)In the Browser at http://localhost/phpMyAdmin….. I can’t type in the user or password

    Thank in advance for your help

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>