title | summary | toc |
---|---|---|
Install CockroachDB |
Simple instructions for installing CockroachDB on Mac, Linux, or Windows. |
false |
There are four ways to install CockroachDB on Mac OS X. See Release Notes for what's new in the latest version.
-
Download the latest CockroachDB tarball for OS X.
-
Extract the binary:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-binary-step2"><span class="gp" data-eventcategory="mac-binary-step2">$ </span>tar xfz cockroach-latest.darwin-10.9-amd64.tgz</code></pre> </div> </li> <li> <p>Add the directory containing the binary to your <code>PATH</code>. This makes it easy to execute <a href="cockroach-commands.html">cockroach commands</a> from any shell.</p> </li> <li> <p>Make sure CockroachDB installed successfully:</p> <div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-binary-step4"><span class="gp" data-eventcategory="mac-binary-step4">$ </span>cockroach version</code></pre></div> </li> <li> <p>Keep up-to-date with software releases and usage best practices:</p> <div class="hubspot-install-form install-form-1 clearfix"> <script> hbspt.forms.create({ css: '', cssClass: 'install-form', portalId: '1753393', formId: '39686297-81d2-45e7-a73f-55a596a8d5ff', formInstanceId: 1, target: '.install-form-1' }); </script> </div> </li>
-
Run our brew recipe to get the CockroachDB code and build the binary:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-homebrew-step2"><span class="gp" data-eventcategory="mac-homebrew-step2">$ </span>brew install https://raw.githubusercontent.com/cockroachdb/cockroach/master/build/cockroach.rb</code></pre> </div> </li> <li> <p>Make sure CockroachDB installed successfully:</p> <div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-homebrew-step3"><span class="gp" data-eventcategory="mac-homebrew-step3">$ </span>cockroach version</code></pre></div> </li> <li> <p>Keep up-to-date with software releases and usage best practices:</p> <div class="hubspot-install-form install-form-2 clearfix"> <script> hbspt.forms.create({ css: '', cssClass: 'install-form', portalId: '1753393', formId: '39686297-81d2-45e7-a73f-55a596a8d5ff', formInstanceId: 2, target: '.install-form-2' }); </script> </div> </li>
-
Install the following prerequisites, as necessary:
<ul> <li> <p>A C++ compiler that supports C++11 (GCC 4.9+ and clang 3.6+ are known to work). On Mac OS X, Xcode should suffice.</p> </li> <li> <p>A <a href="http://golang.org/doc/code.html">Go environment</a> with a 64-bit version of Go 1.6.2. You can download the <a href="https://golang.org/dl/">Go binary</a> directly from the official site. Be sure to set the <code class="highlighter-rouge">$GOPATH</code> and <code class="highlighter-rouge">$PATH</code> environment variables as described <a href="https://golang.org/doc/code.html#GOPATH">here</a>.</p> </li> <li> <p>Git 1.8+</p> </li> <li> <p><a href="https://www.gnu.org/software/bash/">Bash</a></p> </li> </ul> <p>Note that at least 2GB of RAM is required to build from source. If you plan to run our test suite as well, you'll need closer to 4GB of RAM.</p>
-
Get the CockroachDB code:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-source-step2"><span class="gp" data-eventcategory="mac-source-step2">$ </span>go get -d github.com/cockroachdb/cockroach</code></pre></div>
-
Compile the CockroachDB binary:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-source-step3"><span class="gp" data-eventcategory="mac-source-step3">$ </span><span class="nb">cd</span> <span class="nv">$GOPATH</span>/src/github.com/cockroachdb/cockroach<br>$ git checkout {{site.data.strings.version}}<br><span class="gp">$ </span>make install</code></pre></div> <p>The first time you run <code class="highlighter-rouge">make install</code>, it can take awhile to download and install various dependencies.</p> <div class="bs-callout bs-callout-success">This step builds a binary for the latest beta release. To get access to <a href="develop-branch.html">features not yet included in a beta release</a>, you can build a binary from the <code>develop</code> branch instead. Simply leave out the <code>git checkout {{site.data.strings.version}}</code> step above.</div>
-
The
make install
command puts the binary in$GOPATH/bin
. Add this directory to yourPATH
, if it isn't already there. This makes it easy to execute cockroach commands from any shell. -
Make sure CockroachDB installed successfully:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-source-step5"><span class="gp" data-eventcategory="mac-source-step5">$ </span>cockroach version</code></pre></div>
-
Keep up-to-date with software releases and usage best practices:
<script> hbspt.forms.create({ css: '', cssClass: 'install-form', portalId: '1753393', formId: '39686297-81d2-45e7-a73f-55a596a8d5ff', formInstanceId: 3, target: '.install-form-3' }); </script>
-
Install Docker for Mac.
-
Confirm that the Docker daemon is running in the background:
<div class="highlighter-rouge"><pre class="highlight"><code>$ docker version</code></pre> </div> <p>If you don't see the server listed, start the <strong>Docker</strong> application.</p>
-
Pull the official CockroachDB image from Docker Hub:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-docker-step3"><span class="gp" data-eventcategory="mac-docker-step3">$ </span>docker pull cockroachdb/cockroach:{{site.data.strings.version}}</code></pre> </div>
-
Make sure CockroachDB installed successfully:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="mac-docker-step4"><span class="gp" data-eventcategory="mac-docker-step4">$ </span>docker run --rm cockroachdb/cockroach:{{site.data.strings.version}} version</code></pre></div>
-
Keep up-to-date with software releases and usage best practices:
<script> hbspt.forms.create({ css: '', cssClass: 'install-form', portalId: '1753393', formId: '39686297-81d2-45e7-a73f-55a596a8d5ff', formInstanceId: 4, target: '.install-form-4' }); </script>
There are three ways to install CockroachDB on Linux. See Release Notes for what's new in the latest version.
-
Download the latest CockroachDB tarball for Linux.
-
Extract the binary:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="linux-binary-step2"><span class="gp" data-eventcategory="linux-binary-step2">$ </span>tar xfz cockroach-latest.linux-amd64.tgz</code></pre> </div> </li> <li> <p>Add the directory containing the binary to your <code>PATH</code>. This makes it easy to execute <a href="cockroach-commands.html">cockroach commands</a> from any shell.</p> </li> <li> <p>Make sure CockroachDB installed successfully:</p> <div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="linux-binary-step3"><span class="gp" data-eventcategory="linux-binary-step3">$ </span>cockroach version</code></pre></div> </li> <li> <p>Keep up-to-date with software releases and usage best practices:</p> <div class="hubspot-install-form install-form-5 clearfix"> <script> hbspt.forms.create({ css: '', cssClass: 'install-form', portalId: '1753393', formId: '39686297-81d2-45e7-a73f-55a596a8d5ff', formInstanceId: 5, target: '.install-form-5' }); </script> </div> </li>
-
Install the following prerequisites, as necessary:
<ul> <li> <p>A C++ compiler that supports C++11 (GCC 4.9+ and clang 3.6+ are known to work).</p> </li> <li> <p>A <a href="http://golang.org/doc/code.html">Go environment</a> with a 64-bit version of Go 1.6.2. You can download the <a href="https://golang.org/dl/">Go binary</a> directly from the official site. Be sure to set the <code class="highlighter-rouge">$GOPATH</code> and <code class="highlighter-rouge">$PATH</code> environment variables as described <a href="https://golang.org/doc/code.html#GOPATH">here</a>.</p> </li> <li> <p>Git 1.8+</p> </li> <li> <p><a href="https://www.gnu.org/software/bash/">Bash</a></p> </li> </ul> <p>Note that at least 2GB of RAM is required to build from source. If you plan to run our test suite as well, you'll need closer to 4GB of RAM.</p>
-
Get the CockroachDB code:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="linux-source-step2"><span class="gp" data-eventcategory="linux-source-step2">$ </span>go get -d github.com/cockroachdb/cockroach</code></pre></div>
-
Compile the CockroachDB binary:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="linux-source-step3"><span class="gp" data-eventcategory="linux-source-step3">$ </span><span class="nb" data-eventcategory="linux-source-step3">cd</span> <span class="nv" data-eventcategory="linux-source-step3">$GOPATH</span>/src/github.com/cockroachdb/cockroach<br>$ git checkout {{site.data.strings.version}}<br><span class="gp">$ </span>make install</code></pre></div> <p>The first time you run <code class="highlighter-rouge">make install</code>, it can take awhile to download and install various dependencies.</p> <div class="bs-callout bs-callout-success">This step builds a binary for the latest beta release. To get access to <a href="develop-branch.html">features not yet included in a beta release</a>, you can build a binary from the <code>develop</code> branch instead. Simply leave out the <code>git checkout {{site.data.strings.version}}</code> step above.</div>
-
The
make install
command puts the binary in$GOPATH/bin
. Add this directory to yourPATH
, if it isn't already there. This makes it easy to execute cockroach commands from any shell. -
Make sure CockroachDB installed successfully:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="linux-source-step5"><span class="gp" data-eventcategory="linux-source-step5">$ </span>cockroach version</code></pre></div>
-
Keep up-to-date with software releases and usage best practices:
<script> hbspt.forms.create({ css: '', cssClass: 'install-form', portalId: '1753393', formId: '39686297-81d2-45e7-a73f-55a596a8d5ff', formInstanceId: 6, target: '.install-form-6' }); </script>
-
Install Docker for Linux.
-
Confirm that the Docker daemon is running in the background:
<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo docker version</code></pre> </div> <p>If you don't see the server listed, start the Docker daemon. </p> <div class="bs-callout bs-callout-info">On Linux, Docker needs sudo privileges.</div>
-
Pull the official CockroachDB image from Docker Hub:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="linux-docker-step3"><span class="gp" data-eventcategory="linux-docker-step3">$ </span>sudo docker pull cockroachdb/cockroach:{{site.data.strings.version}}</code></pre> </div>
-
Make sure CockroachDB installed successfully:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="linux-docker-step4"><span class="gp" data-eventcategory="linux-docker-step4">$ </span>sudo docker run --rm cockroachdb/cockroach:{{site.data.strings.version}} version</code></pre></div>
-
Keep up-to-date with software releases and usage best practices:
<script> hbspt.forms.create({ css: '', cssClass: 'install-form', portalId: '1753393', formId: '39686297-81d2-45e7-a73f-55a596a8d5ff', formInstanceId: 7, target: '.install-form-7' }); </script>
At this time, it's possible to run CockroachDB on Windows only from within a Docker virtual environment. See Release Notes for what's new in the latest version of CockroachDB.
-
Install Docker for Windows.
-
Confirm that the Docker daemon is running in the background:
<div class="highlighter-rouge"><pre class="highlight"><code>$ docker version</code></pre> </div> <p>If you don't see the server listed, start the <strong>Docker</strong> application.</p>
-
Pull the official CockroachDB image from Docker Hub:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="win-docker-step3"><span class="gp" data-eventcategory="win-docker-step3">$ </span>docker pull cockroachdb/cockroach:{{site.data.strings.version}}</code></pre> </div>
-
Make sure CockroachDB installed successfully:
<div class="highlighter-rouge"><pre class="highlight"><code data-eventcategory="win-docker-step4"><span class="gp" data-eventcategory="win-docker-step4">$ </span>docker run --rm cockroachdb/cockroach:{{site.data.strings.version}} version</code></pre></div>
-
Keep up-to-date with software releases and usage best practices:
<script> hbspt.forms.create({ css: '', cssClass: 'install-form', portalId: '1753393', formId: '39686297-81d2-45e7-a73f-55a596a8d5ff', formInstanceId: 8, target: '.install-form-8' }); </script>
Quick start a single- or multi-node cluster locally and talk to it via the built-in SQL client.