Installing LAMP On Ubuntu For Newbies

Discussion in 'HOWTO-Related Questions' started by aromaman, Aug 19, 2007.

  1. aromaman

    aromaman New Member

    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 for ServerName"

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


    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:
  2. falko

    falko Super Moderator ISPConfig Developer

    What's in /etc/hosts, and what's the output of
    hostname -f

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

    aromaman New Member

    Thanks for your response falko. Here are the answers:-

    What's in /etc/hosts? - localhost 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!:) :)

    Last edited: Aug 21, 2007
  4. falko

    falko Super Moderator ISPConfig Developer

    Please set up your hostname as shown in chapter 6 on
  5. aromaman

    aromaman New Member

    Hi falko,

    When I vi /etc/hosts this message appears

    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

    [email protected]:/home/don# hostname
    [email protected]:/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 localhost 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. :)
  6. falko

    falko Super Moderator ISPConfig Developer

    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: :)

Share This Page