============
Installation
============

.. tip::

	TYPO3 Neos is built on top of the TYPO3 Flow framework. If you run into technical problems,
	keep in mind to check the `TYPO3 Flow documentation`_ for possible hints as well.

Requirements
------------

TYPO3 Neos has at least the same system requirements as TYPO3 Flow. You can find them in the
`TYPO3 Flow Requirements Documentation`_.

Fundamental Installation
------------------------
#. First you need to install the dependency manager *Composer* (if you don't have it already):

   .. code-block:: bash

      curl -sS https://getcomposer.org/installer | php

   By issuing this command Composer will get downloaded as *composer.phar* to your working directory.
   If you like to have composer installed globally, you can simply move it to a directory within your $PATH environment.

   .. code-block:: bash

      mv composer.phar /usr/local/bin/composer

   .. note::

      If you are on Windows please refer to the `offical documentation
      <http://getcomposer.org/doc/00-intro.md#installation-windows>`_ on how to install Composer on Windows

#. Go to your htdocs directory and create a new project based on the TYPO3 Neos base distribution:

   .. code-block:: bash

      cd /your/htdocs/
      php /path/to/composer.phar create-project typo3/neos-base-distribution TYPO3-Neos

   Composer will take care of downloading all dependencies for running your TYPO3 Neos installation to the
   directory ``TYPO3-Neos``.
   You can safely delete the vcs files by answering 'Y' to the question 'Do you want to remove the existing VCS (.git,
   .svn..) history? [Y,n]?'.


#. Next set up a virtual host inside your Apache configuration. Set the ``DocumentRoot`` to the ``Web`` directory inside
   the TYPO3 Neos installation.

   .. code-block:: apache

      NameVirtualHost *:80 # if needed

      <VirtualHost *:80>
         DocumentRoot "/your/htdocs/TYPO3-Neos/Web/"
         # enable the following line for production context
         #SetEnv FLOW_CONTEXT Production
         ServerName neos.demo
      </VirtualHost>

   Make sure that the ``mod_rewrite`` module is loaded and restart apache. For further information on how to set up a
   virtual host with apache please refer to the `Apache Virtual Host documentation
   <https://httpd.apache.org/docs/2.2/en/vhosts/>`_.


#. Add an entry to */etc/hosts* to make your virtual host reachable:

   .. code-block:: text

      127.0.0.1 neos.demo

   Make sure to use the same name you defined in ``ServerName`` in the virtual host configuration above.

#. Set file permissions as needed so that the installation is read- and writeable by the webserver's user and group:

   .. code-block:: bash

       sudo ./flow core:setfilepermissions john www-data www-data

   Replace *john* with your current username and *www-data* with the webserver's user and group.

   For detailed instructions on setting the needed permissions see  `TYPO3 Flow File Permissions`_

   .. note::
     Setting file permissions is not necessary and not possible on Windows machines.
     For Apache to be able to create symlinks, you need to use Windows Vista (or
     newer) and Apache needs to be started with Administrator privileges.


#. Now go to http://neos.demo/setup and follow the on-screen instructions.

The TYPO3 Neos Setup Tool
-------------------------

#. A check for the basic requirements of TYPO3 Flow and Neos will be run. If all is well, you will
   see a login screen. If a check failed, hints on solving the issue will be shown and you should
   fix what needs to be fixed. Then just reload the page, until all requirements are met.

#. The login screen will tell you the location of a file with a generated password. Keep that password
   in some secure place, the generated file will be removed upon login! It is possible to have a new password
   rendered if you lost it, so don't worry too much.

   .. figure:: Images/Setup-Step-1.png
      :alt: TYPO3 Neos login page
      :class: screenshot-fullsize

#. Fill in the database credentials in the first step. The selector box will be updated with
   accessible databases to choose from, or you can create a new one.

   .. tip::
      Configure your MySQL server to use the ``utf8_unicode_ci`` collation by default if possible!

   .. figure:: Images/Setup-Step-2.png
      :alt: Setup database credentials
      :class: screenshot-fullsize

#. In the next step a user with administrator privileges for editing with TYPO3 Neos is created.

   .. figure:: Images/Setup-Step-3.png
      :alt: Create admin user
      :class: screenshot-fullsize

#. The following step allows you to import an existing site or kickstart a new site. To import the
   demo site, just make sure it is selected in the selector box and go to the next step.

   To kickstart a new site, enter a package and site name in the form before going to the next step.

   If you are new to Neos, we recommend to import the existing demo site so you can follow the next
   section giving you a basic tour of the user interface.

   .. figure:: Images/Setup-Step-4.png
      :alt: Create new site or import an existing
      :class: screenshot-fullsize

#. If all went well you'll get a confirmation the setup is completed, and you can enter the
   frontend or backend of your Neos website.

   .. figure:: Images/StartPage.png
      :alt: The TYPO3 Neos start page
      :class: screenshot-fullsize

	The TYPO3 Neos start page

.. _TYPO3 Flow Documentation: http://docs.typo3.org/flow/TYPO3FlowDocumentation/Index.html
.. _TYPO3 Flow Requirements Documentation: http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartII/Requirements.html
.. _TYPO3 Flow File Permissions: http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartII/Installation.html#file-permissions
