Install OwnCloud on your Raspberry Pi

Powered by Drupal
Submitted by Sam Hobbs on

Owncloud Logo OwnCloud is a free (libre), open source equivalent to DropBox. As well as the program you install on your server, it has free desktop sync clients for Linux, Windows and Mac, and apps for Android and iOS. I’m just going to cover the server side of things for your Pi in this tutorial, because the desktop client can be found in the Ubuntu repos, and the app is on the Play Store. If you want the Android app free of charge, then install it via F-Droid.

First, install Apache 2 and some other bits.

These are all the bits you need to install before you can run OwnCloud.

sudo apt-get install apache2 php5 php5-gd php-xml-parser php5-intl
sudo apt-get install php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl

Next, Download and Install OwnCloud

If you visit the Owncloud installation page here, you will find the installation file. Choose “Tar or Zip File” under the server heading. OwnCloud intsallation download page Now copy the link address of .tar.bz2 file (you can do this by right clicking and choosing “Copy Link Address” in Chrome or Chromium). At the time of writing, this address is http://download.owncloud.org/community/owncloud-5.0.12.tar.bz2, but it will change when a new version comes out, so it’s worth checking. Save the address of the UNIX .tar.bz2 file (right click, copy link address in Chrome) Save the address of the UNIX .tar.bz2 file (right click, copy link address in Chrome). Now, open a secure shell (SSH) into your Pi, and download the file:

wget http://download.owncloud.org/community/owncloud-5.0.12.tar.bz2

The zip file will be downloaded to your home directory (unless you were in some other directory before you ran that command, in which case it will be in there). Now extract the .tar file:

tar -xjf owncloud-5.0.12.tar.bz2

You will now have a sub-directory in your home directory called owncloud. Copy it to Apache’s data directory:

cp -r owncloud /var/www/

This will copy all your owncloud stuff into a directory at /var/www/owncloud, meaning that your owncloud website will be located at yourdomain.com/owncloud/.

Optional: Move OwnCloud to the Root Apache2 Directory

If you would like owncloud to be on the root of your domain (i.e. yourdomain.com takes you straight to owncloud) then you can move the contents of /var/www/owncloud up a directory into /var/www/ with the following command:

cd /var/www/
sudo find owncloud -maxdepth 1 -mindepth 1 -exec mv {} . \;
sudo rmdir owncloud

I got that handy tip from this website, check it out for a great explanation.

A Few Final Touches

Now, make sure that Apache owns all of those files you just added:

sudo chown -R www-data:www-data /var/www/

Now open your Apache virtual host file and change it to enable .htaccess files for OwnCloud (this is necessary so that OwnCloud can do things like override the global maximum file size for uploads):

sudo nano /etc/apache2/sites-enabled/000-default

Change AllowOverride None to AllowOverride All in the Directory /var/www/ section of the file. Now check if an .htaccess file for OwnCloud exists. If it doesn’t, create it:

cd /var/www/ #use /var/www/owncloud if you didn't move it to /var/www/
ls -al
#look for .htaccess. If it exists, skip the next two lines
sudo touch .htaccess
sudo chown www-data:www-data .htaccess

Now run the following two commands to enable some apache modules, and restart apache2:

sudo a2enmod rewrite
sudo a2enmod headers
sudo service apache2 restart

Port Forwarding and DNS

If you want to access your ownCloud installation from outside your LAN, you'll need to forward ports 80 and 443 (for HTTP and HTTPS) to the Pi from your router. If you haven't done this already, you may want to use my tutorials to set up a DNS A record to map your domain name to your public IP address, and make use of ddclient to update your DNS records when they change if you have a dynamic IP address.

Testing

Test your installation, by visiting your server’s URL. Either use http://yourdomain.com/owncloud if you didn’t move owncloud to Apache’s root directory, or http://yourdomain.com if you did. You should be greeted with an installation wizard. Owncloud database drivers error If you get an error about database drivers, then try installing php5-mysql again – for some reason, it didn’t install properly first time for me, although no errors were shown:

sudo apt-get install php5-mysql
sudo reboot

You should no longer see the error if you visit the page again.

