Skip to content

Commit 1dec9bb

Browse files
authored
Merge pull request #15405 from nextcloud/jtr/docs-admin-install-cli-update
docs(installation): update command-line installation guidance
2 parents c97cdbb + f24c947 commit 1dec9bb

2 files changed

Lines changed: 99 additions & 61 deletions

File tree

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,67 @@
1-
============================
2-
Installing from command line
3-
============================
1+
==============================
2+
Install from the command line
3+
==============================
44

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.
98

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.
1112

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`.
1515

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:
1719

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
2021
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/
2623
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`.
3027

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:
3231

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
3733
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
3953
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.

admin_manual/occ_system.rst

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -885,45 +885,55 @@ These commands are only available before Nextcloud has been installed, after
885885
you have unpacked the archive and copied Nextcloud into the appropriate
886886
directories.
887887

888-
Display the available installation options::
889-
890-
sudo -E -u www-data php /var/www/nextcloud/occ maintenance:install --help
891-
Nextcloud is not installed - only a limited number of commands are available
892-
893-
Usage:
894-
maintenance:install [options]
895-
896-
Options:
897-
--database[=DATABASE] Supported database type [default: "sqlite"]
898-
--database-name[=DATABASE-NAME] Name of the database
899-
--database-host[=DATABASE-HOST] Hostname of the database [default: "localhost"]
900-
--database-port[=DATABASE-PORT] Port of the database
901-
--database-user[=DATABASE-USER] User name to connect to the database
902-
--database-pass[=DATABASE-PASS] Password of the database user
903-
--database-table-prefix[=...] Table prefix for every table in the database
904-
--admin-user[=ADMIN-USER] User name of the admin account [default: "admin"]
905-
--admin-pass[=ADMIN-PASS] Password of the admin account
906-
--data-dir[=DATA-DIR] Path to data directory [default: "/var/www/nextcloud/data"]
907-
908-
This example installs Nextcloud with a MySQL database::
909-
910-
sudo -E -u www-data php occ maintenance:install \
911-
--database mysql \
912-
--database-name nextcloud \
913-
--database-host 127.0.0.1 \
914-
--database-user nextcloud \
915-
--database-pass secret \
916-
--admin-user admin \
917-
--admin-pass password
888+
Display the available installation options:
889+
890+
.. code-block:: console
891+
892+
$ sudo -E -u www-data php /var/www/nextcloud/occ maintenance:install --help
893+
Nextcloud is not installed - only a limited number of commands are available
894+
895+
Usage:
896+
maintenance:install [options]
897+
898+
Options:
899+
--database[=DATABASE] Supported database type [default: "sqlite"]
900+
--database-name[=DATABASE-NAME] Name of the database
901+
--database-host[=DATABASE-HOST] Hostname of the database [default: "localhost"]
902+
--database-port[=DATABASE-PORT] Port the database is listening on
903+
--database-user[=DATABASE-USER] Login for database connection
904+
--database-pass[=DATABASE-PASS] Password of the database login
905+
--database-table-space[=DATABASE-TABLE-SPACE]
906+
Table space of the database (``oci`` only)
907+
--disable-admin-user Disable the creation of an administrator login
908+
--admin-user[=ADMIN-USER] Login for initial administrator account [default: "admin"]
909+
--admin-pass[=ADMIN-PASS] Password for initial administrator login
910+
--admin-email[=ADMIN-EMAIL] E-Mail to associate with the initial administrator login
911+
--data-dir[=DATA-DIR] Path to data directory
912+
--password-salt[=PASSWORD-SALT] Password salt; generated if not provided (ADVANCED)
913+
--server-secret[=SERVER-SECRET] Server secret; generated if not provided (ADVANCED)
914+
915+
This example installs Nextcloud with a MySQL database. ``occ`` prompts for
916+
the database and administrator passwords:
917+
918+
.. code-block:: console
919+
920+
$ sudo -E -u www-data php /var/www/nextcloud/occ maintenance:install \
921+
--database mysql \
922+
--database-name nextcloud \
923+
--database-host 127.0.0.1 \
924+
--database-user nextcloud \
925+
--admin-user admin
926+
What is the password to access the database with user <nextcloud>?
927+
What is the password you like to use for the admin account <admin>?
918928
Nextcloud was successfully installed
919929
920930
Supported databases:
921931

922-
* ``sqlite`` — SQLite (community edition only; not recommended for production)
932+
* ``sqlite`` — SQLite (not recommended for production usage)
923933
* ``mysql`` — MySQL or MariaDB
924934
* ``pgsql`` — PostgreSQL
925-
* ``oci`` — Oracle (Nextcloud Enterprise only)
926-
935+
* ``oci`` — Oracle; contact `Nextcloud GmbH
936+
<https://nextcloud.com/enterprise/>`_ for enterprise support
927937

928938
.. _command_line_upgrade_label:
929939

0 commit comments

Comments
 (0)