Tux, the Linux Mascot

Introduction

Couchbase’s Sync Gateway supports several platforms, including Linux. Unfortunately, there are a huge number of Linux distributions. It simply isn’t feasible to create and test installations for all of them.

As of this writing, Couchbase distributes two packages for Linux (expect this to increase soon). One is in Debian format, targeted to Ubuntu. The other is in rpm format, with support for RedHat Enterprise and CentOS.

So what happens if you run something else? I did a little investigating of options and did some quick tests. Here’s what I found out.

Considerations

It’s helpful to know that Sync Gateway itself consists of only one binary executable, sync_gateway. It does rely on a few dynamic libraries, but only a handful. (If you want to know how to check library dependencies, read about ldd.) For most server-class distributions I wouldn’t expect you to have any problem running the application itself.

The difficulty comes from other aspects of a full set up. Typically, you’ll want three more things: a unique user to associate with the server, a location to install the main binary and accessory files, and a hook into the system boot sequence to automate starting and stopping the server.

It’s possible one of the current packages will work. Since Oracle Enterprise Linux (OEL) is a derivative of RedHat, I experimented with using rpm. It installed all the files in reasonable places (/home and /opt). It even started Sync Gateway running.

Unfortunately, it didn’t create the startup scripts. This is really at the core of the problem of using a package not tested for your distribution. It might not complete the installation. Worse, it may tweak something without you realizing it. Caveat emptor.

Unpacking

With that in mind, I’d recommend installing by hand instead. The Debian package format has a small number of files bundled in an ar archive. One of those bundles, data.tar.xz, contains the payload we want. You can pull it apart in one line.

To list the contents first, use

To extract the files, use

Finishing up

Once you’ve unpacked the archive, you’ll want to move the sync_gateway binary to your preferred directory.

For experimenting with Couchbase Mobile, this is all you really need. Be sure to check out the sample configuration files.

For production, best practices would include setting up Sync Gateway to run under its own user id (minimize privileges and isolate ability to make changes). And, of course, you’ll most likely want it to start automatically at boot, and probably restart automatically if it fails.

Postscript

Check out more resources on our developer portal and follow us on Twitter @CouchbaseDev.

You can post questions on our forums. And we actively participate on Stack Overflow.

You can follow me personally at @HodGreeley

Author

Posted by Hod Greeley, Developer Advocate, Couchbase

Hod Greeley is a Developer Advocate for Couchbase, living in Silicon Valley. He has over two decades of experience as a software engineer and engineering manager. He has worked in a variety of software fields, including computational physics and chemistry, computer and network security, finance, and mobile. Prior to joining Couchbase in 2016, Hod led developer relations for mobile at Samsung. Hod holds a Ph.D. in chemical physics from Columbia University.

Leave a reply