Development environment

    First set up your Web server and database (Section: Manual Installation - Prerequisites).

    Get the source

    There are two ways to obtain Nextcloud sources:

    • Using the stable version
    • Using the development version from which will be explained below.

    To check out the source from GitHub you will need to install Git (see from the GitHub help)

    To get started the basic Git repositories need to be cloned into the Web server’s directory. Depending on the distribution this will either be

    • /var/www/html
    • /srv/http

    Then identify the user and group the Web server is running as and the Apache user and group for the chown command will either be

    • http
    • www-data
    • apache
    • wwwrun

    The following commands are using /var/www as the Web server’s directory and www-data as user name and group.

    After the development tool installation make the directory writable so you install the code as your regular user, and don’t need root privileges:

    Then install Nextcloud at the root of your site from Git:

    1. cd /var/www
    2. git submodule update --init

    Create the data folder:

    1. mkdir data

    Adjust permissions:

    1. cd /var/www
    2. sudo chown -R www-data:www-data config data apps

    Finally, restart the Web server (this might vary depending on your distribution):

    or:

    1. sudo systemctl restart apache2.service

    or:

    1. sudo /etc/init.d/apache2 restart

    Now access the installation at http://localhost/ (or the corresponding URL) in your web browser to set up your instance.

    This optional step is especially necessary if you want to test upgrading, as the following apps are required to be present during an upgrade.

    Install the viewer app:

    1. cd /var/www/apps
    2. git clone https://github.com/nextcloud/viewer.git

    When upgrading the server code you might need to upgrade the app code as well before running .

    Note

    The same applies to all the apps listed under alwaysEnabled in but most are already present in the server repository.

    Note

    Do not enable this for production! This can create security problems and is only meant for debugging and development!

    To disable JavaScript and CSS caching, debugging has to be enabled by setting debug to true in config/config.php:

    If you have more than one repository cloned, it can be time consuming to do the same the action to all repositories one by one. To solve this, you can use the following command template:

    1. find . -maxdepth <DEPTH> -type d -name .git -exec sh -c 'cd "{}"/../ && pwd && <GIT COMMAND>' \;

    then, e.g. to pull all changes in all repositories, you only need this:

      It is even easier if you create alias from these commands in case you want to avoid retyping those each time you need them.