Kevin Whitman's Blog

Tag: Virtual Machine

Free ChunkHost VPS

ChunkHost is giving away free VPS’es. They start at 128MB of Ram, 3GB of disk space and 35GB of bandwidth but the cool thing is, if you refer people you can get it upgraded to 2048MB of ram, 30GB disk and 600GB bandwidth which is great. I guess to them this is free marketing and if people like their free VPS, maybe they are hoping if you need a bigger one or a second one(maybe another project) that you’ll pay with one of the paid plans.

I signed up about 2 months ago and today I woke up to my email saying that it got created. The time for waiting might be different for you as I’m not sure how they allocate them.

I SSH into the server and set up a basic demo page. http://vpsdemo.keverw.com/. They offer Ubuntu 10.04LTS, Ubuntu 10.10, Ubuntu 12.04LTS, Debian 5 (lenny), Debian 6 (squeeze), CentOS 5.6 and CentOS 6.2 for the operating system choices. I’m using 12.04LTS as it’s the latest Ubuntu OS they offer. But if you really wanted the least release (Ubuntu 12.10 currently) I don’t see a reason why running the update commands from within 12.04 would stop you from updating. I think this small 128MB server would be great if you wished to host a small website to get yourself started. Great if you just want to play around with Linux, and if you screw up you can reimage it.

You can check out the part two of my guide of setting up a sandbox in a VM, scroll down to “Connect via SSH” to see how to connect and the commands to setup PHP, MySQL and PHPMyAdmin once you get your server created.

Disclosure: I linked to ChunkHost using my referral link. Hoping to get my VPS upgraded to the max, planning on hosting a future project on it that should be ready around mid 2013. If you signup you can do the same by sharing your referral link with friends and family via social networks, your own blog, etc.

I’ve been playing with Node.js

For about the past month and a half I’ve been playing with Node.js. Node.js is server-side JavaScript, using Google’s V8 JavaScript engine. Node.js can run a HTTP server, or any other type of socket connection. I’ve really only experimented with it’s HTTP server using the Express framework

I’m coming from a PHP background, so writing server backend’s in JavaScript while being asynchronous requires a slightly different mindset. In PHP, a user hits your Web server and Apache fork’s a new process, the PHP interpreter runs the script from top to bottom, then it gives the output to Apache and then dies. With Node.js, you have one process for the whole Web server. Also I find myself passing around the request and response objects a lot, unlike with PHP where you have a

start.php

or

config.php

file with variables accessible by any of the code. But after a while the stuff will come naturally to you.

I’ve started experimenting with writing a cloud based video encoding related application(not giving many details on that yet, not promising anything.) within Express, I use EJS(Embedded JavaScript) for template files so I can keep my application logic away from my views. I have configured my app I’m working on to have PHP styled open and close tags, since I’m used to template files being that way in PHP.

Another thing you have to do is define all your routes, guesses very similar to the frameworks like Ruby on Rails. Also with Express, I created a static file store to store my CSS, public JavaScript files, images and anything else I would want served statically.

Another thing I really love about Node.js is NPM(Node Package Manager). NPM is a package manager similar to apt-get that comes with Node.js. In the NPM, you can install modules, and publish modules. I’ve already wrote a few modules, to help me out on my own applications.

Some modules I wrote already are:

diskspace.js

A module to check how much free space, and total space the hard drive has. Node.js didn’t really have any native functions for this. This module works on both Linux, Mac and Windows. On *nix systems it uses

df -k 

and on Windows it calls a small little C# application I wrote called DriveSpace(My first C# app) that comes bundled with the module.

Revolver

A simple generic round-robin. Great for database connections pools.

MailKit

A simple but powerful email wrapper around Nodemailer. Also uses Basic Template, another tiny module I wrote.

Range Check

A module to detect if a IP is valid, it’s version and check if its within a certain range. I mainly wrote this to use in node_CloudFlare.

node_CloudFlare

I use CloudFlare to supercharge my websites. I wanted this in Node.js, and I couldn’t really find any existing modules, So I wrote my own.

datamask.js

A simple module to mask emails, domains and even regular strings! Will turn

[email protected]

into

[email protected]****le.com

HTTPRequest

A simple yet powerful HTTP request library inspired by jQuery and LSL written in JavaScript for client and server JavaScript. I wanted a nice and clean simple to use HTTP request library for both the server and client, so I wrote one.


So those are some of the modules I wrote so far. I really enjoy Node.js, but sometimes it feels overkill compared to just whipping out a

.php

and just writing something quickly. I guess I’ll get more used to Node.js and get better at it as time goes on. I also want to get in to mobile development, so I think Node.js would be a great tool to write backend’s in.

Set up a sandbox to test PHP Apps: Part 1, Set up the VM

In this short tutorial series I’m going to teach you how to set up a Linux Apache MySql PHP(LAMP). We will be using free and open source software for this tutorial.  The Linux operating system we will be using is Ubuntu 11.04, my favorite Linux distro. VirtualBox will be the virtual Machine we will be using, but most of this tutorial should work with other virtual machines. At the end of this tutorial you should have a working server which can run PHP scripts, also will have PhpMyAdmin for your database.

Tools you will need:

First lets download and grab all the tools we will need.

You can download VirtualBox for free at http://www.virtualbox.org/wiki/Downloads which works for both Mac and Windows, you can install this like a normal Mac or Windows app. Since i’m using a Mac right now, i’ll download the one for OS X hosts.

Next you will need the Ubuntu ISO. You can get that at http://www.ubuntu.com/download/server/download. I got the 32 bit version.

Next your going to want a way to SSH in to your server. On Mac you can use the Terminal. On Windows you can use Putty. You can download it at http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.

Your going to need a SFTP client to transfer files and understand how to use it. Check out my How to SFTP tutorial.

Last you need a text editor. You can use anyone really, it just needs to be pain text.

Set up the virtual Machine:

First you need to install Virtual if you don’t have it installed already. This is the same as installing just about any other app. Click the installer and follow the setup wizard.

After Virtual Box is installed, we have to then create a virtual Machine.  To start click on the new icon.

Continue reading

Copyright © 2010 - 2017 Kevin Whitman's Blog

Back To Top ↑