|
1 | | -============================ |
2 | | -Installing from command line |
3 | | -============================ |
| 1 | +============================== |
| 2 | +Install from the command line |
| 3 | +============================== |
4 | 4 |
|
5 | | -It is now possible to install Nextcloud entirely from the command line. This is |
6 | | -convenient for scripted operations, headless servers, and sysadmins who prefer |
7 | | -the command line. There are three stages to installing Nextcloud via the command |
8 | | -line: |
| 5 | +You can install Nextcloud without using the web-based Installation Wizard. This |
| 6 | +is useful for automated deployments, headless servers, and administrators who |
| 7 | +prefer the command line. |
9 | 8 |
|
10 | | -1. Download the Nextcloud code and unpack the tarball in the appropriate directories. (See :doc:`source_installation`.) |
| 9 | +Before continuing, download and unpack the Nextcloud archive, configure the web |
| 10 | +server and PHP, and create the database and database user when using MySQL, |
| 11 | +MariaDB, PostgreSQL, or Oracle. |
11 | 12 |
|
12 | | -2. Change the ownership of your ``nextcloud`` directory to your HTTP user, like |
13 | | -this example for Debian/Ubuntu. You must run ``occ`` as your HTTP user; see |
14 | | -:ref:`http_user_label`:: |
| 13 | +For the complete manual-installation prerequisites, see |
| 14 | +:doc:`source_installation`. |
15 | 15 |
|
16 | | - $ sudo chown -R www-data:www-data /var/www/nextcloud/ |
| 16 | +1. Ensure that the HTTP user has read and write access to all Nextcloud |
| 17 | + directories. Changing ownership is the usual approach; for example, on |
| 18 | + Debian/Ubuntu: |
17 | 19 |
|
18 | | -3. Use the ``occ`` command to complete your installation. This takes the place |
19 | | -of running the graphical Installation Wizard:: |
| 20 | + .. code-block:: console |
20 | 21 |
|
21 | | - $ cd /var/www/nextcloud/ |
22 | | - $ sudo -E -u www-data php occ maintenance:install \ |
23 | | - --database 'mysql' --database-name 'nextcloud' \ |
24 | | - --database-user 'nextcloud' --database-pass 'password' \ |
25 | | - --admin-user 'admin' --admin-pass 'password' |
| 22 | + $ sudo chown -R www-data:www-data /var/www/nextcloud/ |
26 | 23 |
|
27 | | -Note that you must change to the root Nextcloud directory, as in the example |
28 | | -above, to run ``occ maintenance:install``, or the installation will fail with |
29 | | -a PHP fatal error message. |
| 24 | + Ownership is not strictly required. For example, where changing ownership is |
| 25 | + not possible, add the HTTP user to the group that owns the directories and |
| 26 | + ensure that they are group-writable. See :ref:`http_user_label`. |
30 | 27 |
|
31 | | -Supported databases are:: |
| 28 | +2. Use the ``occ`` command to complete the installation. This takes the place |
| 29 | + of the graphical Installation Wizard. Run ``occ`` as the HTTP user so that |
| 30 | + ownership and permissions remain consistent with the web server: |
32 | 31 |
|
33 | | - - sqlite (SQLite3 - Nextcloud Community edition only) |
34 | | - - mysql (MySQL/MariaDB) |
35 | | - - pgsql (PostgreSQL) |
36 | | - - oci (Oracle currently only possible if you contact us at https://nextcloud.com/enterprise as part of a subscription) |
| 32 | + .. code-block:: console |
37 | 33 |
|
38 | | -See :ref:`command_line_installation_label` for more information. |
| 34 | + $ sudo -E -u www-data php /var/www/nextcloud/occ maintenance:install \ |
| 35 | + --database mysql --database-name nextcloud \ |
| 36 | + --database-user nextcloud \ |
| 37 | + --admin-user admin |
| 38 | +
|
| 39 | + This command prompts for the database and administrator passwords. For |
| 40 | + unattended installations, specify ``--database-pass`` and ``--admin-pass`` |
| 41 | + using your deployment system's protected secret-handling mechanism. Avoid |
| 42 | + exposing production passwords in shell history or process listings. |
| 43 | + |
| 44 | + You can invoke ``occ`` from any directory when using its absolute path, as |
| 45 | + in the example above. Alternatively, change to the Nextcloud root directory |
| 46 | + and run ``sudo -E -u www-data php occ maintenance:install``. |
| 47 | + |
| 48 | + Use ``--database-host`` and, if necessary, ``--database-port`` when the |
| 49 | + database runs on another host. Use ``--data-dir`` to select a data directory |
| 50 | + other than the default. To view all supported options, run: |
| 51 | + |
| 52 | + .. code-block:: console |
39 | 53 |
|
| 54 | + $ sudo -E -u www-data php /var/www/nextcloud/occ maintenance:install --help |
| 55 | +
|
| 56 | +Supported databases are: |
| 57 | + |
| 58 | +- ``sqlite`` (SQLite) |
| 59 | +- ``mysql`` (MySQL/MariaDB) |
| 60 | +- ``pgsql`` (PostgreSQL) |
| 61 | +- ``oci`` (Oracle; contact `Nextcloud GmbH |
| 62 | + <https://nextcloud.com/enterprise/>`_ for enterprise support) |
| 63 | + |
| 64 | +The selected database requires its corresponding PHP extension or driver to be |
| 65 | +installed and enabled. |
| 66 | + |
| 67 | +See :ref:`command_line_installation_label` for more information. |
0 commit comments