Database Username and Password

The OwnCloud installation wizard will ask you for a database username and password. If you haven’t set up any other databases on this server before (and therefore don’t have a root database user and password) then you will have to create a root database username and password before you can continue. If you are already using software that uses databases (like WordPress) then you probably already have a database root username and password, and can skip this step. Install mysql server and client:

sudo apt-get update
sudo apt-get install mysql-server mysql-client

The package installation will bring up a configuration wizard. Enter the username you’d like to use, and a password. Write these down, you’ll need them later. Now you can complete the installation. Go back to your browser with the OwnCloud setup wizard, and choose a username and password for your OwnCloud user account. You also need to enter the database root username and password, and choose a name for the OwnCloud database (“owncloud” will do). The database location is localhost.

Some extras

1) Cut Page Loading Times with a PHP Cache

PHP is a server side scripting language. When you request a page on the server, the server has to compile the page from the PHP source. Because your Pi is such a low powered machine, this can be really slow. Luckily, there’s a PHP cache you can use that will store a pre-compiled copy of pages in your RAM after they have been visited already. This makes a MASSIVE difference – before installing the cache, it took 21 seconds to load the index page, afterwards a mere 7-8 seconds. Install it by using this command:

sudo apt-get install php-apc

Now restart the Apache web server using:

sudo service apache2 restart

The first time you visit a page may be slow, but if you navigate away and then come back to it you should notice a significant improvement. Thanks to Steve Riley at Kubuntuforums for this tip.

2) Put all your data on an external hard drive

If you have moved your Pi’s root filesystem to a USB flash drive then you may have enough storage to use OwnCloud as it is. However, one of the main advantages of using OwnCloud instead of Dropbox is that you can easily plug in as many hard drives as you like and wave goodbye to that 5GB storage limit. I attached a self-powered 500GB hard drive to mine, and it works beautifully. Remember, the Pi doesn’t have enough power to run a passport drive without an external hub to provide power. Before we start, format your hard drive with a journalling filesystem such as ext3 or ext4. First, make the directory ready to mount your drive:

sudo mkdir /media/owncloud

Plug in your drive to your Pi, and type:

sudo blkid

Make a note of the output for the device you want to mount. Here’s an example (it’s for one of my laptop’s partitions, hence /dev/sda6, yours will be a whole drive, e.g. /dev/sdX)

/dev/sda6: LABEL="Data" UUID="f052e620-9e88-4b19-9b9a-d6dce4d6603b" TYPE="ext4"

Now edit the file /etc/fstab, which controls how and where drives are mounted at boot.

sudo nano /etc/fstab

Edit the file so it looks something like this, but replace my UUID with yours and update the filesystem type from ext4 to whatever you are using if necessary:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
UUID="96f64567-c459-4d3d-9f52-e6aabee544d2"     /media/owncloud         ext4    defaults    0       2
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off]  for that

Now reboot the Pi and check your drive is mounted properly:

cd /media/owncloud
ls -al

Stop Apache2:

sudo service apache2 stop

Now we need to move Owncloud’s data directory, and create some symbolic links so that the rest of Owncloud still knows where to look for data. Where you’re moving stuff from depends on whether or not you moved owncloud to Apache’s root (/var/www). If you did move it, then owncloud is currently installed at /var/www; if you didn’t move it then it’s in /var/www/owncloud. I’m going to assume that you did move Owncloud. If you didn’t, then you need to insert /owncloud after /var/www in each of these steps. Move /var/www/data to /media/owncloud:

sudo mv /var/www/data /media/owncloud/data

Create a symbolic link to the new owncloud directory.

sudo ln -s /media/owncloud/data /var/www/data

Now do the same for the config folder:

sudo mv /var/www/config /media/owncloud/config
sudo ln -s /media/owncloud/config /var/www/config

Now check that the ownership of the moved files is Apache (www-data): sudo chown -R www-data:www-data /media/owncloud Now start Apache2 again:

sudo service apache2 start

Any data you now upload should go in your external hard drive. I owe thanks to Steve Riley (again!) at OwnCloud forums for this one.

