Quickly Deploy LAMP Stacks with ServerPilot

serverpilot

The best way to run PHP websites, and it’s free

I have yet to use ServerPilot, but will be setting up a new VPS at DigitalOcean in the coming weeks for a new venture. ServerPilot makes getting a LAMP stack setup very quickly.

ServerPilot will automatically install Nginx, Apache, PHP, and MySQL on a new, freshly installed/created, 64-bit Ubuntu 12.04 or Ubuntu 14.04. So if you’re using DigitalOcean, create your Droplet, and SSH to it. You should be able to harden SSH up a little, but make sure you don’t install any new packages yet.

Getting Started

Getting started with ServerPilot is crazy easy. All you need to be able to do is SSH into your server and run a command. I highly doubt anyone reading this doesn’t know how to do this. If you don’t, Google will tell you how.

1. Sign Up

Sign up for a free account with ServerPilot.

2. Connect A Server

“Connect” a new server. Just enter your servers hostname and click the “Continue With Setup” button. Screenshot below.
serverpilot-connect-server

3. Run The Install

Connect to your server via SSH. Remember, it must be a new server, preferably with no additional packages installed yet. To install Nginx, Apache, PHP, and MySQL, run the command below, from this gist:

The --server-id and --server-apikey values will be provided for you, they’re blacked out in the screenshot below.
serverpilot

Additional Information

On GitHub

ServerPilot also has a GitHub account with two repositories currently. One is ServerPilot/Vagrantfile and the other is ServerPilot/API.

ServerPilot/Vagrantfile

This repository provides a sample Vagrant configuration for testing ServerPilot. Basically a server that you can use to test ServerPilot before using it on a new, paid VPS. The README is very detailed, definitely read it if you need help using Vagrant. There’s even an example on using composer to create a Laravel app.

ServerPilot/API

From the README, The ServerPilot API is RESTful and allows you to manage ServerPilot resources using HTTP requests. All responses return JSON objects, including errors. As seems typical from ServerPilot, the documentation in the README is excellent.

The API will let you do things like list servers, connect new servers, or list all system users, among many others. An example that would list all servers can be seen in the gist below.

That request would return JSON similar to this:

Do you use Vagrant?

View Results

Loading ... Loading ...

Paid Accounts

You get a pretty cool monitoring dashboard for $10/month. I found the screenshot below in a post from Jake Peterson, it appears to be the ServerPilot monitoring dashboard.
serverpilot-dashboard
There’s the free plan, obviously, and then two paid plans. One is $10/month and the other is $49/month. You can see what you get for your money on their pricing page.

End

If you’re a PHP developer and use a VPS provider like DigitalOcean or Linode, ServerPilot is probably worth checking out. Even if you don’t end up using, it’s pretty neat that something like this even exists.

I only have one feature I’d really like to see, the ability to select certain packages to be installed. If that were included in the $10/month plan, I’d definitely do it. As it stands currently, though, it’s definitely a time saver and very well executed.

Poor Man’s VPN With a Cheap VPS

SONY DSC

sshuttle is what makes me love the Internet

It really is awesome, sshuttle basically allows you to browse the web via your VPS, in my case, a DigitalOcean VPS. It works on Linux and MacOS.

The GitHub repo explains it better than I can.

Transparent proxy server that works as a poor man’s VPN. Forwards over ssh. Doesn’t require admin. Works with Linux and MacOS. Supports DNS tunneling.

It hasn’t been updated in two years, but, no need to fix or change something that doesn’t need fixing or changing.

So, Why? What’s the point?

I run some Tor relays, one out of my house, thanks Mediacom! ;)

Because of this, many websites block me. Kohl’s, Best Buy, no posting on 4Chan (understandable), even healthcare.gov is blocked. I don’t want to pay for one of the many VPN services. Here’s the message I get at healthcare.gov without sshuttle.

Access Denied

You don’t have permission to access “http://www.healthcare.gov/” on this server.
Reference #18.22ea4d17.1397361569.6bb6afe

VPN’s even provide vital Internet access to those facing government censorship, and worse.

Options

Setting up a secure VPN server on a linux box can be a pain, and definitely takes longer than 5 minutes. sshuttle takes about that, maybe, if you type really slow.

So, for me, when I found sshuttle, my heart was set, the other options didn’t matter.

Setting Up sshuttle On Ubuntu Flavors

Doesn’t get any easier than this. Run the following in a terminal:

Now, we’re basically going to SSH to our VPS/server. Again, run this in the terminal:

After running sshuttle -r [email protected] 0/0 -vv you’ll be asked for the root password. And sometimes, for whatever reason, it dies immediately after running the sshuttle command.

