Wednesday, 1 August 2012

How to Install Apache in Puppy LINUX

Posted by Gary Newell  |  at  23:36 14 comments

Introduction

I recently wrote a post entitled "5 Ways To Use Puppy Linux" which gives a short list of possible uses for Puppy LINUX.

One of the ideas mentioned was to use Puppy LINUX as a small development web server enabling web development on the move. Simply take your laptop/netbook and a USB pen drive pre-installed with Puppy LINUX and the LAMP stack and you can develop web pages whilst travelling on the train. Someone left a comment asking how this could be done.

This is the 1st of a series of posts detailing how to set up the LAMP stack within Puppy LINUX.

Initial Setup

I have taken a 2gb USB drive and I have installed Lucid Puppy on it as this is the easiest and for me most complete version of Puppy LINUX.

I installed Firefox and set up the wireless connection and then I created a 512mb save file and rebooted the PC.

The following steps will show you how to install Apache within Lucid PUPPY.

Installing Apache

1. Click the install icon on the top row.

2. Click the "Configure Package Manager" button in the bottom left corner.

3. Select the 3 Ubuntu repositories and click OK.
4. Exit the installer and restart it by clicking install again.

5. Type Apache into the find box and click "Go"
6. Click the Apache HTTP Server Metapackage

7. Click the examine dependencies button

8. Install the selected packages
9. Run through all the installers until all the packages are installed

10. Open a console a nd type /etc/init.d/apache2 restart


11. You will receive an error stating that libaprutil-1.so.0 could not be found. You now need to install this from the repositories. Click install to bring up the package manager and type libapr





12. Install the libapr-1 package.

13. Install the libaprutil1 package
14. From the console window type /etc/init.d/apache2 restart again. You will get a window just like the one above.
15. Typing Apache2 brings up the real issue which is that httpd.conf could not be found. Go to /etc/apache2 and type "nicoedit httpd.conf". Nicoedit is the default editor within Lucid Puppy.
16. Enter the following line in the Nicoedit window DocumentRoot "/var/www/htdocs"
17. Save the file

NB: You can add all the httpd.conf commands you would normally use within httpd.conf. The steps above create a basic shell required to get Apache running


18. Type /etc/init.d/apache2 restart again. Still it does not work.

19. Type adduser  www-data. When asked for a password you can just press return. (Although adding a password would make it more secure the point of this exercise is to set up a development server for when you are on the move).

20. Type /etc/init.d/apache2 restart again. Still it does not work.This time you get an error about missing modules.

21. The above screenshot gives the commands that need to be entered to load the modules in.
a2enmod authz_host
a2enmod mime
a2enmod alias
a2enmod setenvif
22.  Type /etc/init.d/apache2 restart again. Still it does not work but we are getting close now. The error is basically stating that the folder we set in httpd.conf does not exist. Enter mkdir /var/www/htdocs.



23. Type /etc/init.d/apache2 restart again. It should now work.
24. Navigate to /var/www/htdocs and create a file called test.html.
25. Enter the following code into test.html

<!DOCTYPE>
<html>
<head>
<title>Testing Apache for the 1st time</title>
</head>
<body>
Testing Apache for the 1st time
</body>
</html>
 26. Open Firefox and type http://localhost/test.html.

Summary

It took a fair bit of effort getting Apache working but it is possible to do so and as you can see from the screenshot above it runs.

This guide should not be used to create a production Apache server using Puppy. The concept of this guide is to get a working version of Apache within Puppy LINUX for use as a development platform when on the move.

The next guide will show how to install PHP.

Thanks for reading.














14 comments:

  1. Waiting for "How to install Oracle in Raspberry Pi"

    ReplyDelete
    Replies
    1. I think that may be pushing the boundaries a bit too far

      Delete
  2. Overkill! Try mini-httpd or one of the many other lightweight webservers. Or just cd to the
    directory in question and run:
    sudo python -m SimpleHTTPServer -port 80 > somelogfile &

    ReplyDelete
  3. Part 2 now available (How to install PHP in Puppy Linux
    (http://everydaylinuxuser.blogspot.co.uk/2012/08/how-to-install-php5-in-puppy-linux.html)

    ReplyDelete
  4. hey can you explain more steps: "15-17"
    "15. Typing Apache2 brings up the real issue which is that httpd.conf could not be found. Go to /etc/apache2 and type "nicoedit httpd.conf". Nicoedit is the default editor within Lucid Puppy.
    16. Enter the following line in the Nicoedit window DocumentRoot "/var/www/htdocs"
    17. Save the file"
    thanks...

    ReplyDelete
  5. I mean how to go to "/etc/apache2"..in console?

    ReplyDelete
  6. Open a console window by clicking the icon on the top row.

    Now type cd /etc/apache2
    Then you can type nicoedit httpd.conf

    and so on....

    Alternatively you can do it in one command by typing nicoedit /etc/apache2/httpd.conf

    ReplyDelete
  7. Thank you Gary..."nicoedit /etc/apache2/httpd.conf" command opened a completely blank text file.
    Then I typed: "/var/www/htdocs" (step 16)
    and saved (step 17) the file.
    then I had typed "/etc/init.d/apache2 restart" in console and the result is:
    "Restarting web server: apache2 ... failed!
    You may still have some apache2 processes running. There are
    processes named 'apache2' which do not match your pid file,
    and in the name of safety, we've left them alone. Please review
    the situation by hand.
    apache2: Syntax error on line 212 of /etc/apache2/apache2.conf: Could not open configuration file httpd.conf: No such file or directory"

    please help me to do solve this. I am new to puppy world...thx...

    ReplyDelete
    Replies
    1. Rather than use the comments section of the blog to troubleshoot it would probably be better to do troubleshoot via email. My email address is everydaylinuxusergmail.com. (Replace the with the symbol).

      Off the top of my head have you finished all the other steps in the sequence?

      Is the path within apache2.conf pointing to a different folder for httpd.conf? (in a console type niooedit /etc/apache2/apache2.conf and look at line 212).

      Delete
  8. Thank you so much! Your perfect Howto end's frustrated years I often use OS, I do not like, because I'm not know, how to set up apache with php in puppy. Thank you from Berlin Germany

    ReplyDelete
  9. You provide great knowledge of Puppy LINUX as a small development web server and also its installing steps.it can help more who are unknown and finding this criteria.you should carry on.

    ReplyDelete
  10. Hi I also need help with step 15-17. When I type /etc/apache 2 and pres enter it says sh:/etc/apache2: is directory
    Then I type nicoedit httpd.conf end it open a NicoEdit and say Unable to open file!
    What to do next? What name do I use when I have to save? DO I type all of this DocumentRoot "/var/www/htdocs" in text file or just "/var/www/htdocs"

    ReplyDelete
  11. why is the first picture the wrong way?

    ReplyDelete
  12. In the step on installing "libaprutil . . .", the screenshot shows loading package
    libaprutil1-dbd-sqlite3_1.3.9+dfsg-3build1

    This did not work for me, and so I installed the package above it:
    libaprutil1_1.3.9+dfsg-3build1

    After this was installed, I was able to proceed.

    Later, there is an error saying "Invalid command 'Order', perhaps misspelled . . ."
    This is resolved by the actions in step 21 invoking "a2enmod". You might want to clarify this in the notes.

    I am grateful for these instructions, and look forward to the next step. Thanks

    ReplyDelete

Feel free to comment on any of the blog posts. Please try to be constructive.

Offensive messages will be removed as will blatant adverts for misleading products and sites.

Thanks for visiting my blog

    Popular Posts



back to top