3) Force SSL (https) Connection

You can force your users to connect to OwnCloud using an HTTPS connection. Simply change the virtual hosts file for apache2 to enable .htaccess as before: open /etc/apache2/sites-available/default-ssl and change AllowOverride None to AllowOverride All under the Directory /var/www/. Make sure you have the line SSLEngine on, and your SSLCertificateFile and SSLCertificateKeyFile point to the certificates you’d like to use. Now enable the Apache SSL module:

sudo a2enmod ssl

Enable the SSL site:

sudo a2ensite default-ssl

Reload Apache:

sudo service apache2 reload

Now visit https://yourdomain.com/owncloud if you didn’t move apache to your root, or https://yourdomain.com if you moved owncloud to your root directory. Using the drop-down menu, navigate to admin –> admin, and under the Security header, tick the Enforce HTTPS box. Check the Enforce HTTPS box Note that you will only be able to do this if you are connected with https (otherwise you’d lock yourself out!) All done. Now all your communications between the client machines and your server will be encrypted. If you try to visit the http version of OwnCloud, you will be redirected to https. If you don't already have a SSL certificate, you may want to generate your own and get it signed by CAcert for free. Hope you found that useful. If there’s anything else you’d like to know, leave a comment!

Comments

Hi Sam,

I've already setup the DNS A record a few days ago, thanks.

Struggling to set up port forwarding port 80 (and I guess will too for https). My router tells me I already have port forwarding for port 80 (email server on different IP)...

I searched online and it doesn't seem possible to set up port forwarding for the same port for multiple devices.

Does this mean I can't use a second RasPi for the Owncloud on the same LAN and I should redo everything on my email server (also raspi)?

Or is there a different method?

Regards,

Jo

Jorge gomez

Thu, 02/18/2016 - 19:24

Sam do you have a tutorial or something that explains my problem. If I go into owncloud from my internal network 192.168.1.67/owncloud I get in whit out any problems but if I try through my pi.owncloud.net/owncloud I can't get anywhere in my internal network. No problem from out side my network going in. I am using a pi. Hope I explained my self
Thanks