If sshuttle doesn’t work after running it the first time, run it again! It should work the second time. It could be something with the system I’m on, so hopefully this is isolated to me. :)

Setting Up sshuttle On MacOS

When someone donates me a new Macbook Pro 15″, I’ll start writing this stuff. :)
Update: April 21, 2014 Have a look at this post for using sshuttle with MacOS. Comes courtesy of Aaron Bull Schaefer in the comments.

And if I need a VPS?

You can find a VPS easily with Google. DigitalOcean has them for $5/month, which will be plenty sufficient to use specifically for sshuttle.

Other Options

Lots of other options have been mentioned in the thread at Hacker News. Check em out. Some really good suggestions that are sometimes even cheaper!

Flash TWRP .img File From Ubuntu Using Fastboot

twrp

I use TWRP (TeamWin Recovery Project) on my Nexus 4. Back in the day (read: 3 years ago) I used ClockworkMod Recovery, on my Moto Defy, but have since switched to TWRP. I believe there were some licensing issues that drove a lot of people away from CWM. In any case, you’ll want to install adb and fastboot before proceeding.

From an Ubuntu distribution (Xubuntu in my case):

After adb and fastboot have been installed, boot your Nexus 4 into fastboot mode. Just switch your Nexus 4 off, then turn it back on while holding the volume down button. Keep holding the down button until you see a menu (usually with an Android guy somewhere on the screen). Entering fastboot mode may be different for your device, check the TWRP site, they have instructions for a lot of different devices.

Now, make sure your PC sees your device in fastboot mode. In a terminal window, run fastboot devices. If nothing is printed to the terminal, something is wrong, you probably don’t have fastboot enabled. If you did see some output, you should be good to go.

Download the latest recovery .img file from the TWRP site. Current version as of this post is 2.7.0.0. To flash it using fastboot, do this in a terminal:

If everything goes well, you should see something similar to this:

sending ‘recovery’ (8130 KB)…
OKAY [ 0.510s]
writing ‘recovery’…
OKAY [ 0.476s]
finished. total time: 0.987s

If you see something other than OKAY messages, something is probably wrong, and I have no idea what. If you do see the OKAY messages, you can either reboot your phone to Android or go to recovery which will take you to TWRP. With TWRP you can make a nandroid backup, flash new roms, flash new gapps, and all kinds of other things.

Install All Google Web Fonts on Ubuntu, Easily

TypeCatcher

There’s a few different ways to install the Google Web fonts on your Ubuntu system. Web UPD8 provides a script that does it for you.

Another way is to use TypeCatcher, as suggested by Jack Wallen at TechRepublic. You can install TypeCatcher via a PPA, which means easy updates. No auto-updates with the script method, unfortunately.

To install TypeCatcher via PPA, open a terminal and run sudo add-apt-repository ppa:andrewsomething/typecatcher and then run sudo apt-get update && sudo apt-get install typecatcher. That’s it, TypeCatcher should show up in your applications menu. If you’re using Xubuntu, it’s under Accessories.

I’d never heard of TypeCatcher until I came across Jack’s post at TechRepublic. Installed it on Xubuntu 13.10 and fell in love with it. Just select a font, and click the install button, done. The featured image for this post is TypeCatcher with the Lato font selected. For more details on TypeCatcher, go read Jack’s post.

If you can’t use a PPA, or don’t want to, you’ve still got a good option for easily installing the fonts with the script from Web UPD8. If you’d like to see how the script works, you can download it here. It essentially just using Mercurial to install them.

For instructions on how to install the script from Web UPD8, head over to their post about it, everything you need will be there. See? I just linked it twice for ya.

How To: Make Ubuntu Recognize All Drives During Install

When Ubuntu 9.10 Karmic Koala came out, I did an upgrade on one of my machines instead of doing a fresh install. I decided it was time to do a fresh install after Ubuntu 10.04 Lucid Lynx came out.

I backed up all of my important files and some configuration files to a second drive, /dev/sdb. My previous Ubuntu install was installed on /dev/sda1 and I used the sdb drive for photos and videos.

When the installation got to the point of configuring partitions, I was a little bummed to see that my first drive, /dev/sda, wasn’t included in the list of drives and partitions. This machine needed a fresh install badly, so I posted on the Ubuntu Forums to see if anyone knew of a fix.

After a few days of no replies, gregmo posted and offered a solution. He suggested running the command below while running the live cd, prior to installing. This removes dmraid from the system running off the live cd.

After removing the dmraid package, I fired up the installer and was able to install to /dev/sda1 just fine. For some reason, removing the dmraid package allowed the partition manager to see /dev/sda.