PDA

View Full Version : Installing LAMP On Ubuntu For Newbies


aromaman
19th August 2007, 14:11
I used the above how-to guide but hit the following problem.

After installing Apache, when I restart it, at step 3, I get the comment

"Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName"


Then when I point my browser to http://localhost/ I get the message

"Forbidden

You don't have permission to access / on this server.
Apache/2.2.3 (Ubuntu) PHP/5.2.1 Server at localhost Port 80"


Also, after installing PHP and setting up the testphp file when, at Step 4, I point to http://localhost/testphp.php I get the message

"Not Found

The requested URL /testphp.php was not found on this server.
Apache/2.2.3 (Ubuntu) PHP/5.2.1 Server at localhost Port 80"

What have I done wrong? :confused:

falko
20th August 2007, 19:25
What's in /etc/hosts, and what's the output of hostname and hostname -f?

Did you put your test file into the /var/www directory? What's the output of ls -la /var/www?

aromaman
20th August 2007, 23:26
Thanks for your response falko. Here are the answers:-

What's in /etc/hosts? - 127.0.0.1 localhost
127.0.1.1 ubuntu-laptop

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

what's the output of hostname? - ubuntu-laptop

and hostname -f? - ubuntu-laptop

Did you put your test file into the /var/www directory? Yes.

What's the output of ls -la /var/www? -
total 16
drwxr-xr-x 3 root root 4096 2007-08-19 11:31 .
drwxr-xr-x 17 root root 4096 2007-08-19 15:53 ..
drwxr-xr-x 2 root root 4096 2007-08-20 10:28 apache2-default
lrwxrwxrwx 1 root root 21 2007-08-19 11:31 phpmyadmin -> /usr/share/phpmyadmin
-rw-r--r-- 1 root root 20 2007-08-19 11:23 testphp.php

Since posting my query on this forum I've found today, by luck, that there is a directory /home/don/www and if I load the testphp.php page into there it displays ok when I browse to http://localhost/testphp.php. I don't know how that directory came into existence, but if it works, it works!:) :)

Don

falko
21st August 2007, 18:40
Thanks for your response falko. Here are the answers:-

What's in /etc/hosts? - 127.0.0.1 localhost
127.0.1.1 ubuntu-laptop

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

what's the output of hostname? - ubuntu-laptop

and hostname -f? - ubuntu-laptop
Please set up your hostname as shown in chapter 6 on http://www.howtoforge.com/perfect_setup_ubuntu704_p3

aromaman
22nd August 2007, 22:25
Hi falko,

When I vi /etc/hosts this message appears

E325: ATTENTION
Found a swap file by the name "/etc/.hosts.swp"
owned by: root dated: Wed Aug 22 19:11:47 2007
file name: /etc/hosts
modified: YES
user name: root host name: ubuntu-laptop
process ID: 6442
While opening file "/etc/hosts"
dated: Thu May 24 23:00:57 2007

(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.

(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /etc/hosts"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/.hosts.swp"
to avoid this message.
"/etc/hosts" 10 lines, 249 characters
Press ENTER or type command to continue

I chose the vim -r option and then got the message

Using swap file "/etc/.hosts.swp"
Original file "/etc/hosts"
Recovery completed. You should check if everything is OK.
(You might want to write out this file under another name
and run diff with the original file to check for changes)
Delete the .swp file afterwards.

I did rm /etc/.hosts.swp

then vi /etc/hosts (didn't get the ATTENTION message this time) and copied/pasted the first two lines as per your howto. I could not find a command to save the file so I closed the window, rebooted the system and got

root@server1:/home/don# hostname
server1.example.com
root@server1:/home/don# hostname -f
hostname: Unknown host

Now I did vi /etc/hosts and got the ATTENTION message again and then pressing enter to continue got

127.0.0.1 localhost
127.0.1.1 ubuntu-laptop

As you will have noticed, I don't really have a good idea of how Linux works, so I'm just following procedures more or less blindly. That seems to be more appropriate in Windows than Linux, so I have decided that I will continue to use Ubuntu for all the other things that it does well for me but go back to XP and use WAMP until I've moved further up the learning curve on Linux.

Thanks a lot for your time and help. :)

falko
23rd August 2007, 20:36
If you have files like /etc/.hosts.swp this means that someone else is currently editing /etc/hosts, or more likely, that you simply closed the shell while you were editing /etc/hosts (without saving and leaving vi).

If it happens again, delete /etc/.hosts.swp (rm -f /etc/.hosts.swp) and read this little guide: http://www.howtoforge.com/faq/12_15_en.html :)