Tagged with ubuntu

Installing Node.js on Ubuntu the easy way

I’m still very new to Ubuntu, but even so have found installing Node.js to be pretty easy.

You could follow the instructions on Nodejs.org to get it up and running. Or you could do what I did and use this excellent ShellScript by Ruslan Khissamov.

I chose to go this route as:

  1. I’m impatient and want to get going in Node as soon as possible
  2. It also installs the Node Package Manager (NPM)
  3. You can configure it to install the database of your choice at the same time

Using the ShellScript to install Node.js and MongoDB

1: Create the configuration

Using the radio buttons and checkboxes select which Ubuntu Package Manager (UPM) and database you want to use, and whether you want to install the Cloud9 IDE. As you make changes you’ll notice the text to the right of the buttons changing reflecting your choices.

I have chosen the default UPM apt-get, MongoDB and also to install Cloud9.

2: Create the ShellScript file

You can use a text editor to create the file, or use the code provided to do it for you. Open a terminal window and paste the following:

cd ~/
nano -w node.sh

This makes sure you’re in your home directory and creates a file called node.sh, opening it in Nano. Nano is a text editor that runs in the terminal.

Paste the script that you configured into the text editor. It should look something like this:

Press Ctrl+X followed by Y to exit Nano and save the changes.

3: Run the ShellScript file

Paste this into terminal to run as administrator – you will be asked for your password.

chmod +x node.sh && sudo ./node.sh

When you enter your password the script will run, downloading and installing Node.js and anything else you selected.

For me this took about 5 minutes, but it will depend on the options you selected, and your internet connection speed. When everything is finished you’ll be presented with your normal terminal prompt. Mine looked like this:

All done, Node.js is installed!

A quick reboot, and there you have it! Node.js, NPM, MongoDB and Cloud9 IDE all installed in a few minutes. I told you it was pretty easy!

Tagged , , , , ,

First time with Ubuntu: impressions from a Windows user

I’m starting off with a fresh install of Ubuntu 11.10 inside a VirtualBox on Windows 7. Here are my impressions as a long time Windows user and occasional Mac user.

My last foray into Linux was a brief stint with Suse Linux about 10 years ago. I didn’t really get on with it.

Ubuntu 11, however, seems to be better thought out, and easier to get on with. It bears more similarities to Mac OSX than to Windows, so if you’re used to Mac’s at all then you’ve got a good headstart.

What do you mean there’s no C drive?

If you’ve used a Mac at all this won’t be too strange to you, but if you’re Windows only then this takes a bit of getting used too. Essentially, everything is based of the root of the machine, like a C: drive, but it’s not named. So rather than having C:\MyFolder, in Linux you have /MyFolder.

This continues when you add external devices or network drives. Rather than adding as a lettered drive, they “mount” a device name into the /media folder.

The launcher

Much like the Windows taskbar or OSX dock, this has a bunch of icons in it that launch programs. Easy!

Switching between programs

Alt+Tab works just that same as in Windows and OSX. Lovely!

The terminal

Almost everything I’ve ever read to do with Linux has involved the terminal, which is essentially the Linux version of the Windows command prompt. So I was surprised that it wasn’t immediately obvious and accessible in the default Ubuntu installation.

It’s easy enough to remedy though: from the dashboard start typing a search for ‘terminal’ and the icon will display – you can drag this into the launcher. Or my preferred option – as a fan of keyboard shortcuts – is to press Ctrl+Alt+T to launch the terminal.

Copying and pasting in the terminal

Much like the Windows terminal you can’t Ctrl+C / Ctrl+V to copy & paste. Ctrl+C in fact will cancel the current operation.

But you can right click and select copy/paste. Ctrl+Shift+Insert also works for copy and Shift+insert for paste.

Running a command with Admin priviledges

This one’s simple, put sudo at the start of the command. For example instead of:

usermod -a -G vboxsf yourusername

use:

sudo usermod -a -G vboxsf yourusername

What else? You tell me!

Clearly I’m pretty new to Ubuntu, so please share your tips to help me and other Windows users get the most out of Ubuntu.

All help is greatly appreciated. Thanks :-)

Tagged , ,

Ubuntu for the first time – installing on VirtualBox on Windows

The first part of my journey towards learning Node.js – after years working on Microsoft stacks – is to get started with Linux. I know Node has a Windows installer now, but I want to be deploying production sites on Linux, so I need to get used to it.

After far too little research I’ve decided to start off with Ubuntu. It’s pretty widespread and mature, has great support out there in the web, and is available at loads of web hosts.

I don’t want it to be my main OS right now, and I don’t want to get a new machine to put it on, so I’ve gone the Virtual Machine route. Fortunately my laptop is beefy enough to handle it alongside Windows 7 – it’s a Core i7, 8GB RAM with SSD hard drive – the only limiting factor is the size of the drive. Here’s how I’ve got it running.

1: Download Virtual Box

2: Download Ubuntu ISO (just the normal Ubuntu, not Ubuntu Server)

3: Follow these tremendously easy instructions

And KABOOM! Three steps and five minutes later Ubuntu is up and running.

Ubuntu running in VirtualBox on Windows 7

Ubuntu running in VirtualBox on Windows 7

Sharing files between Windows and the Ubuntu VirtualBox

One thing you’re going to want to do to get the most out of this setup, is create a shared folder that both Windows and the Ubuntu virtual can access.

I found various references for how to do this on the web, some worked, some didn’t. This is the process that worked for me – you may not need all of the reboots, but it’s pretty quick to do, so no harm done.

1: Create share in Windows

Create a folder in Windows (or select an existing one)

Right click on the folder and select Properties >> Sharing >> Share

2: Install Guest Additions on Ubuntu

Boot up your Ubuntu virtual machine and log in

From the Devices menu select Install Guest Additions, and select to autorun the program when asked

When the installation has finished, reboot Ubuntu

3: Add the shared folder to Ubuntu / VirtualBox

With Ubuntu running in VirtualBox select Shared Folders from the Devices menu

Click the “+” icon to add a new share, select your folder in Windows and give it a share name. Select both the Automount and Make Permanent options.

Click ok to mount the share to your Ubuntu system in the location /media/sf_your-share-name (eg: the above goes to the location /media/sf_WinLinShare)

4: Give yourself access to the share

Finally you need to give your Ubuntu user the permissions to access this folder. The share is created with access granted to the usergroup vboxsf so you need to join this group. Open a terminal window and – replacing yourusername with your actual Ubuntu username –  type:

sudo usermod -a -G vboxsf yourusername

Reboot Ubuntu and you’ll be able to access your share in /media/sf_your-share-name and easily transfer files between your Windows host system and Ubuntu guest.

Tagged , , , ,