Tag: raspberry pi

Migration – Weekly Article Dump

Migration - Weekly Article Dump

Migration: Bye to the Pi

Well… it happened. If you checked in earlier this week, you might have noticed Dev Leader was completely down on Thursday. Quite a bummer… but the show must go on. Migration to a new host was necessary, but that wasn’t without some hiccups.

For me, having a site hosted was still a pretty new process. I had tried it a couple of times before, but running a web server that I controlled always felt better. Just more control I suppose. Migration started off sort of sour where I was required to re-install WordPress on my host a few times due to some technical difficulties… And of course, it was hard to sit still while I knew my site was down. Once I finally had WordPress launched, the only part of the migration that went smooth was having a backup of my site four hours before it went down. Talk about timing!

There’s silver lining in everything though, and this little migration blip was no different. My Raspberry Pi was a fun little box, but it wasn’t fast by any stretch of the imagination. Page loading times were a bit slow, and serving images could sometimes be terrifyingly slow. Now that the site is hosted, there should be a very noticeable performance improvement. Additionally, with the new host comes some additional reliability! That’s always awesome.

See? Migration wasn’t so bad after all, I guess! My list of things for any WordPress user to be doing regularly:

  • Back up your posts
  • Back up your comments if your readers are actively engaged in discussions
  • Back up the media you use on your blog
  • Export your plugin settings
  • Keep a list of plugins you have running

Even if you don’t have a plan for host migration any time in the near future, it’s always good to have the “worst case scenario” covered. The plugin BackWPup covers basically everything I mentioned above, so I’d recommend getting that setup if you don’t have any backup plan currently in place!

Articles

  • Feedback is the Breakfast of Champions: 10 Tips for Doing it Right: Anyone in a leadership position knows just how valuable being able to provide feedback is. Heck, anyone who is driven to improve themself craves feedback. Joel Peterson provides an awesome list of tips for being able to provide feedback. I’d say frequency, positivity, and confidentiality are among the top take away points from his list.
  • 10 ways to make your .NET projects play nice with others: First programming article in the list this week. I thought this one stood out because I think anyone working in a team has either heard some (most) of these or is trying to work through them. Troy Hunt has put together a list of 10 things that any developer working in a team should be conscious of to make sure their code plays well with their teammates. Number one on the list is the same as my number one. “Works on my machine” carries no validity. Why? Your customers don’t have your computer. It’s a frequent thing when working with the QA team and developers want to cover their butts… But it won’t cut it!
  • Only 13 percent of people worldwide actually like going to work: Had to share this one, because if the stat is real, it’s scary. It’s scary to think that almost 90% of people that go to work don’t actually like going. In Jena McGregor‘s article, this low rate is attributed to poor working conditions, job availability, and job engagement. On the bright side for us North Americans, we’re a bit higher at just under 30%. That’s still far too low for something we spend a majority of our lives doing. It’s important to find a company you can get behind, and I definitely lucked out with Magnet.
  • The New Science of Who Sits Where at WorkRachel Feintzeig shared an interesting article about seating in the workplace. I’ve shared some articles before about open concept offices and that I do enjoy working in them, but the seating perspective is pretty interesting. For example, changing your org hierarchy is one thing but unless people are changing their daily interactions, it won’t have that big of an effect. However, if seating arrangements are responsible for 40-60% of people’s daily interactions, simply moving people around will really stir the pot.
  • What is the Biggest Mistake Managers Make?: In John Murphy‘s article, he points out something that is probably less obvious than it should be. The biggest mistake a manager can make is focusing on the wrong things. He provides some steps to help align managers with the goals of their company to ensure that focus is in the necessary areas.
  • 8 strategies for successful culture change: Culture is something that is dynamic and always evolving within a company, but often there are things that are core to the company culture. What happens when you need to make some work culture changes? Michelle Smith shares some tips on how to approach a work culture shift.
  • Why Inspiring Leaders Don’t Sweat: Here was an article that hit home with me because I’m guilty of it. Panicking. Why is it bad if you’re panicking in a leadership position? The biggest problem is that your teammates will pick up on it and switch to a panick state too. It’s incredibly demotivating, and it’s usually at a time when motivation and inspiration is truly needed. In Steven Thompson‘s post, he talks about how and why to keep calm and lead on.
  • 3 Proven Ways to Make Tough Job Decisions: Jennifer Dulski discusses three approaches for helping make tough life and career decisions. At some point or another, most of us will be faced with making a decision in our career path that’s going to be difficult–difficult for you to decide or difficult for you to explain to those you’re close to. I think the “Sit With” approach is my favourite of the three.
  • 4 Ways to Have a Life Outside Your Business: This one should probably hit home with anyone working in a startup or running a business. Alexa von Tobel shares four tips for how to have a life outside of work and why having a life outside of work is necessary to be successful. I think something that’s often overlooked (somehow) is “me time”. I’m guilty of it too, but you get to a point when you’re not doing anything just for yourself. It’s great to be dedicated to your company and be passionate about your work, but it’s also importnt to step back, take a breath, and do something just for you.
  • 17 Things The Boss Should Never Say: Dave Kerpen has another great article on what not to say–this time from the boss’s perspective. Some of the worst ones in my opinion? Telling your teammates it’s only their problem (or not yours, at least) or being adamant about not evolving your perspective/processes. Some gems in there from quite a few business owners.
  • 9 Lessons From the World’s Best Mentors: This one is pretty quick from Chester Elton, but there’s a few different perspectives shared in here. Sone key points in my opinion are ensuring that you’re doing what you can to help others and not getting paralyzed by risk.
  • Key Reasons Delegating Is SO Difficult and What To Do About It: Most new managers and leaders have this problem. How do you delegate work? Perhaps you acquired your management or leadership position because you proved that technically you were very capable in your position. So how do you get others to do work you think you could be doing? Judith Sherven shares some insight on why being able to delegate is an incredibly important skill as a leader. After all, being able to grow as a leader means being able to effectively delegate responsibilities.
  • Want Greater Employee Engagement? Develop Intrapreneurs: In this article, Larry Myler talks about increasing employee engagement by developing intrapreneurs within your organization. It’s inline with what Tayun’s guest post was about the other week. Provide people autonomy and let them execute on their strengths. It’s a sure-fire way to increase engagement.

