Steps for Getting Apache CouchDB from GitHub

First, I forked apache/couchdb to jakelevirne/couchdb (this was not absolutely necessary, but hey, why not).

Next, I clone my repo:

git clone git@github.com:jakelevirne/couchdb.git

Then, I set another remote to point to the Apache git repo:

cd ~/dev/couchdb
git remote add asf git://git.apache.org/couchdb.git

This way I can pull the latest updates from the Apache repo and have them locally (and push them back to jakelevirne/couchdb on github)

To get the latest updates from asf, run:

git fetch asf

See git fetch reference for details

And to merge these updates into local:

git merge asf/trunk

To push any changes back to jakelevirne/couchdb (so it stays up to date with asf):

git push origin trunk

To build from source for development, first follow Ubuntu directions for installing from source.  Specifically, don’t forget to:

Then I built and ran according to the instructions for Running CouchDB in Dev Mode:

cd YOUR_COUCHDB_CHECKOUT_DIRECTORY
./bootstrap
./configure
make dev

Edit ~/dev/couchdb/etc/couchdb/local_dev.ini to set the bind address to 0.0.0.0:

bind_address = 0.0.0.1

It’s always a good idea to run the etap tests (they just take a minute or two):

make check

Start up couchdb in dev mode:

utils/run

Configure logs (haven’t done this yet on couchdev box):

Additional resources:

Posted in Uncategorized | Leave a comment

Installing and Configuring Samba on Ubuntu Server

If you’ve been following along, you know I’ve already installed Ubuntu Server on a VirtualBox vm, configured networking and SSH, and gotten remote XWindows apps running on my Windows 7 host.  I just completed one last step to allow me to start developing on node.js… sharing my home directory out from my Ubuntu Server vm.

Originally I thought that I’d just use something like Xemacs or gedit through Xming to remotely edit my source files from Windows.  But, that’s turned out to be less than ideal for two reasons:

  • Font handling on Linux has me utterly confused, making my X apps just look plain weird
  • Running Firefox remotely through Xming feels slow and doesn’t allow me to easily do things like use Firebug’s “Open with editor…” command.

So instead, I’ve changed my approach a bit.  First, I’ve installed Cygwin/X as my X server of choice since remote X apps (like gedit specifically) look a little more normal in it.  Xming and Cygwin/X are based on the same underlying X.Org server, but the default font configurations under Cygwin/X make me happier.  Needless to say, I only use remote gedit for tweaking configuration files on my Ubuntu server (as you’ll see below).

For editing source files, I now just use E Text Editor on Windows and point it to a shared drive (J:) that’s mapped to my home directory on my Ubuntu server.

image
(That “Dev” directory on the left is actual ~/Dev on my Ubuntu server)

How’d I do it?  Thanks to this helpful How-To-Geek article and this one, it was easy.  I won’t re-write those articles, but I will point out some aspects of the smb.conf file that have changed since it was written.

First, I installed Samba and then used gedit to open the smb.conf file (after first making a backup):

sudo apt-get install samba smbfs
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo gedit /etc/samba/smb.conf

Thanks to my X setup, this faithfully popped up smb.conf on my Windows desktop (Xwindows is old technology, but still super-cool to me)

image

Here are my edits to the file, which as I mentioned are slightly different than pointed out in the original articles.  Under “Authentication”:

security = user
username map = /etc/samba/smbusers

Under “Share Definitions”:

[homes]
   comment = Home Directories
   browseable = yes
   read only = no
   create mask = 0775
   directory mask = 0775
   valid users = %S

Save it off, and follow the instructions for creating a Samba user.  For me it looked like:

sudo smbpasswd -a jake
sudo gedit /etc/samba/smbusers

And my /etc/samba/smbusers looks like this:

image

Now, in Windows, mapping a drive to <ubuntu vm ip>jake does the trick:

image

Posted in Uncategorized | Leave a comment

Using XMing to Run Remote Xwindows Apps from Ubuntu Server

In previous posts, I walked through the setup of an Ubuntu Server virtual machine using VirtualBox and then a setup of networking and SSH.  Now, we’re ready to run graphical apps (such as Xclock, xterm, or Xemacs) in windows on our host machine (or any other machine on our local network).

To do this, exit any PuTTY sessions you have open and download Xming onto your Windows host machine.  You’ll likely want the Public Domain Releases of Xming (currently 6.9.0.31) and Xming-fonts (currently 7.5.0.25).  Just install them both into the same directory, using all the default installer options.

After installation, startup PuTTY and create a Saved Session by typing the IP address of your Ubuntu Server vm (see this previous post on networking and SSH) and then typing a name under “Saved Sessions” (I typed “development”):

image

Next, expand the SSH node on the left hand side and then click on the X11 node.  Check “Enable X11 forwarding” and enter “localhost:0” for the X display location:

 

