
<erl>

box(Str) ->
    {'div',[{class,"box"}],
     {pre,[], yaws_api:htmlize(Str)}}.


out(A) ->
    [{ssi, "TAB.inc", "%%",[{"configuration", "choosen"}]}].

</erl>


<div id="entry">
  <h1>Build and install Yaws</h1>
  <p>
    Yaws is hosted at <a
    href="https://github.com/erlyaws/yaws">https://github.com/erlyaws/yaws</a>.
  </p>
  <p>
    Tested releases are downloadable from the Yaws download directory
    at <a href="https://github.com/erlyaws/yaws/releases" >https://github.com/erlyaws/yaws/releases</a>.
  </p>

  <p>
    To check out the latest release and build a number of prerequisites
    are required. (All code example below on Ubuntu)
  </p>
  <p>
  <strong>NOTE: Erlang/OTP 18.0 or higher is required.</strong>
  </p>
  <ul>
    <li>
      <p>
        Installed erlang + development
      </p>
      <div class="box">
        <pre>
# sudo apt-get build-dep erlang yaws
# sudo apt-get install erlang-nox erlang-src erlang-manpages erlang-mode erlang-dev libtool
        </pre>
      </div>
    </li>
    <li>
      <p>
        Installed git
      </p>
      <div class="box">
        <pre>
# sudo apt-get install git-core
        </pre>
      </div>
    </li>

    <li>
      <p>
        To build the docs, all kinds of verious tools are required.
        latex, man2pdf ... etc.

      </p>
    </li>

    <li>
      <p>
        To build win32 releases - the following is required.
      </p>
      <ul>
        <li>
          <p>
            Mingw.
            <div class="box">
              <pre>
# apt-get install mingw32 mingw32-binutils
              </pre>
            </div>
          </p>
        </li>
        <li>
          Installbuilder. To build win32 installers we're using
          an install builder that is free to use free of charge
          for opensource projects.
          Get the linux installer at
          <a href="https://www.bitrock.com/download_installbuilder_download.html">
            bitrock
          </a>
        </li>
        <p>
          Further instructions are found in the win32 directory
          in the source tree.
        </p>
      </ul>
    </li>
  </ul>

  <p>
    To check out the sources do
  </p>
  <div class="box">
    <pre>
# git clone git://github.com/erlyaws/yaws.git
    </pre>
  </div>
  <p>To build and to what is knows as a <em>local</em> install, e.g.
  a developer install do:
  </p>
  <div class="box">
    <pre>
# cd yaws
# autoreconf -fi
# ./configure --prefix=/path/to/yaws
# make install
    </pre>
  </div>
  <p>
    Alternatively, to make a <em>standard</em> install
  </p>
  <div class="box">
    <pre>
# cd yaws
# autoreconf -fi
# ./configure --help
# ./configure --localstatedir=/var --sysconfdir=/etc
# make
# sudo make install
    </pre>
  </div>

  <p>
    The above commands will checkout the HEAD source,
    build it and install it at
    127.0.0.1:80 with the docroot set to the local documentation.
  </p>
  <p>
    A <em>local</em> install does install yaws at http://127.0.0.1:8000
  </p>
  <p>
    This is the typical mode of operation while either just trying out yaws, or
    hacking yaws. This will install a template configuration file
    <em>yaws.conf</em> in <em>${prefix}/etc/yaws</em> (<em>${prefix}</em> is the
    value of the <em>--prefix</em> option passed during the execution of the
    configure script).  If this file exists, the old file will not be
    overwritten.
  </p>
  <p>
    To run a locally installed system, we run the installed yaws script
    <em>${prefix}/bin/yaws</em>.
  </p>

  <p>
    A <em>standard</em> install will install yaws in <em>/usr/local</em>. A
    configuration file <em>/etc/yaws/yaws.conf</em> will also be installed
    unless the file already exists. The default config file will set up the
    system to listen on http://127.0.0.1:80
  </p>

  <h2>Building with Rebar</h2>
  <p>
    Yaws can alternatively be built using <a
    href="https://github.com/rebar/rebar">rebar</a>. Assuming you already
    have <code>rebar</code> installed, simply type
  </p>
  <div class="box">
    <pre>
$ rebar get-deps compile
    </pre>
  </div>
  <p>
    This fetches all dependencies and builds Yaws.
  </p>
  <p>
    The <a href="rebar_release.yaws">rebar_release page</a> explains how to
    use <code>rebar</code> to create an Erlang release for an application
    that depends on Yaws.
  </p>

  <h2>Running yaws</h2>
  <p>
    The yaws executable is a shell script which invokes the
    erlang system and instructs it to start yaws.
    The command line flags for yaws are documented in
    <a href="yman.yaws?page=yaws">
       man page for yaws(1)
    </a>

    <p>
      When developing yaws code, the interactive mode is ideal. Typically, yaws
      is then started as:
    </p>
     <div class="box">
       <pre>
# yaws -i
       </pre>
     </div>
     <p>
       Run yaws as a daemon as
     </p>
     <div class="box">
       <pre>
# yaws --daemon
       </pre>
     </div>
     <p>
       All command line flags to yaws are described in the
       man page for yaws.
     </p>

     <h2>Configuring Yaws</h2>
     <p>
       Web server configuration can be supplied to yaws in either of two ways
       depending on whether we run yaws as a standalone daemon or if we run yaws
       as an embedded application inside another Erlang program.
     </p>
     <p>
       The yaws configuration is described in
       <a href="yman.yaws?page=yaws.conf">
         man page for yaws.conf (5)
       </a>
     </p>

     <h3>Embedded mode</h3>
     <p>
       It is possible to run yaws in embedded mode where yaws is part of a
       larger application. When running yaws in embedded mode, it is often not
       possible to let yaws read its configuration data from
       <em>/etc/yaws/yaws.conf</em>.
     </p>

     <p>
       The function
       <tt>yaws_api:setconf(Gconf, Groups)</tt>
       can be used by an other erlang process to explicitly set a yaws
       configuration at runtime.
       To execute Yaws in embedded mode, it must be started with
       the environment
       <tt>{embedded, true}</tt>
     </p>
     <p>
       The embedded mode is fully described at
       <a href="embed.yaws">embed.yaws</a>
     </p>
  </p>
</div>


<erl>

out(_) ->
    {ssi, "END2",[],[]}.

</erl>