That’s it for this week! Hopefully there won’t be any more emergency host migrations any time in the near future (or ever again). Follow Dev Leader on social media outlets to get these updates through the week.

Nick Cosentino – LinkedIn
Nick Cosentino – Twitter
Dev Leader – Facebook
Dev Leader – Google+
Nick’s CodeProject Articles

You can also check out Dev Leader on FlipBoard.


Host Migration… Hang In There!

Well this is super embarrassing… But I had to do an emergency host migration from my Raspberry Pi to a more reliable service. It appears as though my Raspberry Pi is no longer with us. Quite a shame.

Anyway, my apologies for the downtime. Hang in there!

EDIT: Getting closer… I think all the posts are back up… New theme… I’m busy re-configuring plugins and then I have to go try and update all the missing graphics. Ugh. On the bright side, the site should be about 5x faster.

EDIT2: Just fixed up a handful of pictures. Not totally jazzed to go through them all right now, but I at least updated my popular articles. It’s definitely been a treat getting back up and running.


Raspberry Pi + WordPress => PiPress

Raspberry Pi

Background

In the past, I’ve dabbled a bit with hosting my own server on a spare outdated box that likely should have been thrown out. My least favourite thing to do is sit down and tinker with trying to get services and such configured so that they all work together… But once it’s working, it’s glorious. Enter the Raspberry Pi.

Earlier this year I decided I wanted to get a Pi. Why? I wasn’t too sure… But they’re cheap and nothing bad could come of it 🙂 Once I got the thing up and running I was reading about how people were using them. Hosting a WordPress site was definitely one of the uses, so I figured I’d try my hand at that. There are other guides on The Internet about how to do this, but this is what got me up and running.

Disclaimer: A *lot* of this is taken from IQ Jar where there’s been an absolutely amazing outline posted. Although I am repeating a lot of the same steps here, I wanted to post what I felt was a complete install guide. I found myself going back and forth between a few resources, so hopefully this will reduce that issue for you. I do very highly recommend you have a look at IQ Jar though.

Raspberry Pi: What & Where To Buy?

This part is pretty open ended. Let’s start with the “what” portion of things.

The Raspberry Pi is just the board. If you’re totally content with buying a board without a case that you can’t even power up, then you’re all set. Although, if that’s the case, you probably don’t need to read anymore of this! It’s common to pick up the following to get your Raspberry Pi working:

  • Raspberry Pi
  • Case
  • Power Adapter
  • SD Card