Go back to the Session node on the left hand side and click “Save”.  Now whenever you want to connect to your Ubuntu Server VirtualBox (make sure it’s running), you just have to double-click the session name in the list of Saved Sessions.

Login and you’ll see the standard PuTTY terminal.

image

Now you can run remotely run any X applications you want.  Let’s install some:

sudo apt-get install x11-apps

and then let’s run Xclock:

xclock &

image

There you have it… a graphical Linux application running on your Windows desktop.   You could bring up an xterm:

sudo apt-get install xterm
xterm &

image

Or even XEmacs:

sudo apt-get install xemacs21
xemacs &

image

With this setup, I’m feeling good about getting started with some node.js development.  In the future, I may setup a network file share so that I can work directly in Notepad++ or eTextEditor on my Windows machine.  But for now, I can use emacs or gedit and get the ball rolling.

Posted in Uncategorized | Leave a comment

Ubuntu on VirtualBox Networking and SSH

In the last post about Ubuntu Server 10.04 on VirtualBox, I walked through my creation of a new Ubuntu virtual machine step-by-step.  Here I’ll show you how I setup networking and secure remote logon.

By default, your virtual machine is setup in NAT mode.  This is fine if all you want to do is access the internet from your machine (which we did when running apt-get to update our system).  However, since I’m planning to use this as a development server, I want to this virtual machine to have an ip address of its own on my network.  In NAT mode, the virtual machine shares the IP address of the host.  So instead we’ll use Bridged mode.  In bridged mode, it looks to the host system as though the guest were physically connected to the interface using a network cable: the host can send data to the guest through that interface and receive data from it.  For more details, see the VirtualBox manual chapter on virtual networking.

Let’s get setup in Bridged mode.  First, shutdown your server by typing the following on the command line:

sudo shutdown -h now

Next, in the VirtualBox Manager, right-click on your virtual machine and choose Settings:

image

Under Networking, choose Bridged Adapter and under Name select the name of the physical network adapter on your host machine that you want to “intercept”.

image

Hit ok and start your server back up.  When you log back in, you should see the “IP address fort eth0” updated to an address on your local network.  To see your virtual machine’s IP address at any time, type the following at the command prompt:

ifconfig

And you’ll see something like this:

image

Which shows a bunch of details, including the IPv4 and IPv6 addresses for all of the machine’s network adapters.

Armed with this knowledge, we can setup SSH so we can bring up a terminal for this machine from any machine on our local network (in this example I’ll bring up a terminal window on the host).  First, we need to make sure the OpenSSH server is installed on our server.  If you did not choose to install OpenSSH as part of you Ubuntu Server install, no problem.  Just use apt-get to install it now:

sudo apt-get install openssh-server

Now, we need an SSH client for our remote system (in this case, I’ll SSH in from my host Windows 7 machine).  Download PuTTY, the most popular SSH client for Windows.  It’s very light-weight.  You can just download the single putty.exe binary and put it anywhere (e.g. on your desktop) and run it directly.  When you start it up, under Host Name, enter the IP address of your virtual machine (found above):

image

And click “Open”.  You’ll get a security alert since this is the first time PuTTY has connected to this computer:

image

Just hit “Yes” to continue.  (To learn more about SSH configuration options, including authentication alternatives, see this Ubuntu documentation on OpenSSH).  Now you’ll see a remote terminal for your server:

 

Login like usual, and you can now do everything you could do from the local command line in your virtual machine.  Now you can minimize your virtual machine, and forget it’s there =)

Theoretically, you can expose this virtual machine to the internet by configuring your router’s port forwarding appropriately, but that’s beyond the scope of this post.  Even if you don’t do that, you’ll see some more value to SSH support when we setup Xming in our next post.

Posted in Uncategorized | Leave a comment

Ubuntu 10.04 Server on VirtualBox Step-by-Step

I got it in my head that I want to play around with node.js but it doesn’t run on Windows.  So, the answer was to setup an Ubuntu virtual machine.  I’ve used VMWare player in the past pretty happily on vm’s that others have created.  But I don’t want to shell out the money for VMWare Workstation (and I’d really like to have snapshotting capability).  Enter VirtualBox

It seems to be as rich in features as VMWare Workstation, but it’s free.  I like free, so I downloaded VirtualBox 4.0.2 for my Windows 7 64bit host and it installed in a snap.

Next, I started looking for a pre-built Ubuntu Server image.  It was surprisingly hard to find one that looked good (especially since I’m used to the VMWare “virtual appliance” marketplace).  So I decided to roll my own.  I thought this would be painful… it wasn’t.

I downloaded Ubuntu Server 10.04 64-bit (I’m a bit short on disk space and memory, else I would’ve probably chosen Desktop).

While that was downloading, I created a new virtual machine in VirtualBox:

image

I named the machine Development and set the OS Type to Linux and the Version to Ubuntu (64 bit).

