Page 1 of 1

SUSE: setting up LAMP(apache2 + MySql + PHP5 + phpMyAdmin) Rate Topic: -----

#1 shadowstep0705  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 48
  • Joined: 26-May 10

Posted 29 January 2011 - 05:01 AM

Welcome to this tutorial,
it will explain you how you can install LAMP, that is apache2, PHP5, mysql and optionally phpMyAdmin.
I will do this in several steps:
1. Installing Apache2
2. Installing PHP5
3. Installing MySql
4. Setting up phpMyAdmin

So, here we go:

1. Installing Apache2

First you will need to open the terminal, you can do this by clicking on the application launcher icon (in the lower left corner) and then clicking on 'Terminal'. Now you should see a frame with the username, and the computer name.
Eg.
alexander@linux-akcg:~>

Now you can give commands to your computer.

To install programs, you need to have root access, so we're going to do a root login. Simply type the following command, and then press enter:
su root

Now this will appear:
alexander@linux-akcg:~>su root
Password:

Simply type the root password that you entered at the installation, then press enter again.
Now something like this will show up:
linux-akcg:/home/alexander #


Now we're going to really install apache2, so just type
yast -i apache2
and let the computer do it's work.
Now, you want to check if everything is installed correctly. Enter the following command:
rcapache2 status


If you get:
linux-akcg:/home/alexander # rcapache2 status
Checking for httpd2:                                          unused

then you are good, if if you get something else, then another httpd2 client is already running.

If you have 'running' instead of 'unused', try the following command:
rcapache stop

then check the status again.

Now you want to check if it really works, so we need to go to the htdocs folder which is located in /srv/www.
Enter the following command:
cd /srv/www/htdocs


Then make a file using the VI editor (or another) named index.html with the following content:
<html>
<head>
</head>
<body>
<h1>You succesfully installed Apache2</h>
</body>
</html>


Save it.
Now the last step is to start apache, enter the following command:
rcapache2 start


You should get this:
linux-akcg:/home/alexander # rcapache2 start
Starting httpd2 (prefork)                                            done



Now, open your favorite browser and navigate to http://localhost.
If everything works there should be a text, 'You succesfullly installed Apache2'.

Congratulations, you made it through the first chapter!

Here are some commands you can use:
rcapache2 start //this will start your httpd2
rcapache2 stop //this will stop your httpd2
rcapache2 restart//this will restart your httpd2
rcapache2 status//this will give you the status of your httpd2

[size="4"][b][u]
2. Installing PHP5[/u][/b][/size]
If you still have your terminal open, then fine. If not, log in with 'su root' again.

To install PHP5, enter the following command:
[code]yast -i php5 php5-mysql apache2-mod_php5


Now everything is installed, but to get results, you have to restart the server:
rcapache2 restart


That's it, but you want to test it out, don't you?
So we go to the htdocs folder again
cd /srv/www/htdocs

and we make a new file named index.php with the following content:
<html>
<head>
</head>
<body>
<?php
echo "<h1>You succesfully installed PHP5!</h>"
?>
</body>
</html>


Save it and start your favorite browser again.
Navigate to http://localhost/index.php
If there is “You successfully installed PHP5!”, then everyting works.

3. Installing MySql

If you don't have root access in your terminal, enter
su root
again.

To install mysql and mysql-tools, which is needed for the administration, enter the following command:
yast -i mysql mysql-tools


Start the server with:
rcmysql start


To set the root password, enter
mysqladmin -u root password NEWPASSWORD


If you want to change the password later:
mysqladmin -u root -p'oldpassword' password NEWPASSWORD


So for example, if my older password was root, and now I want it root123, I do the following:
mysqladmin -u root -p'root' password 'root123'


Now you can login into the server client, enter the following:
mysql -u root -p

Type
exit
to go back to the terminal


4. Installing phpMyAdmin

Coming soon ...

Is This A Good Question/Topic? 3
  • +

Replies To: SUSE: setting up LAMP(apache2 + MySql + PHP5 + phpMyAdmin)

#2 shadowstep0705  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 48
  • Joined: 26-May 10

Posted 30 January 2011 - 12:58 AM

This post is reserved
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1