# Proposal for Install Dgraph section of Readme.md

**URL:** <https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372>\
**Category:** Users\
**Created:** [June 6, 2016, 12:36am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372 "2016-06-06T00:36:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 6, 2016, 12:36am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/1 "2016-06-06T00:36:21Z")

</div>

My idea is to enable everyone to use DGraph, to make DGraph as a default choice of database for application developers to build their mobile/web applications. One of the very significant steps needed to get there is to make setting up of Dgraph super simple and really easy, It should be made so simple that anyone can now, for the first time in history, should be able to have a GraphDB up running and ready to use in less than a minute.

In this regard here my propsal for the `Install` section of the Readme.md. That needs DGraph to offer binary releases ( One of advantages of DGraph being build in Go, need not ask users to install complicated libraries, just a binary would suffice! ).

## Install and run DGraph

- GNU/Linux 64 bit.
  - Download the binary from [https://downlaod.dgraph.com/server/release/v1/linux-64/dgraph](https://downlaod.dgraph.com/server/release/v1/linux-64/dgraph).

```auto
 $ chmod +x dgraph
 $ ./dgraph --mutations ~/dgraph/m --postings ~/dgraph/p --uids ~/dgraph/

```

_Note: Explore `dgraph --help` for more options_

- OSX 64 bit.
- Download the binary from [[https://downlaod.dgraph.com/server/release/v1/linux-64/dgaph](https://downlaod.dgraph.com/server/release/v1/linux-64/dgaph)]([https://downlaod.dgraph.com/server/release/v1/osx-64/](https://downlaod.dgraph.com/server/release/v1/osx-64/)

```auto
 $ chmod +x dgraph
 $ ./dgraph --mutations ~/dgraph/m --postings ~/dgraph/p --uids ~/dgraph/

```

- Docker

```auto
$ docker pull dgraph/dgraph:latest
# Setting a somedir volume on the host will persist your data.
$ docker run -t -i -v /somedir:/dgraph -p 80:8080 dgraph/dgraph:latest
# Ensure mutations directory exists.
$ mkdir /dgraph/m
# Run the server
$ dgraph --mutations /dgraph/m --postings /dgraph/p --uids /dgraph/u

```

- From Source

> NOTE: Source installation is intended for only developers and advanced users. For general use, please download official releases from [https://download.dgraph.io/](https://download.dgraph.io/).

If you do not have a working Golang environment, please install [Go 1.6 from here](https://golang.org/dl/).

```auto
$ go get -d github.com/dgraph-io/dgraph
# Make file takes care of installing RocksDB dependency too. 
$ make
$ $GOPATH/bin/dgraph --mutations /dgraph/m --postings /dgraph/p --uids /dgraph/u

```

---

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [June 6, 2016, 12:40am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/2 "2016-06-06T00:40:11Z")

</div>

@hackintoshrao: This looks really good. I think @ashwin95r has a task to look into building binaries for Dgraph. If you’re interested, talk to him and see if you want to pick it up.

---

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 6, 2016, 12:46am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/3 "2016-06-06T00:46:38Z")

</div>

Sure, will coordinate with @ashwin95r on this.

---

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 6, 2016, 12:54am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/4 "2016-06-06T00:54:03Z")

</div>

@mrjn: Also the pending proposal of running Dgraph with default arguments will help immensely.

---

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [June 6, 2016, 1:00am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/5 "2016-06-06T01:00:51Z")

</div>

Yeah, I think we’re close to a resolution here:

> [@Default parameters for dgraph binary](http://discuss.hypermode.com/t/default-parameters-for-dgraph-binary/368):
>
> DGraph binary needs 4 parameters to run the service mutations dir, postings dir, port, UIDs dir. My proposal is all of them should have default values. So the user just needs to run the binary without any arguments. The default config should be stored in ~/.dgraphrc by default or /etc/dgraph/dgraph.conf. The user has to pass a path to a new config file to run dgraph under different options. The directories for postings, mutations, UIDs can be in ~/.dgraph folder. In Production, When there …

---

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 6, 2016, 1:03am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/6 "2016-06-06T01:03:41Z")

</div>

That looks great, That’ll make usage more simple 🙂

---

<div class="post-metadata">

**Author:** ![ashwin95r](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ashwin95r/32/16_2.png) [@ashwin95r](https://discuss.dgraph.io/u/ashwin95r)\
**Post date:** [June 7, 2016, 5:20am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/7 "2016-06-07T05:20:06Z")

</div>

Doing a direct `go build .` gives a dynamically linked executable which depends on librocksdb and doesnt run on machines which do not have rocksDB installed. I’m working on creating a statically linked binary and let’s see if it works out. `go build --ldflags '-extldflags "-static"' .`

---

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 7, 2016, 5:27am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/8 "2016-06-07T05:27:27Z")

</div>

That’ll be great … Will be really helpful for binary releases. Any timeline on the binary release plan?

---

<div class="post-metadata">

**Author:** ![ashwin95r](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ashwin95r/32/16_2.png) [@ashwin95r](https://discuss.dgraph.io/u/ashwin95r)\
**Post date:** [June 7, 2016, 5:29am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/9 "2016-06-07T05:29:46Z")

</div>

We could do it as soon as we have a working binary or along with the v0.4 release. What do you suggest @mrjn, @hackintoshrao ?

---

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 7, 2016, 5:32am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/10 "2016-06-07T05:32:07Z")

</div>

It’ll great to have it soon. But yes, there might be lot on the road for you guys. I’ll work on building a static binary meanwhile and see how it goes.

---

<div class="post-metadata">

**Author:** ![ashwin95r](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ashwin95r/32/16_2.png) [@ashwin95r](https://discuss.dgraph.io/u/ashwin95r)\
**Post date:** [June 7, 2016, 5:33am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/11 "2016-06-07T05:33:02Z")

</div>

I’m already working on it. Should be done in sometime @hackintoshrao. You could test it out too 🙂

---

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 7, 2016, 5:35am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/12 "2016-06-07T05:35:13Z")

</div>

@ashwin95r: Ah, cool. Sure 🙂

---

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 7, 2016, 5:36am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/13 "2016-06-07T05:36:02Z")

</div>

@ashwin95r: Also it’ll be nice if you could document and share how its built.

---

<div class="post-metadata">

**Author:** ![ashwin95r](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ashwin95r/32/16_2.png) [@ashwin95r](https://discuss.dgraph.io/u/ashwin95r)\
**Post date:** [June 7, 2016, 5:38am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/14 "2016-06-07T05:38:44Z")

</div>

I statically compiled the dgraphassigner and I’ll share the binary in slack. This would be the command to build any binary statically : `go build --ldflags '-extldflags "-static"' .`

---

<div class="post-metadata">

**Author:** ![hackintoshrao](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/hackintoshrao/32/1564_2.png) [@hackintoshrao](https://discuss.dgraph.io/u/hackintoshrao)\
**Post date:** [June 7, 2016, 5:40am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/15 "2016-06-07T05:40:19Z")

</div>

Sure, As I mentioned, a small note on how you built would be helpful to create scripts for doing so.

---

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [June 7, 2016, 6:56am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/16 "2016-06-07T06:56:03Z")

</div>

So, if we’re now able to build static binaries, let’s do two things:

- Create the Makefile as proposed by @hackintoshrao
- Switch to Alpine Linux Docker image as suggested by @compton

---

<div class="post-metadata">

**Author:** ![ashwin95r](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ashwin95r/32/16_2.png) [@ashwin95r](https://discuss.dgraph.io/u/ashwin95r)\
**Post date:** [June 7, 2016, 7:04am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/17 "2016-06-07T07:04:05Z")

</div>

I’m still not able to compile the server statically

```auto
# github.com/dgraph-io/dgraph/dgraph
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-159525422/000000.o: In function `_cgo_29becdab8e08_C2func_getaddrinfo':
/tmp/workdir/go/src/net/cgo_unix.go:57: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from t
he glibc version used for linking

```

Looks like we need to switch from glibc to musl gcc or find some other way to tackle this. Once that is done we could have independent binaries.

---

<div class="post-metadata">

**Author:** ![pawan](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pawan/32/1946_2.png) [@pawan](https://discuss.dgraph.io/u/pawan)\
**Post date:** [June 7, 2016, 7:14am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/18 "2016-06-07T07:14:12Z")

</div>

I will create issues on Github for the same under the section `help_wanted` for these then.

---

<div class="post-metadata">

**Author:** ![ashwin95r](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ashwin95r/32/16_2.png) [@ashwin95r](https://discuss.dgraph.io/u/ashwin95r)\
**Post date:** [June 7, 2016, 7:15am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/19 "2016-06-07T07:15:59Z")

</div>

I feel we should handle this. If someone has already done this, then okay, but otherwise this doesn’t seem very straightforward.

---

<div class="post-metadata">

**Author:** ![pawan](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pawan/32/1946_2.png) [@pawan](https://discuss.dgraph.io/u/pawan)\
**Post date:** [June 7, 2016, 7:24am UTC](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372/20 "2016-06-07T07:24:15Z")

</div>

Sorry, I was talking about[quote=“mrjn, post:16, topic:372”]  
Create the Makefile as proposed by @hackintoshrao

Switch to Alpine Linux Docker image as suggested by @compton  
[/quote]

[Next page](https://discuss.dgraph.io/t/proposal-for-install-dgraph-section-of-readme-md/372.md?page=2)