image

Set my memory to 1GB (you can always change it later).

image

Let it create a new boot hard disk.

image

Which started up a Create New Virtual Disk wizard.  I chose dynamically expanding storage (this disk will start out small and grow up to the maximum size you specify next).

image

I set it’s location to a directory in my home folder (use the little folder icon with a green arrow to change the location) and its maximum size to 20GB:

image

I hit Finish on both wizards, and voila, there’s my new “bare metal” virtual machine:

image

Hit Start to power it on, and you’ll get a nice First Run Wizard.  Hit Next and you’ll see Select Installation Media screen:

image

Hopefully your Ubuntu download has finished by now.  Because you’re going to hit the little folder-with-arrow icon and chose the Ubuntu .iso file you downloaded.  (Pretty cool that VirtualBox can just treat your .iso file like an actual DVD).

Press Finish and watch the virtual machine boot the Ubuntu DVD.  You can permanently dismiss the warning about 32-bit color and you’ll see the start of the Ubuntu installer:

image

The installer is keyboard driven, and if’ you’re in the US, you can just go through accepting all the defaults and you should be fine.  I literally hit enter on every screen except for the hostname screen, where I just gave my computer a name and the Partition Disks screen where I chose “Guided – use entire disk” and not “Guided – use entire disk and set up LVM”.  I don’t know much about LVM but I was worried it would not interact nicely with my Virtualbox “dynamically expanding storage”.  Anyone know if I was just being paranoid?

image

And for safety, the installer makes you actually select “Yes” on this screen:

image

I grabbed some tea while the installer did its thing.  I came back and told it my full name, username, and password.  I told it not to encrypt my home directory, and I don’t need a proxy to access the outside world, so I left that blank:

image

I chose “No automatic updates”… we’ll see how I used a tool called APT to manually perform updates.  And I “cheated” and made my life easier by having the Ubuntu installer setup Apache/MySQL/PHP for me (LAMP server) and OpenSSH:

image

If you do so, you’ll have to setup a MySQL “root” password.

For all the bootloader, you can just accept the default:

image

and when you’re done, you’ll see this:

image

To “remove the CD”, you can right-click on the little CD-looking icon on the bottom of the window and choose “Remove disk from virtual drive”:

image

Hit continue and after a minute you’ll see a text login prompt.  Login and tada:

image

You’ll see notes about package updates and security updates.  To get your system up to date, use the apt command:

sudo apt-get update
sudo apt-get upgrade

After that you will have a slick, new, up-to-date, (virtual) Ubuntu server.  In an upcoming post, we’ll take a look at networking configuration, setting up VirtualBox Guest Additions on Ubuntu Server (so we can share folders between our host machine and the guest virtual machine) and getting PuTTY and Xming running.

Posted in Uncategorized | Leave a comment

Dojo Edit in Place

I almost missed it, but yes, Dojo does have an “edit in place” widget.  For example:

image

Clicking on the text “Beans” gives you an input box like this:

image

It’s really easy to use there’s very good detailed documentation.  You just might not find it if you were searching for “dojo edit in place” like I was.

Posted in Uncategorized | Leave a comment

My NerdKit Works

image

All I did was follow instructions, but hey… it worked!  Of course, it didn’t work at first since I put the wrong resistor on the LCD’s contrast pin.  Lesson learned: use a good light when reading resistor color codes.

As a software engineer by training, I had a handful of electricity and magnetism and circuits courses, but to be honest, I’ve forgotten most of that.  So while working through the hands-on guide, I’ve tried to refresh myself on some of the basics of Electronics 101.

Posted in Uncategorized | Leave a comment

Sometimes I Forget How Amazing this Stuff Is

I just got a NerdKit today, and I’m excited to start playing (as soon as I find my wire cutters).  But even just reading through their guide (which is part textbook part hands-on lab manual), is fun.

Stuff like this still amazes me (think of all the chemistry, materials science, and engineering that went into this):

The Crystal Oscillator:

image

“Inside the metal can is a little thin piece of quartz grown so that it vibrates at exactly 14.7465 MHz. Just like a tuning fork is cut just right to oscillate at a certain frequency, this produces a very reliable clock signal that the chip follows when executing instructions.”

Posted in Uncategorized | Leave a comment

Windows Restarted My Computer

Who decided that Windows 7 (or any version for that matter) should restart my computer by default?  I’m talking about Windows Update.  It’s great that I’m protected from the latest meanies, but now I have to race to get things back where I need them for work today.

“Download updates but choose whether to install them” seems like a better default (Control Panel->Windows Update->Change settings).

Really, I wouldn’t even mind the automatic install if it just gave me sufficient warning.  And no, a warning at 10pm is not sufficient… tell me when I’m sitting in front of my computer.

Oh well, hope everything got auto-saved…

Posted in Uncategorized | Leave a comment