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.
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 RPMType ‘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
Perfect…
nice……
Well done, exactly what the doctor ordered 🙂
can’t install mysql-tools
any details? errors?
Tryed yast2 –install mysql-tools
but it can’t find it
There is a formatting issue on this website “–” reads as one single”-”
Try this
yast2 –i mysql-tools
I keep on getting this
Following packages haven’t been found on the medium:
mysql-tools
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!
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.
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.
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
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
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?
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.
cool
Funciono a la perfeccion. Gracias
It did work perfectly. Thank you very much.
Hi! Thank you very much! It it the best ‘HowTo install LAMP’ I’ve seen so far!
To correctly set the MySQL password enter the command:
set password = password(“yournewpassword”);
Enter this command at the mysql> prompt.
thx .. merci super vraiment bien
nice thank
Thank you very much this was very helpful the most helpful I have run into
GodBless you and the OpenSource community
Perfect one. Thankyou very much.
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
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?
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]
@Toni: You are missing the mod_include, mod_log_config apache modules. Installing that should fix the problem.
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!
Use XAMPP, much more easier to install and use.
No thanks, I prefer to use LAMP 😉
However I found a solution 🙂
Thx all
Bye,
Thanks for the tutorial. I’ll try it 🙂
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
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?
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.
Thanks a lot.
Very straight forward.
Best of its kind.
newbie here:
i get this error.
administrator@zion:~> yast2 -install apache2
bash: yast2: command not found
@xpd: Use “yast2 –install apache2” (note two “-” before install)
or
use “yast2 -i apache2”
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?
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@’localhost’ (using password: YES)’
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!
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
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
hello sir
Thank u so much for helping me out
this is a very good posting
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
…worked great! Except that I also needed to install
# yast2 --install php5-mcrypt php5-mbstring
# rcapache2 restart
Thanks for the tutorial! I had this knocked out during lunch!
can i know where the location to store the data for database we created in phpPgAdmin/postgresql server?
is it here :/var/lib/mysql/ ? if yes, why my database that i created using phpPgAdmin doesn’t show in that directory? anyone can help?
Perfect!!!! thank you my friend is the best tutorial in the internet!!!
I have 2 problems!:
1) in mysql pass (solution: http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html)
2) in the phpMyAdmid install (solution: 1) Download- http://www.phpmyadmin.net/home_page/downloads.php , unzip and copy in /srv/www/htdocs/phpMyAdmin ,and continue your pass), thank you my friend!!! thank you very much! 😀