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 server
To start installing software, log in to your DreamCompute instance:
Run the following commands to install MariaDB:
[user@server]$ sudo apt-get update [user@server]$ 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@server]$ 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)]>
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@server]$ 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@server]$ CREATE DATABASE owncloud; [user@server]$ CREATE USER 'owncloud'@'localhost' IDENTIFIED BY 'PASSWORD'; [user@server]$ GRANT ALL ON owncloud.* TO owncloud@'localhost'; [user@server]$ flush privileges; [user@server]$ exit
Installing the ownCloud application
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@server]$ 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
You must now download the actual ownCloud application.
- Navigate to https://owncloud.org/install/#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@server]$ wget https://download.owncloud.org/community/owncloud-10.0.3.tar.bz2
- Decompress the file by running:
[user@server]$ 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 server. This example assumes it was downloaded to /home/ubuntu/owncloud and that you're moving it to /var/www/.
[user@server]$ 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@server]$ sudo chown -R www-data:www-data /var/www/owncloud
If the ownCloud package is no longer needed, clean it up by running:
[user@server]$ rm owncloud-10.0.3.tar.bz2
As before, the file name may vary with different versions so adjust the command as needed.
Now that ownCloud is in the correct location you can configure Apache to use it.
Navigate to the following directory:
[user@server]$ 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@server]$ sudo a2ensite owncloud
Next, enable an apache module needed for ownCloud by running:
[user@server]$ 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@server]$ sudo a2enmod ssl [user@server]$ sudo a2ensite default-ssl [user@server]$ sudo service apache2 restart
Finishing the installation
At this point, everything is configured on the server. 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.