My first owncloud page showed how to install your own cloud server on a web host. This blog will show you how to install it on a Raspberry Pi computer. And I’ll be installing this from a Mac computer. I prefer to do all this connected directly to my router via ethernet. You can add wireless later however it’s probably always better to run a cloud server wired to your router. Much much faster when uploading huge files.

First you’ll need the latest version of Raspian either through NOOBS or just the Raspian zip file. It’s all here. Make sure and unpack the zip file to get to the img file.

On the Mac to install Raspian you need to open disk utility and insert an SD card. I use an 8 GB card. Format the card for MSDOS-FAT. Name the partition. Default name is UNTITLED however I changed the name to OWNCLOUD. Once formatted unmount the card in the toolbar in Mac’s Disk utility.

No open a Terminal in Mac and type:

diskutil list

This will tell you location of your card. In my case it is /dev/disk1

Then type:

sudo dd if=/path_to_the_zip_file.img of=/dev/rdisk1 bs=1m

Here’s my example:

sudo dd if=/Users/hagensieker/Archive/RaspberryPi/images/2013-12-20-wheezy-raspbian.img of=/dev/rdisk1 bs=1m
(note that I’ve used /dev/rdisk1 Adding the r makes it go faster.

Hit enter then it may ask for your (mac) password and then seemingly nothing will happen. Give it ten minutes or so and it will write the image to your SD card.

Now eject the SD card from the Mac and install it in your Raspberry Pi and boot.

You can hook your Raspberry Pi to a TV via HDMI if you’d like or you can ssh into your Pi and run it without a keyboard, mouse, and monitor. I prefer this. However if you’ve no clue how to do this, hook up your pi to those three things and boot away.

When you get to the login prompt the user name is pi and the password is raspberry.

No do this:

sudo raspi-config

This takes you to a graphical interface. Expand the filesystem and this lets you use the full amount of the SD card. Now change the password. Then go to Advanced and go to Memory Split. Default value is 64. If you are running your Pi with no monitor change this to 16. The Pi uses shared memory and use all you can for your server. If you have a monitor you probably need 32 or 64.

Finally go to Advanced and Update. Let it run a while. Reboot.

Now it is time to begin:

Once you get back to your login prompt login and run the following commands: This installs apache web server and php5. This will take a bit

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

Now it’s time to get Owncloud:

Go to this
page and copy the link of the version you want to download then:

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

Once it is downloaded unpack the tar file.

tar -xjf owncloud-6.0.0a.tar.bz2

Now copy it to your apache web server directory.

cp -r owncloud /var/www/

Now give ownership of owncloud to the web server.

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


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

Change AllowOverride None to AllowOverride All in the Directory /var/www/ section of the file.
Now run the following three commands
cd /var/www/owncloud
sudo touch .htaccess
sudo chown www-data:www-data .htaccess

Now three more to configure the server.
sudo a2enmod rewrite
sudo a2enmod headers
sudo service apache2 restart

Now go to your server address. In my case it was
Once there create an account and see if it logs in. It will.
Now lets make it secure with an SSL certificate
sudo a2enmod ssl
sudo service apache2 restart
sudo mkdir /etc/apache2/ssl

Now request a certificate to install. Now open the config file
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Follow the prompts and answer these questions:

Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:California
Locality Name (eg, city) []:Los Angeles
Organization Name (eg, company) [Internet Widgits Pty Ltd]:raspberrypi
Organizational Unit Name (eg, section) []:home
Common Name (e.g. server FQDN or YOUR name) []:yerwebsite.com
Email Address []:webmaster@yerwebsite.com

Now open the config file.
nano /etc/apache2/sites-available/default-ssl

Change Allow override from None to All in both /var/www entries. Change your ServerAdmin email to your email address then add this line under it.
ServerName yerwebsite.com:443
Then find these entries and change them to this:
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

Save the file and then run these commands.
sudo a2ensite default-ssl
sudo service apache2 reload

You should be up and running with 256 bit encryption!
Now you are going to want to take your static address and resolve it to a DNS name. Follow the easy directions on this
page. Or any one of a hundred other pages that guide you to use different DSN resolution services.
Note if you get an error about WebDAV failure do this:
Open the file $OWNCLOUD_DIR/3rdparty/Sabre/DAV/Client.php

cd /var/www/owncloud/3rdparty/Sabre/DAV
sudo nano Client.php

Scroll way down until you see the CURLOPTIONS

Add the following two elements to the array:


Save the file and exit the editor

Restart your web server

sudo service apache2 restart

If you wish to increase your storage size of your Raspberry Pi by adding external storage follow these steps. I added a 1 TB external drive to mine.
Format your drive with ext4
Make a directory to mount.
sudo mkdir /media/owncloud

Plug in your drive then do this:
sudo blkid

Should get a return like this:

/dev/sda5: LABEL="Data" UUID="f052e620-9e88-4b19-9b9a-d6dce4d6603b" TYPE="ext4"
Now make an entry to mount the drive on boot:
sudo nano /etc/fstab
Add this entry. Make sure you copy YOUR UUID number and not use this one. Also note that if you used any other file system such as ext3 change it here.
UUID="96f64567-c459-4d3d-9f52-e6aabee544d2"     /media/owncloud         ext4    defaults    0       2

Now reboot and check it mounted:
cd /media/owncloud
Should see a file that says lost+found or something like that. It worked.
Now move your owncloud data and config files over to the hard drive. Stop apache server.
sudo service apache2 stop
Now move the data folder.
sudo mv /var/www/owncloud/data /media/owncloud/

Make a symbolic link back to the folder.

sudo ln -s /media/owncloud/data /var/www/owncloud/data
Repeat for the config folder.
sudo mv /var/www/ownclou/config /media/owncloud/

sudo ln -s /media/owncloud/config /var/www/owncloud/config
Now give ownership.
sudo chown -R www-data:www-data /media/owncloud

Restart apache.
sudo service apache2 start

Yer doing it.
You should be set. If you get any errors please feel free to email me.
To upgrade after releases do this.
copied my data and config files just in case

cp -a /var/www/owncloud/data /home/pi
cp -a /var/www/owncloud/config /home/pi

Next i did
cd /home/pi (my home directory)
wget http://download.owncloud.org/community/ ... st.tar.bz2
tar -xjf owncloud-latest.tar.bz2
cd /var/www/owncloud
ls | grep -v 'data\|config' | xargs rm -r (this removes everything but data and config and is from OC manual)

Now copy owncloud back over

cp -a /home/pi/owncloud /var/www (it will bark at you about not overwriting the config directory. This is good)

Now clean up if you want

rm -r /home/pi/owncloud
rm -r /home/pi/owncloud-latest.tar.bz2