Showing posts with label setup. Show all posts
Showing posts with label setup. Show all posts

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 www.instructables.com/id/Raspberry-Pi-Web-Server/. 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.

Tuesday, 9 October 2012

Is there life?

Many ideas have been swirling in my head of late, for this project.  However, they are all far into the future for now.  Right now, the key critical thing is to get one of my RPi boxes active with a standard generic OS.

So, lets recap what ingredients I am putting into this stock-standard mix.
1 - Rpi Version 1 board inside a perspex case
1 - micro USB, 1A power supply
1 - HDMI -> DVI dongle
1 - 17" LCD monitor
1 - SanDisk 8GB 10 SD Card
Medion cordless keyboard and mouse

For the software side, I have the latest "Wheezy" image
2012-09-18-wheezy-raspbian.img

Setting up the SD Card
This went rather smoothly.  Simply follow the instructions presented at RPi Easy SD Card Setup.

Plug it in and Go!
Next was the easy step of plugging everything in and letting rip.  Since there is no on/off switch for the RPi, it starts as soon as you plug the micro USB adapter in.  Very quick to start up.  in under 20 seconds, Wheezy has loaded, and has opened the Raspi-config screen.  One small problem here for me, the wireless keyboard and mouse are not supported.

There are essentially two options that I have at this point.  The first, is to find a spare USB keyboard and USB mouse and plug them in - not so easy at 9:30 pm at night.  I do have a spare PS2 keyboard, and a semi functional USB mouse, but I'd need an adapter dongle.  The second option (I think), if the RPi has loaded its OS enough that it can network and accept telnet commands is to network it, and remotely take control - though I'm not sure how this will go given the config screen it is currently displaying.

Why Not Remote From Word 'Go'?
Perhaps I am over cautious, but one rule I have is not to network something until you have secured it.  Out of the box, the wheezy image is not secure.  It's preset login account has its name and password posted to the Internet.  However, if I can network it and remotely login, I should be able to secure it with a password change, and passwd the root account in a reasonably short space of time.  So I will try that.

Apart from a bit of cable management - my routers and switches needed some switching around to fit my RPi into the subnet that I wanted it - this step was fairly simple.  Thank goodness for good old PuTTY!  Started an SSH session with the RPi, and was able to reset the pi user password, and the root user password.

Interesting to note, that in the PuTTY session it has shown the message "NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'".  Excellent.  So that's the next step.



On running the config, you'll see a number of options.  The info screen is just a short paragraph that recommends using this config tool earlier rather than later - before making any major changes of your own to the set up.

'expand_rootfs' is an option that I'll explore later.  As noted in the RPi Easy SD Card Setup page, the standard image is only 2GB.  I'm running an 8GB SD Card - so there is spare space there.  The RPi Resize Flash Partitions page talks you through the options of expanding this existing partition, or creating a data partition.  For now, I'm going to leave this.

'overscan' is an option I have not heard of before.  When you enter the screen for it, there is simply the option to enable or disable.  I need to research this more.

'configure_keyboard' is an option I'd really like to fix - given my issues so far.  Upon entering this option, the screen reverts back to the command line for a few seconds to load the keymap.  It sets the preliminary keymap, and then returns to the config screen.

'change_pass' - already did that through the PuTTY session directly with the 'passwd' command.

'change_locale' is an interesting option.  Again, this will quickly leave the config screen to the command line to load some values, then brings up a new config screen.



For Australia, not sure what to pick on this screen so I will go with the advice of picking a UTF-8 locale code.  My selection leads to another config screen, which appears to indicate that I have selected a locale that has access to english_Great Britain character set.



Selecting OK here, then leads back to the command line, whilst the locales are generated.  When finished it will return you to the main config menu.

'change_timezone' - at the moment I need timezone Lima - UTC +11.  Lets see what's set.



First screen allows you to select the geographic area.  For those in Australia, simply scroll up this list to find it.  From there I'll select Canberra as the nearest city to where I live.



Done.

'memory_split' - I will investigate and get back to you.

'overclock' - I am interested in using this option as I have heard that the 700MHz CPU can clock up to 1GHz when performing particular operations.  For now, I'll leave it as stock standard.

'ssh' - This I suspect is as the menu describes, a toggle option for SSH server functionality.  Either enable or disable.  Given my current session was started under SSH, I'd say the server in the wheezy image is enabled by default.

'boot_behaviour' - this option gives you a vote to start straight to the desktop on boot - Yes or No.  For now, I'm going with No.



'update' - note the uncertainty of this option.  The menu description says 'Try to upgrade raspi-config'.  I suspect that from the description, this will not upgrade the kernel or any Linux modules, other than this very config module.

Back to the Books
So for now, there are some items for me to research and explore, and return to later.  So I'll finish with the config.  This leads to the option to reboot now, which I will.  Unfortunately, upon reboot, I am still in the state where I can not use the box on its own - I still need to configure the wireless keyboard and mouse.  Something more for me to research for the next post.