But once you’ve got those things, you still can’t do too much with your Raspberry Pi aside from powering it up. Some other things you’ll likely want:

  • USB Wireless Adapter
  • USB Keyboard
  • HDMI Cable

NOTE: Pay special attention to what wireless adapters and SD cards can be used with a Pi out of the box. You’ll want to save yourself the headache if others have confirmed the parts you’re looking at purchasing are compatible.

So now that you have an idea what things you’ll need to pickup, where do you get them? If you search The Googles for where to buy any of this stuff, you’ll probably get a ton of hits. Maybe that’s not totally useful for you. I’d suggest the following sites:

  • Amazon: I got everything I needed off of Amazon in one fell swoop. You can even find some combo deals that include the Raspberry Pi and a case. Heck, some even come with the SD card too!
  • ModMyPi: A great resource… There’s tons of options on this site and it’s specifically for the Pi. Probably can’t go wrong by looking here.
  • Ebay: Ol’ Faithful. Lots of options here too, just like Amazon. Bound to find something that fits the bill.
  • Newark: There are a great deal of product offerings and resources on Newark. Check them out for full packages, accessories, and additional guides/walk-throughs.

The Walkthrough

First thing: there are a million ways to do this. I’m not going to explore all the options here because I’m not an expert and because I want to provide you with my own steps that worked for me. As soon as I deviate from that… Things will get messy and complicated 🙂

  1. Download a Raspbian “Wheezy” image from the Raspberry Pi website. This is the image of the operating system your Pi will use.
  2. Download Win32 Disk Imager. You’ll need this to get the image of the operating system onto your SD card.
  3. Once both downloads have completed, run Win32 Disk Imager and use it to write the image to your SD card. You’ll need a card reader/writer in your computer, but this is pretty standard these days.
  4. Take your card out of your computer and pop it into your Pi. You should have your Pi all setup now with power, USB keyboard, USB WIFI adapter, and an HDMI cable plugged into your TV/monitor.
  5. When you power up your Pi, you should be taken to an initialization/configuration menu. If it ain’t working, there are a million and one trouble shooting guides.
  6. Some things I suggest you get going while you’re here:
    • Reduce graphics memory to the minimum (16). Should help with performance.
    • Give yourself a modest overclock. Not sure what’s deemed safe, but I went somewhere in the middle.
    • Enable SSH. Later on you’ll never even need to be near your Pi. I can actually control my Pi from my phone with this sweet app.
  7. Once you’ve got things how you want, expand the file system and reboot your Pi.
  8. When the Raspberry Pi is back up and running, you need to login to your credentials and then type “startx” and press enter. This will get you into the GUI portion of things.

