NOTE We'll be upgrading these instructions to use the new stack build tool in the next week or so after some testing. If you'd like to use Yesod with stack before then, check out this relevant blog post.
You'll need to install the Haskell toolchain. Note that you must install the correct version of GHC. That is currently GHC 7.8.4. Once you have Haskell installed, you can follow these steps to get a scaffolded site up and running:
The simplest set of steps to get this started is:
- Create a new directory to hold your project, and
Run the following series of commands
wget https://www.stackage.org/lts/cabal.config cabal update # download package list cabal install alex happy yesod-bin # install build tools yesod init --bare # answer questions as prompted cabal sandbox init # set up a sandbox cabal install --run-tests # install libraries yesod devel # launch devel server
- View your Yesod site at http://localhost:3000/
These steps download some necessary tools, create a scaffolded site, set up a sandbox, and install all libraries. Note that it may take some time to compile all dependencies. These steps also leverage Stackage to ensure you have a consistent library set and avoid "cabal hell" issues, which came up in the past.
Note that you will need the dev version of some system libraries to be available for the above steps to work. For example, on Ubuntu, you may need to run something like:
sudo apt-get install -y build-essential zlib1g-dev
If you're using a database, you'll likely need to install the system libraries to talk to it. Some Ubuntu examples are:
sudo apt-get install -y libmysqlclient-dev sudo apt-get install -y libpq-dev
Now it's time to start coding! You can play around with the code right now, or if you want to learn more, check out these resources: