Saturday, 8 December 2012

Immediate Needs

Well it has been a while since I have had a serious play with my RPi machines. Part of the issue being our power bills – really wanting to bring those down, meant redesigning our home network. In the end I removed two big boxes, a router and a switch. Which should reduce our power consumption by a good 5kWh per day or more. But still the power bill and usage is high. It needs to come down for both the sake of the environment, and so I don't need a second job.

So with this in mind, I am going to turn my first two RPi boxes to two particularly dedicated causes. One being that of a web server for both internal and external facing sites, the second as a CUPS server.

Given that I have not decommissioned, nor do I currently run a web server, why would I do that? Is that not just creating another machine to run and draw power? Yes and No. Currently my wife and I have about 6 different 'sites' (blogs, sites etc) with freely hosted arrangements. As we expand upon what our Internet communications are doing for our professional lives, we will want to adapt our web sites, and this is likely to mean paying for web hosting. Why not run our own server, and with the money saved in hosting costs, cover a little more power usage?

The CUPS server is another no-brainer once I thought more about it. Whilst I have taken to shutting my desktop machine down at night/in the morning, I often come home to find that it is on. That's because my wife has been doing some printing, and it is my desktop that shares the printer to our home network. I think a CUPS server that can be on 24/7 might be more the go.

So with these two challenges in mind, I have set off to get it done.

Web server.
Where to start? Simple, lets do this the professional way and start with the requirements.
Web server capable of serving up a number of sites. Preferred server-side script is PHP. Preferred DB is MySQL. So a LAMP server it is then! With phpmyadmin too please!

Without too much trouble I did a quick search for blogs/posts about this and first hit I found was at Good post by drcurzon, lots of screenshots and easy to follow, step-by-step instructions – hence I am not going to make a hash of it by trying to reinvent it.

The one change I found necessary was in Step 9. If in the /etc/passwd file you comment out the pi user line (assuming pi is the user that you wish to use for FTP) you will not be able to connect via FTP, nor start a new SSH session. So from my experience, do not comment out this line. Merely observe that the running of the command “usermod -d /var/www pi” does change the default folder to open.

The only other problem I had I caused for myself by forgetting the credentials that I set for phpmyadmin. Eventually found them by going:
sudo nano /etc/phpmyadmin/config-db.php

Now the next trick will be to put my RPi web server into my DMZ, and ensure that I can connect to it for SSH and FTP, and web of course.