Anyone well versed in *nix may not need or want to do this, but I found it easiest this way. At this point, get your wifi and everything setup. Your blog won’t be very useful if your Pi isn’t on the internet. Having the GUI portion of Raspbian will also let you quickly search the net and pull up articles if you’re running into any oddities with the components you bought. Anyway, now that your Raspberry Pi is working with all the parts you purchased, on with the rest of it:

  1. Open up a terminal. You’re going to need it for basically everything else in this guide. We’re going to start by turning your Raspberry Pi into a LAMP server.
  2. Type “sudo apt-get update” to update the various packages on your Pi.
  3. sudo apt-get install apache2” to download and install the Apache web server. You’ll want to say yes when it asks for confirmation (and same whenever this happens for the other packages we need to install).
  4. sudo nano /etc/apache2/apache2.conf” to open up the apache configuration. You’ll want to stick “ServerName localhost” at the very end of this file and then save and exit the editor. This will get rid of warnings about determining the server’s domain name.
  5. Restart apache by using “sudo service apache2 restart“. Amazing. You now have a web server.
  6. You’ll need to take care of any port forwarding to make sure your router does it’s job to get to your Pi.
  7. Next is installing PHP: “sudo apt-get install php5
  8. Type “ls /usr/lib/php5/” and take not of the entry that looks like “20100525+lfs“. Yours might be slightly different.
  9. sudo nano /etc/php5/apache2/php.ini” to open up the PHP configuration. Find the line that starts with “extension_dir” and change it so it looks like: extension_dir = “/usr/lib/php5/20100525+lfs/” (except with the name of the entry you have if it was different!)
  10. sudo nano /etc/apache2/apache2.conf” to open up the apache configuration. You want to verify you have this line in there: Include conf.d/*.conf
  11. Next up, you’re going to need to make a config file for Apache. This can be done by typing: “sudo nano /etc/apache2/conf.d/php.conf” and then putting the following text inside of the file:
    # PHP is an HTML-embedded scripting language which attempts to make
    # it easy for developers to write dynamically generated webpages.
    LoadModule php5_module modules/libphp5.so
    #
    # Cause the PHP interpreter to handle files with a .php extension.
    AddHandler php5-script .php
    AddType text/html .php
    #
    # Add index.php to the list of files that will be served as
    # directory indexes.
    DirectoryIndex index.phpSave and close nano when you’ve finished.
  12. To improve the performance of PHP, install APC by typing “sudo apt-get install php-apc
  13. Now that you’ve finished that, restart Apache: sudo service apache2 restart

Next we need to get MySQL up and running. This is going to serve as the backend for your WordPress installation.

  1. sudo apt-get install mysql-server mysql-client
  2. Follow up with the MySQL plugin for PHP: “sudo apt-get install php5-mysql
  3. Now that you’ve finished that, restart Apache: sudo service apache2 restart

Next we’re actually going to install wordpress!

  1. In your terminal: “sudo wget http://wordpress.org/latest.tar.gz
  2. Then extract the whole thing: “sudo tar -zxvf latest.tar.gz
  3. From here, you can either follow along with the official WordPress Setup instructions, or just do what I did. If you want to do what I did, just keep following here!
  4. We need to make a user in MySQL:
    1. In the terminal: “mysql -u <YOUR_ADMIN_USERNAME> -p” and hit enter.
    2. (Obviously where it says <YOUR_ADMIN_USERNAME> you should replace with the database admin username you picked)
    3. Enter your password as the prompt suggests and press enter.
    4. Next up: “CREATE DATABASE wordpress” to make the database named wordpress.
    5. And now we set privileges: “GRANT ALL PRIVILEGES ON wordpress.* TO “wordpress”@”localhost” IDENTIFIED BY “<YOUR_PASSWORD>”;” and press enter.
    6. (Again, it’s hopefully obvious to replace <YOUR_PASSWORD> with your password)
    7. FLUSH PRIVILEGES
    8. And then finally “EXIT
  5. For my install, I put WordPress right at the root of my website. To do this, we need to copy the contents of the wordpress directory to your /var/www/ directory, but we’re *NOT* copying the wordpress directory itself there: “cp -a wordpress/. /var/www/
  6. And now, we run the install script! Since we installed WordPress to the root of the website, we go to http://127.0.0.1/wp-admin/install.php in a browser. Follow the few simple steps there and you should be up and running!
  7. Remember to check the troubleshooting section on the WordPress site if something seemed to go wrong!

That’s it! You should be up and running.

What’s Next?

You might find your site is a little slow. That’s somewhat expected on your little Rapsberry Pi. Don’t fret. There are lot’s of methods for optimizing your site.

  • Check out WP Super Cache, or specifically, the guide over at IQ Jar for more information on tweaking this (it’s near the bottom of the post).
  • There’s minifying plugins for javascript and CSS files. This can do a nice job compressing the files and reducing how much data has to be transferred.
  • You can look at something like Smush.it to help with compressing your images that you serve. Again, smaller means faster.
  • Finally, you might want to test your site on GTmetrix to see if it can recommend any other optimizations to you.

Summary

To wrap up, I hope you found this guide informative. I thought a Raspberry Pi was a great way to start a little DIY project at home and it was fun to get a blog up and running on it.

References

I’m sure I consulted a million and one guides on the Internet, but the following that stick out to me (and I highly recommend you look into them):

  • IQ Jar: Crucial for getting me up and running. Specifically, these two guides here and here.
  • WordPress.com: The detailed guide here for installing WordPress once you have all the prerequisites was definitely necessary.
  • GTmetrix:  Serving content was relatively new to me. Once I was analyzing my page with this site, I was lead down a rabbit hole of different things to try and optimize. I highly recommend it!

  • Nick Cosentino

    Nick Cosentino

    I work as a team lead of software engineering at Magnet Forensics (http://www.magnetforensics.com). I'm into powerlifting, bodybuilding, and blogging about leadership/development topics over at http://www.devleader.ca.

    Verified Services

    View Full Profile →

  • Copyright © 1996-2010 Dev Leader. All rights reserved.
    Jarrah theme by Templates Next | Powered by WordPress