---
title: "Running Meteor"
date: "2015-02-27"
category: "node"
slug: "running-meteor"
---

[Meteor](https://www.meteor.com/) is a web framework built on Node.js that integrates with [Passenger](https://www.phusionpassenger.com/) for process management and scalability. Meteor requires [[is-terminal-access-available]]. This guide covers launching Meteor on a [[determining-platform-version]].

## Quickstart

1. **Prerequisite:** Follow the [[running-mongodb]] guide to set up MongoDB.

2. Install Meteor from the [[accessing-terminal]]:
    - cd ~
        curl https://install.meteor.com/ | sh

    - Once complete, you will see a confirmation:

        Meteor 1.0.3.1 has been installed in your home directory (~/.meteor).
        Writing a launcher script to /usr/local/bin/meteor for your convenience.

        To get started fast:

        $ meteor create ~/my\_cool\_app
        $ cd ~/my\_cool\_app
        $ meteor

    - **Note:** Do not install the `meteor` package from npm. The npm package is an [unofficial fork](https://github.com/meteor/meteor/issues/1721).

3. Create a new Meteor app (in this example, `meteorapp`) under `/var/www`:
    - cd /var/www
        meteor create meteorapp

4. Connect `public/` to a [[creating-subdomain]] within the [[logging-into-the-control-panel]] via **Web** > **Subdomains**

    ![Connecting Meteor to a subdomain in the control panel](kb-image:meteor-subdomain-control-panel.png)
*Connecting Meteor to a subdomain in the control panel*

5. Create a [[htaccess-guide]] control file in `public/` with the following directives. Meteor requires several environment variables passed from Apache through Passenger. You will need your [[home-directory-location]].
    - PassengerNodejs /usr/bin/node
        PassengerStickySessions On
        SetEnv HOME /home/<USERNAME>
        SetEnv MONGO\_URL mongodb://127.0.0.1:<PORT>/meteor
        SetEnv MONGO\_OPLOG\_URL mongodb://127.0.0.1:<PORT>/local
        SetEnv ROOT\_URL http://<HOSTNAME>

    - Replace `<HOSTNAME>` with your fully-qualified domain (e.g., `meteorapp.example.com`)
    - Replace `<PORT>` with the MongoDB port from the prerequisite MongoDB setup
    - Replace `<USERNAME>` with your control panel username

6. Access your Meteor application through the browser. The first request takes several seconds to initialize; subsequent requests will be much faster.

    ![Meteor confirmation page on a basic install](kb-image:meteor-confirmation-dialog.png)
*Meteor confirmation page after installation*

## Restarting

Meteor runs through Passenger and can be restarted using the `tmp/` control directory. Follow the general [[restarting-passenger-processes]] guide.

## See Also

- [Official Meteor tutorial](https://www.meteor.com/try/2) - skip the install steps
- [Meteor documentation](https://www.meteor.com/learn)
- [Discover Meteor](https://book.discovermeteor.com) ($) - an excellent eBook on Meteor development
