Overview
This article explains how to install ownCloud on a DreamCompute Ubuntu instance.
Launch an instance
First, launch an Ubuntu 16.04 LTS instance. View the following category of articles for different ways to do this:
Use a volume based instance
It is recommended to boot a volume backed instance as they are permanent as opposed to ephemeral disks and can be larger than 80GB in size if larger amounts of data will be stored. This can be done in the DreamCompute dashboard.
Using multiple instances
Optionally, multiple instances can be used such as one hosting ownCloud HTTP and a second hosting the database. It is strongly recommended to use private networking for such a setup. The other differences include the MySQL instance having a security group rule to open port 3306, MySQL listening on the correct IP address, and MySQL user allowing other than localhost.
Log into your instance
To start installing software, log in to your DreamCompute instance:
Installing MariaDB
Run the following commands to install MariaDB:
[user@instance]$ sudo apt-get update [user@instance]$ sudo apt-get install -y mariadb-server
During installation the root database user will be set up without a password, however an authentication plugin will prevent login from anyone but the operating system root user. A password can be set if desired, otherwise MySQL root access is gained like so:
[user@instance]$ sudo mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 55 Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 Ubuntu 16.04 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Configuring MariaDB
By default the database server will listen only on localhost, not exposing the MySQL server to the outside world. This is optimal for security, but can be equally as secure as a separate instance with private networking.
Add a MySQL user for ownCloud
It is best practice to make a new MySQL user for use with ownCloud for security purposes. To do this, connect to MySQL:
[user@instance]$ sudo mysql -u root
Next, run the following commands in order.
This example uses 'owncloud' as the MySQL user name and database name for simplicity. PASSWORD is the desired password for the database.
[user@instance]$ CREATE DATABASE owncloud; [user@instance]$ CREATE USER 'owncloud'@'localhost' IDENTIFIED BY 'PASSWORD'; [user@instance]$ GRANT ALL ON owncloud.* TO owncloud@'localhost'; [user@instance]$ flush privileges; [user@instance]$ exit
Installing the ownCloud application
Installing Dependencies
Now that a database has been created that ownCloud can use you can deploy the frontend application. Run the following:
The backslash character \ is used when entering a long command. When you enter the \, the terminal command continues to the next line until you finish entering it.
You could also remove the \ character and put every parameter into a single line.
[user@instance]$ sudo apt-get install -y apache2 libapache2-mod-php php-gd \ php-json php-mysql php-curl php-intl php-mcrypt \ php-imagick php-zip php-dom php-mbstring
Downloading ownCloud
You must now download the actual ownCloud application.
- Navigate to owncloud.com/download-server/#instructions-server in a browser.
- Under the ownCloud Server section, right click the Download Tar button.
- In the pop-out menu, click Copy link address.
- Next, run wget followed by pasting the URL you just copied. This example uses a version 10.0.3. Make sure you're using the version you just copied.
[user@instance]$ wget https://download.owncloud.org/community/owncloud-10.0.3.tar.bz2
- Decompress the file by running:
[user@instance]$ tar xvf owncloud-10.0.3.tar.bz2
This will create a directory called owncloud in the current directory.
Setting up the owncloud directory
You must now copy the owncloud directory to the correct location on your instance. This example assumes it was downloaded to /home/ubuntu/owncloud and that you're moving it to /var/www/.
[user@instance]$ sudo mv /home/ubuntu/owncloud /var/www/
If you see the error sudo: unable to resolve host, ignore it. You can check the /var/www/ directory to confirm the owncloud folder has been correctly copied.
Change the permissions of the owncloud directory so that the web user (www-data in this case) can access it.
[user@instance]$ sudo chown -R www-data:www-data /var/www/owncloud
If the ownCloud package is no longer needed, clean it up by running:
[user@instance]$ rm owncloud-10.0.3.tar.bz2
As before, the file name may vary with different versions so adjust the command as needed.
Configuring Apache
Now that ownCloud is in the correct location you can configure Apache to use it.
Navigate to the following directory:
[user@instance]$ cd /etc/apache2/sites-available/
Create a file named owncloud.conf in this directory with the following contents:
Alias /owncloud "/var/www/owncloud/" <Directory /var/www/owncloud/> Options +FollowSymlinks AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/owncloud SetEnv HTTP_HOME /var/www/owncloud </Directory>
Enable this new configuration by running:
[user@instance]$ sudo a2ensite owncloud
Next, enable an apache module needed for ownCloud by running:
[user@instance]$ sudo a2enmod rewrite
You should also use SSL with ownCloud to protect login information and data. Apache installed on Ubuntu comes with a self-signed cert. To enable SSL using that cert run:
[user@instance]$ sudo a2enmod ssl [user@instance]$ sudo a2ensite default-ssl [user@instance]$ sudo service apache2 restart
Finishing the installation
At this point, everything is configured on the instance. Open a browser and visit https://IP/owncloud where IP is the IP address of your instance. The website will ask for a username and password, a data storage location (which can be kept as the default), and then the database information.
If you used the defaults above, the username and database name are 'owncloud', the host can remain set to 'localhost', and the password is the one you created above.
Click to continue, and if all is setup correctly the ownCloud Files page will load.