Setup Your Development Environment
Introduction
This page helps with setting up your environment for use with and developing ownCloud.
Feel free to skip already one or more of the following steps, if you have already completed them. Otherwise, if you’re just getting started, begin by getting the ownCloud source code.
Install the Core Software
The first thing to do is to ensure that your server has the necessary software for installing and running ownCloud. While you can go further, you need to install at least the required packages. Then, you will need to install the software required to run the development environment’s installation process.
Install Dependencies on Ubuntu 16.04/18.04
Install nodejs, make, unzip, and git
cd ~
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get -y -q update
sudo apt-get -y -q upgrade
sudo apt-get install nodejs build-essential make unzip git
Install Composer
Prepare the Installation
cd ~/tmp
sudo apt-get install wget php-cli php-zip
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
If the hashes match, you will see the following output:
Installer verified
Install Composer
To install Composer, run the following command:
sudo php composer-setup.php \
--install-dir=/usr/local/bin \
--filename=composer
Running the command will produce output similar to the following.
All settings correct for using Composer Downloading... Composer (version 1.7.2) successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composer
Verify the Installation
To verify that Composer is properly installed, run composer
.
You should see output similar to that below.
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.8.4 2019-02-11 10:52:10
Composer is fully installed, and ready to be used.
Install Yarn
# Enable the Yarn repository
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# Add the Yarn APT repository to your system’s software repository list:
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# Update the package list and install Yarn:
sudo apt-get update
sudo apt-get install --no-install-recommends yarn
Install Dependencies on openSUSE Leap 42.3
# Ensure that Zypper's cache is up to date sudo zypper --non-interactive --quiet \ update --auto-agree-with-licenses --best-effort # Auto-install the required dependencies with a minimum of output sudo zypper --quiet --non-interactive install \ wget make nodejs6 nodejs-common unzip git npm6 phantomjs php7-curl php7-openssl openssl php7-phar
Setup the Webserver and Database
Next, you need to setup your web and database servers, so that they work properly with ownCloud. The respective guides are available at:
Get The Source
With the web and database servers setup, you next need to get a copy of ownCloud. There are two ways to do so:
-
Use a manual installation
-
Clone the development version from GitHub:
For the sake of a brief example, assuming you chose to clone from GitHub, here’s an example of how to do so:
# Assuming that /var/www/html is the webserver's document root git clone https://github.com/owncloud/core.git /var/www/html/core
What is the Web Server’s Root Directory?
The quickest way to find out is by using the ls
command, for example:
ls -lah /var/www
. Depending on your Linux distribution, it’s likely
to be one of /var/www
, /var/www/html
, or /srv/http
.
Set User, Group, and Permissions
You now need to make sure that the web server user (and optionally the
web server’s group) have read/write access to the directory where you
installed ownCloud: The following commands assume that /var/www
is the
web server’s directory and that www-data
is the web server user and
group. The following commands will do this:
# Set the user and group to the webserver user and group sudo chown -R www-data:www-data /var/www/html/core/ # Set read/write permissions on the directory sudo chmod o+rw -R /var/www/html/core/
What is the Web Server’s User and Group?
There are a few ways to identify the user and group the webserver is
running as. Likely the easiest are grep
and ps
. Here’s an example of
using both (which assumes that the distribution is Ubuntu 16.04).
# Find the user defined in Apache's configuration files grep -r 'APACHE_RUN_USER' /etc/apache2/ # Find the user that's running Apache. ps -aux | grep apache2
Depending on your distribution, it will likely be one of http
, www-data
, apache
, or wwwrun
.
Install Software Dependencies
With the ownCloud source available to your webserver, next install ownCloud’s dependencies by running Make, from the directory where ownCloud’s located. Here’s an example of how to do so:
# Assuming that the ownCloud source is located in `/var/www/html/core`
cd /var/www/html/core && make
By default, running make
will install the required dependencies for
both PHP and JavaScript. However, there are other options that it
supports, which you can see in the table below, which are useful for a
variety of tasks.
Target | Description |
---|---|
make |
Pulls in both Composer and Bower dependencies |
make clean |
Cleans up dependencies. This is useful for starting over or when switching to older branches |
make dist |
Builds a minimal owncloud-core tarball with only core apps in build/dist/core, stripped of unwanted files |
make docs |
Builds the JavaScript documentation using JSDoc |
make test |
Runs all of the test targets |
make test-external |
Runs one of the external storage tests, and is configurable through make variables |
make test-js |
Runs the Javascript unit tests, replacing ./autotest-js.sh |
make test-php |
Runs the PHPUnit tests with SQLite as the data source. |
Enable Debug Mode
Now that ownCloud’s available to your web server and the dependencies
are installed, we strongly encourage you to disable JavaScript and CSS
caching during development. This is so that when changes are made,
they’re immediately visible, not at some later stage when the respective
caches expire. To do so, enable debug mode by setting debug
to true
in config/config.php, as in the example below.
<?php
$CONFIG = [
'debug' => true,
... configuration goes here ...
];
Do not enable this for production! This can create security problems and is only meant for debugging and development!
Setup ownCloud
With all that done, you’re now ready to use either the installation wizard or command line installer to finish setting up ownCloud.