Some routers can't recognise that outgoing connections to their own WAN IP address are actually supposed to connect to them, so they don't hairpin the connection back inside the LAN (hope that makes sense, I can't remember the technical term). If your router runs Linux, just edit its /etc/hosts file to add yourdomain.com, make it map to the LAN IP of your server. That way, clients on the LAN will get the LAN IP when they do a DNS lookup. Sam

Hi Sam,

Still struggling on...rested my brain yesterday...trying to crack on again now! I'll first try to get owncloud working before going through the whole process of doing all the mail server stuff.

The testing part sort of doesn't work for me:

When I tried pi-box.co.uk/owncloud, I get an error message (but I know it may be 'cause I'm inside my LAN - I've updated my port forwarding to point to my pi-box raspi too). When I use 192.168.1.100/owncloud, I get the login screen, but it doesn't ask for the database details and takes me straight in to owncloud once I logged in to owncloud. Once in, I can't find anywhere to add the database username password, etc. I even followed owncloud's documentation, but to no avail.

Another (important) point:

When I installed mysql-server and mysql-client, it did ask me for a password, but not username and it also couldn't 'save' my password and suggested I add it later? It also mentioned something like it could be because it couldn't connect or keep the connection to the owncloud server...

Do I need to uninstall mysql-server and client and then retry the installation?

Any help is appreciated.

Thx,

Jo

Hi Sam,

I found on namecheap that I had a dns record conflict and have sorted that now, so I can get to owncloud from outside the LAN, but the rest is still an issue for me...

Regards,

Jo

Hi Sam,

Another win! After trying the documentation unsuccessfully, I took to Google again and eventually found this piece of information that worked:

It was on some owncloud forum and a guy called Jim, he says:

I would recommend leaving it as SQLite and see how it performs with the other users. However, one way to migrate to MySQL is as follows, although I haven’t tested it. Note you lose any existing users, so those will have to be created again, but the data is otherwise preserved (apparently).

1. Edit /var/www/owncloud/config/config.php

2. In that file, change
‘installed’ => true,
to
‘installed’ => false,

3. The above step makes Owncloud go through the install procedure again, effectively putting you back at the section entitled “Create a Login for Owncloud” in the procedure outlined in this post. Surf to your Owncloud address and you should see the dark blue setup screen again. Choose MySQL as the database and take it from there.

The link: http://unixetc.co.uk/2015/02/21/simple-owncloud-installation-on-raspber…

I tried it and it worked. On my browser it took me back to the installation and I could choose mysql this time!

Thought I'd share it.

Now for the rest...

Regards,

Jo

Hi Sam,

Still battling away...

I found it's using Sqlite3 for the db. I shall try the instructions on the documentation again...had some errors which I don't understand yet...

Some quick wins so far:

I managed to completely uninstall and re-install mysql-server and mysql -client using this method http://www.randomhacks.co.uk/mysql-job-failed-to-start-unable-to-set-ro…

It went through fine and a password was set!

The DNS A record where I had 2 ip addresses has also now been resolved...just one showing up on 'dig'

I will keep chipping away and hopefully have it set up tonight!

Regards,

Jo

Hi Sam,

I am trying to move the data folder to the usb hard drive, but get this message:

admin@pi-box:~ $ sudo mv /var/www/owncloud/data /media/owncloud/data
mv: inter-device move failed: ‘/var/www/owncloud/data’ to ‘/media/owncloud/data’; unable to remove target: Read-only file system

I formatted to ext4 and followed all the other instructions, rebooted and everything looks fine...until the message.

I'm at a slight loss as to where to go next...

Any ideas?

Regards,

Jo

Hi Sam,

I thought this might be useful to try and help me:

admin@pi-box:~ $ ls -l /media/owncloud/config
total 40
lrwxrwxrwx 1 www-data www-data 22 Feb 21 19:25 config -> /media/owncloud/config
-rw-r----- 1 www-data www-data 608 Feb 20 18:58 config.php
-rw-r--r-- 1 www-data www-data 36586 Feb 18 14:31 config.sample.php
admin@pi-box:~ $ sudo ls -l /media/owncloud/data
[sudo] password for admin:
total 104
drwxr-xr-x 6 www-data www-data 4096 Feb 20 19:37 admin
lrwxrwxrwx 1 www-data www-data 20 Feb 21 19:25 data -> /media/owncloud/data
-rw-r--r-- 1 www-data www-data 0 Feb 20 18:58 index.html
-rw-r--r-- 1 www-data www-data 93184 Feb 20 18:46 owncloud.db
-rw-r----- 1 www-data www-data 1132 Feb 20 18:58 owncloud.log
drwxr-xr-x 2 www-data www-data 4096 Feb 18 18:23 updater_backup

regards,

jo

Jo, You appear to have everything on the external HDD - why? Most of it should be in /var/www/owncloud, with just the data directory ( /var/www/owncloud/data ) symlinked to some directory on your external HDD mounted at /media/HDDname. You also have some strange symlinks that link to themselves (/media/owncloud/config/config links to /media/owncloud/config and /media/owncloud/data/data links to /media/owncloud/data). You may have got these from not using full paths when using ln -s (if you don't use a full path, paths start from whichever directory you're in). Sam

Hi Sam,

I'm so close now!

I gave up on my Maxtor HDD and tried a different HDD (Hitachi) - this one worked flawlessly and I raced through the steps until I tried 192.168.1.100/owncloud in my browser...I got the following error:

Can't write into config directory!
This can usually be fixed by giving the webserver write access to the config directory.

I tried sudo chmod 777 /var/www/owncloud/config, but it says I had no such file or directory...which config is it referring to?

Please advise.

Thx,

Jo

Hi Sam,

I thought this might be useful to try and help me:

admin@pi-box:~ $ ls -l /media/owncloud/config
total 40
lrwxrwxrwx 1 www-data www-data 22 Feb 21 19:25 config -> /media/owncloud/config
-rw-r----- 1 www-data www-data 608 Feb 20 18:58 config.php
-rw-r--r-- 1 www-data www-data 36586 Feb 18 14:31 config.sample.php
admin@pi-box:~ $ sudo ls -l /media/owncloud/data
[sudo] password for admin:
total 104
drwxr-xr-x 6 www-data www-data 4096 Feb 20 19:37 admin
lrwxrwxrwx 1 www-data www-data 20 Feb 21 19:25 data -> /media/owncloud/data
-rw-r--r-- 1 www-data www-data 0 Feb 20 18:58 index.html
-rw-r--r-- 1 www-data www-data 93184 Feb 20 18:46 owncloud.db
-rw-r----- 1 www-data www-data 1132 Feb 20 18:58 owncloud.log
drwxr-xr-x 2 www-data www-data 4096 Feb 18 18:23 updater_backup

regards,

jo

Hi Sam,

I have removed the links and linked only the /var/www/owncloud/data to /media/owncloud:

admin@pi-box:/media/owncloud $ ls -al
total 44
drwxr-xr-x 5 www-data www-data 4096 Feb 21 22:54 .
drwxr-xr-x 4 root root 4096 Feb 21 17:52 ..
drwxr-xr-x 2 www-data www-data 4096 Feb 21 22:26 config
drwxrwx--- 4 www-data www-data 4096 Feb 21 22:33 data
drwx------ 2 www-data www-data 16384 Feb 21 18:08 lost+found
-rw-r--r-- 1 www-data www-data 1024 Feb 21 22:41 owncloud.db
-rw-r----- 1 www-data www-data 7790 Feb 21 22:54 owncloud.log
admin@pi-box:/media/owncloud $ cd
admin@pi-box:~ $ sudo ls -l /media/owncloud
total 36
drwxr-xr-x 2 www-data www-data 4096 Feb 21 22:26 config
drwxrwx--- 4 www-data www-data 4096 Feb 21 22:33 data
drwx------ 2 www-data www-data 16384 Feb 21 18:08 lost+found
-rw-r--r-- 1 www-data www-data 1024 Feb 21 22:41 owncloud.db
-rw-r----- 1 www-data www-data 7790 Feb 21 22:54 owncloud.log
admin@pi-box:~ $ sudo ls -l /media/owncloud/config
total 40
-rw-r----- 1 www-data www-data 608 Feb 20 18:58 config.php
-rw-r--r-- 1 www-data www-data 36586 Feb 18 14:31 config.sample.php

192.168.1.100/owncloud still give the config error in the browser.

Please advise.

Thx

Jo

Maybe this will help you understand:
sam@samhobbs:/etc/spamassassin$ ll /media/backup/owncloud/
total 19880
drwxr-x--- 10 www-data www-data     4096 Feb  8 21:26 ./
drwxr-xr-x  4 sam      sam          4096 Nov 23  2014 ../
drwxr-xr-x  3 www-data www-data     4096 Nov 23  2014 $2a$08$9KiIdF7wFifFF9PynKxtLem2Op2TNEkjqCD7zrywYY.KHH3E4jkbG/
drwxr-xr-x  3 www-data www-data     4096 Nov 23  2014 $2a$08$KXCXwI.Vp1fuHwRgi1SwheMuzWwwaRlBpxTAWga75sflwVIMvLu16/
drwxr-xr-x  3 www-data www-data     4096 Dec 20  2014 $2a$08$SDrOecc2xlrThUBDqP9WOeM9pXQPIYLljFA/
drwxr-xr-x  8 www-data www-data     4096 Feb  8  2015 hobbsfamily/
-rw-r--r--  1 www-data www-data      284 Dec 23 12:16 .htaccess
-rw-r--r--  1 www-data www-data        0 Dec 23 12:16 index.html
-rw-r--r--  1 www-data www-data        0 Dec 23 12:16 .ocdata
-rw-r--r--  1 www-data www-data  5722112 Dec 11  2014 owncloud.db
-rw-r-----  1 www-data www-data 14582785 Jan 21 20:57 owncloud.log
drwxr-xr-x 10 www-data www-data     4096 May  6  2015 sam/
drwxr-xr-x  6 www-data www-data     4096 Nov 23  2014 sarah/
drwxr-xr-x  6 www-data www-data     4096 May  4  2015 tom/
drwxr-xr-x  2 www-data www-data     4096 Sep 20 16:11 updater_backup/
You shouldn't have data or config folders within the data folder on your external HDD. They should be in /var/www:
sam@samhobbs:/etc/spamassassin$ ll /var/www/owncloud/
total 204
drwxr-xr-x 14 www-data www-data  4096 Dec 23 12:14 ./
drwxr-xr-x 10 sam      www-data  4096 Jan 29 21:53 ../
drwxr-xr-x 29 www-data www-data  4096 Dec 23 12:14 3rdparty/
drwxrwxr-x 29 www-data www-data  4096 Nov 18 21:28 apps/
drwxrwx---  2 www-data www-data  4096 Oct 20 17:09 assets/
-rw-r--r--  1 root     root       477 Dec 21 12:46 AUTHORS
drwxrwxr-x  2 www-data www-data  4096 Dec 23 12:14 config/
-rw-r--r--  1 root     root      2532 Dec 21 12:46 console.php
-rw-r--r--  1 root     root     34520 Dec 21 12:46 COPYING-AGPL
drwxr-xr-x 19 www-data www-data  4096 Dec 23 12:14 core/
-rw-r--r--  1 root     root      5418 Dec 21 12:46 cron.php
lrwxrwxrwx  1 www-data www-data    22 Dec 11  2014 data -> /media/backup/owncloud/
-rw-r--r--  1 root     root     23886 Dec 21 12:46 db_structure.xml
-rw-r--r--  1 root     root      2075 Dec 21 12:46 .htaccess
-rw-r--r--  1 root     root       179 Dec 21 12:46 index.html
-rw-r--r--  1 root     root      2026 Dec 21 12:46 index.php
-rw-r--r--  1 root     root      2595 Dec 21 12:46 indie.json
drwxr-xr-x  3 www-data www-data  4096 Dec 23 12:14 l10n/
drwxr-xr-x  6 www-data www-data  4096 Dec 23 12:14 lib/
-rw-r--r--  1 www-data www-data 18796 Aug 11  2015 .mailmap
-rwxr-xr-x  1 root     root       283 Dec 21 12:46 occ*
drwxr-xr-x  2 www-data www-data  4096 Dec 23 12:14 ocs/
drwxr-xr-x  2 www-data www-data  4096 Aug 11  2015 ocs-provider/
-rw-r--r--  1 root     root      2969 Dec 21 12:46 public.php
-rw-r--r--  1 root     root      4521 Dec 21 12:46 remote.php
drwxr-xr-x  3 root     root      4096 Nov  2 22:45 resources/
-rw-r--r--  1 root     root        26 Dec 21 12:46 robots.txt
drwxr-xr-x 13 www-data www-data  4096 Dec 23 12:14 settings/
-rw-r--r--  1 root     root      1817 Dec 21 12:46 status.php
-rw-r--r--  1 www-data www-data    12 Aug 11  2015 .tag
drwxr-xr-x  3 www-data www-data  4096 Dec 23 12:14 themes/
-rw-r--r--  1 www-data www-data   164 Aug 11  2015 .user.ini
-rw-r--r--  1 root     root       233 Dec 21 12:56 version.php
Sam

Hi Sam,

I sort of think I understand...I've followed the following:

Move /var/www/data to /media/owncloud:

sudo mv /var/www/data /media/owncloud/data
Create a symbolic link to the new owncloud directory.

sudo ln -s /media/owncloud/data /var/www/data
Now do the same for the config folder:

sudo mv /var/www/config /media/owncloud/config
sudo ln -s /media/owncloud/config /var/www/config

...but put owncloud after every /var/www/ as per instructions.

I think my files are probably such a mess right now that I'll restart everything again from scratch and try to pay more attention when attempting to move Owncloud's data directory...

Thank you for your patience.

Regards,

Jo

You should just be able to enable the default-ssl configuration file, which will serve the data in /var/www for any domain name you request. I would remove all of the files in the /media/owncloud directory, and the files in /var/www/owncloud, and try again. This time, move the data directory but not the config, and see what happens. Sam

Hi Sam,

Thx for that, but I've started again from scratch to try and have a better understanding about all this...even got a few Linux books...

Regards,

Jo

Hi Sam,

I'm taking things slow and one at a time now...

I'm at the section about changing the virtualhost file 000-default.conf and want to confirm which route is best:

I've read your tutorial: "Multiple Websites and Subdomains with SSL/TLS in Apache2: Virtualhosts" and I see there are virtualhosts for http and https, etc

What advice would you give? Do I create a virtualhost for http or http; or for both; or any other advice before I continue from here?

Please advise.

Many thanks,

Jo

Hi Sam,

Below is my http vhost block:

<VirtualHost *:80>
ServerAdmin webmaster@pi-box.co.uk
ServerName www.pi-box.co.uk:80
ServerAlias pi-box.co.uk

DocumentRoot /var/www

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>

#REMEMBER TO MAKE A DIRECTORY FOR THE SITELOG E.G.PI-BOX
#sudo mkdir /var/log/apache2/pi-box
ErrorLog ${APACHE_LOG_DIR}/pi-box/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/pi-box/access.log combined
</VirtualHost>

I'm still proceeding with caution and just want to confirm something:

In the Document root section I have "DocumentRoot /var/www" at the moment and i understand from your vhost instructions that this is the path to the directory that contain all the site data. (My site being owncloud which is located in /var/www/owncloud and it has all of owncloud's directories and files in there). Do I then change "DocumentRoot /var/www" to "DocumentRoot /var/www/owncloud"? That's how I understand it to be...

My next question which is very similar...Do I then also change "<Directory /var/www/>" to <Directory /var/www/owncloud>?

I didn't move my owncloud directory to /var/www, so my owncloud website will be located at pi-box.co.uk/owncloud

Please advise.

Thanks again.

Jo

If your document root is /var/www and your owncloud data is at /var/www/owncloud then yourdomain.com/owncloud will serve owncloud. If your document root was /var/www/owncloud and your data was at /var/www/owncloud then yourdomain.com would serve owncloud. You need to choose what you want to do, and edit the document root parameter to suit! The directory part applies settings to a specific directory. So if you had your main site in /var/www and owncloud in a subdirectory at /var/www/owncloud, and you wanted the settings to only apply to owncloud, then you would make the directory path /var/www/owncloud. If you wanted the settings to apply to your whole site, you would make it /var/www. Make sense? Sam

Hi Sam,

Now on to moving my owncloud data directory and create symbolic links which I messed up royally last time.

My owncloud site is located at /var/www/owncloud and my external HDD is mounted at /media/owncloudHDD, so my plan is to do the following after I stopped the apache2 service:

I'm in my home directory...

sudo mv /var/www/owncloud/data /media/owncloudHDD/data

then create a symbolic link:

sudo ln -s /media/owncloudHDD /var/www/owncloud/data

Then I will follow the same procedure, but with the config folder...

sudo mv /var/www/owncloud/config /media/owncloudHDD/config

then create a symbolic link:

sudo ln -s /media/owncloudHDD /var/www/owncloud/config

...then:

sudo chown -R www-data:www-data /media/owncloudHHD

...and restart the apache2 service

NOTE:
A possible error in the tutorial...you have the following:

Move /var/www/data to /media/owncloud:

sudo mv /var/www/data /media/owncloud/data

Create a symbolic link to the new owncloud directory.

sudo ln -s /media/owncloud/data /var/www/data

Now do the same for the config folder:

sudo mv /var/www/config /media/owncloud/config
sudo ln -s /media/owncloud/config /var/www/config

Should the 'data' and 'config' part not be omitted in the 'from' section of the symbolic links? So that it reads:

sudo ln -s /media/owncloud /var/www/data
sudo ln -s /media/owncloud /var/www/config

If so, I think that may be where I went wrong the previous time. I compared it to Steve Riley's link you provided and saw the correction on his post (May 08, 2012).

Please advise if this is the case.

Thanks,

Jo

Add new comment

The content of this field is kept private and will not be shown publicly.

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.