# Installation notes for Discourse on Bash for Windows

**URL:** <https://meta.discourse.org/t/installation-notes-for-discourse-on-bash-for-windows/48141>\
**Category:** Development\
**Created:** [3 Agosto, 2016 03:10 UTC](https://meta.discourse.org/t/installation-notes-for-discourse-on-bash-for-windows/48141 "2016-08-03T03:10:48Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [3 Agosto, 2016 03:10 UTC](https://meta.discourse.org/t/installation-notes-for-discourse-on-bash-for-windows/48141/1 "2016-08-03T03:10:49Z")

</div>

Here are some rough notes on how I went about install Discourse on Bash for Windows:

### Install required packages

Mostly a cut-and-paste job from our [docker base image](https://github.com/discourse/discourse_docker/blob/master/image/base/Dockerfile).

```plaintext

curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" | sudo tee /etc/apt/sources.list.d/postgres.list

sudo apt-get update

sudo apt-get install build-essential git build-essential git wget \
      libxslt1-dev libcurl4-openssl-dev \
      libssl-dev libyaml-dev libtool \
      libxml2-dev gawk \
      postgresql-client-9.5 libpq-dev libreadline-dev \
      language-pack-en \
      psmisc whois redis-server \
      advancecomp jhead jpegoptim libjpeg-turbo-progs optipng libjemalloc-dev imagemagick

```

### Installing rbenv

```plaintext
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc

```

exit shell and start again so env is there.

### Install ruby

```plaintext
rbenv install 2.3.1

echo 2.3.1 >> ~/.rbenv/version

```

Make 🍸 this will take a while cause the filesystem is very slow.

### Install Postgres on Windows

> **[PostgreSQL: Windows installers](https://www.postgresql.org/download/windows/)**

This is required cause installing postgres is not yet supported.

### Install Discourse

```plaintext
git clone https://github.com/discourse/discourse.git

gem install bundler
cd discourse
bundle install

# correct bundler permissions per http://stackoverflow.com/questions/37211007/installing-rails-on-ubuntu-bash-windows-10
chmod -R +t ~/.bundle/cache

bundle install

```

### Hack database config

Edit `config/database.yml`:

Add the following into test and development sections:

```plaintext
host: localhost
username: postgres
password: YOURPWD
port: 5432

```

### Start up redis

```plaintext
redis-server --bind 0.0.0.0

```

### Migrate Discourse

```plaintext
bin/rake db:create db:migrate

```

### Discourse now runs! hooray 🎊 🍾

At the end of this process Discourse running on Windows without ANY VM installed. This is quite impressive.

```plaintext
bundle exec puma

```

 ![](https://global.discourse-cdn.com/meta/original/3X/7/7/7787c1d74b6797b8f99c377ae1d85cf039e01e3c.png)

### The good news!

Discourse runs fine, its a little bit fiddly but all the gems install and the test suite runs.

Once booted up Discourse is quite fast and usable.

### The bad news!

The filesystem mapping technology keeps the original files in an NTFS partition and performs internal mapping, pretending this filesystem is actually a Linux native one. Unfortunately NTFS + mapping overhead means that it is much slower than using ext4fs directly or some other native solution.

The effect of this in real terms is:

- Running our test suite is slower

Bash on Ubuntu on Windows takes 8:20 to run the test suite. My ubuntu VM takes 6:15. Same hardware.

- Installing ruby / gems and so on is a lot slower

Ruby has lots of little files, I did not time it but it feels at least twice slower to compile ruby from source.

- Booting Discourse takes more than **twice** longer:

```plaintext
# Linux VM 
sam@ubuntu discourse % time bin/rails r "puts 'hi'"
hi

2.54s user 
0.50s system 
99% cpu 
3.059 total

# Bash on Ubuntu on Windows

sam@SAM-PC:~/discourse$ time bin/rails r "puts 'hi'"
hi

real 0m7.123s
user 0m3.063s
sys 0m4.000s

```

7.12secs VS 3.05secs

This means that starting up a dev web server and opening up a rails console take much longer.

This is a **huge** issue, it is big enough for me to recommend against this setup for now.

There is an open ticket that once resolved will allow bash on Windows to run native filesystems, once that is implemented we should revisit these results:

[https://github.com/Microsoft/BashOnWindows/issues/131](https://github.com/Microsoft/BashOnWindows/issues/131)

Note: All tests were done on the beta version of Bash on Ubuntu on Windows that is bundled with Windows 10 anniversary edition (made public on 2nd of August 2016)

---

_[View the full topic](https://meta.discourse.org/t/installation-notes-for-discourse-on-bash-for-windows/48141)._
