Install ownCloud 7 on Raspberry Pi (Arch Linux) using Lighttpd

Raspberry Pi logo

ownCloud 7 was out on July 23rd 2014. I spent couple of days to test it and then blog about it. You already saw my previous posting about installing ownCloud on Arch Linux Rasbperry Pi. I'll use the same base and I'll correct/add some more info. So this post might be long but analytic with lot of pictures!!!

Here we'll see the basic installation. My next posts will be about securing the ownCloud instance. For my project, I used a Raspberry Pi (Model B), a 8GB SD card. It's connected with ethernet and the power plugs on my router (there's a USB that can be used as SAMBA server or Print Server).

ownCloud Raspberry Pi box

I used Arch Linux as distro, because I wanted to have the latest packages.

This tutorial has 3 sections:

Before we start, download Arch Linux image for Raspberry Pi. Create the SD card (dd if=Arch.....img of=/dev/sdX bs=1M;sync).

1. Now boot your Raspberry pi and update everything:

pacman -Syu

2. Mount the extra partition you made. How to do that?

Find the name of the partition

cat /proc/partitions

Usually it'll be mmcblk0p3. You won't see it there. So create it. How?

cfdisk /dev/mmcblk0

and go to the free space and create the partition (it's easy to do it with the arrows). Reboot.

Format the partition to ext4
mkfs.ext4 /dev/mmcblk0p3

Change the permissions
chmod -R 770 /dev/mmcblk0p3

Create the mount point
mkdir /mnt/sd

Add the extra space to fstab
nano /etc/fstab

# and add the following line
/dev/mmcblk0p3 /mnt/sd ext4 defaults 1 0

Now reboot your Raspberry Pi.

3. Install all needed programs (Sqlite, Lighttpd etc)

pacman -S lighttpd fcgi php-cgi php-sqlite openssl

4. Change Lighttpd properties:

nano /etc/lighttpd/lighttpd.conf

and change it to the following:

server.port = 80
server.username = "http"
server.groupname = "http"
server.document-root = "/srv/http"
server.errorlog = "/var/log/lighttpd/error.log"
dir-listing.activate = "enable"
index-file.names = ( "index.html","index.php")
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".svg" => "image/svg+xml",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".cpp" => "text/plain",
".log" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".spec" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
".odt" => "application/vnd.oasis.opendocument.text",
".ods" => "application/vnd.oasis.opendocument.spreadsheet",
".odp" => "application/vnd.oasis.opendocument.presentation",
".odg" => "application/",
".odc" => "application/vnd.oasis.opendocument.chart",
".odf" => "application/vnd.oasis.opendocument.formula",
".odi" => "application/vnd.oasis.opendocument.image",
".odm" => "application/vnd.oasis.opendocument.text-master",
".ott" => "application/vnd.oasis.opendocument.text-template",
".ots" => "application/vnd.oasis.opendocument.spreadsheet-template",
".otp" => "application/vnd.oasis.opendocument.presentation-template",
".otg" => "application/",
".otc" => "application/vnd.oasis.opendocument.chart-template",
".otf" => "application/vnd.oasis.opendocument.formula-template",
".oti" => "application/vnd.oasis.opendocument.image-template",
".oth" => "application/vnd.oasis.opendocument.text-web",

# make the default mime type application/octet-stream.
"" => "application/octet-stream",

server.modules = (

fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket"

# OWNCLOUD # Disable access to data folder
$HTTP["url"] =~ "^/owncloud/data/" {
url.access-deny = ("")

# OWNCLOUD # Disable directory listing
$HTTP["url"] =~ "^/owncloud($|/)" {
dir-listing.activate = "disable"

I usually copy the file to another file, then delete it and create it from scratch.

cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.old

rm /etc/lighttpd/lighttpd.conf

# and then

nano /etc/lighttpd/lighttpd.conf

Now run the server:

systemctl start lighttpd.service
systemctl enable lighttpd.service

You can check if it works, if you point your browser to the raspberry ip.

5. Now you should make some changes to PHP.

nano /etc/php/php.ini

and find-change the following:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/mnt/sd
default_charset = "UTF-8"
cgi.fix_pathinfo = 1

sqlite3.extension_dir = /usr/lib/php/modules/

Restart your lighttpd service.

systemctl restart lighttpd.service

6. Now you can download ownCloud. Go to Download page and choose tar or zip.

A cool tip is to go to server folder (cd /srv/http) and write

the extract the file

tar -xjf owncloud-7.0.0.tar.bz2

Then you should change the permissions:

chown http:http owncloud
chown http:http owncloud/config

Create a directory to store data. It's safer to have your data outside your server directory.

mkdir /mnt/sd/data

Change the permissions

chown -R http:http /mnt/sd/data
chmod -R 770 /mnt/sd/data

Check the documentation for some extra settings, just in case you use other servers etc.

7. Now open your browser to http://IP/owncloud. If everything is OK, you'll be prompted to enter your NEW admin user and password and the location of the data folder (message in red tells you to change the path). Remember I created the folder before. The location is /mnt/sd/data.

If there's something wrong, there'll be a message like the following:

ownCloud Error

Usually there are some PHP modules missing (pacman -S php-gd).

Since locale wasn't set by default, I followed the Arch Linux tutorial how to do it (3 commands).

echo -e "en_US.UTF-8 UTF-8\nel_GR.UTF-8 UTF-8" >> /etc/locale.gen

echo -e "LANG=en_US.UTF-8\nLC_MESSAGES=C"\nLC_TIME="el_GR.UTF-8" >> /etc/locale.conf


Refresh and here what you'll see.
prompt to setup

Here you should point the data folder. Remember that we already created the disk space.

Change Data Folder

Remember that we have the disk space on the other partition.

Change Data Folder

If you didn't change the permissions, you'll see the message to do that.

770 permission of data folder

Now everything is ready...

Finally set up!!!

8. You can change the php.ini file (nano /etc/php/php.ini) with the following information:

post_max_size = 50G
upload_max_filesize = 25G
max_file_uploads = 200
max_input_time = 3600
max_execution_time = 3600
session.gc_maxlifetime = 3600
memory_limit = 512M

9. If you want to change the security, you can follow some tutorials from the documentation how to do them.
Finally, you should port forward and dynamic dns (you should edit the file /config/config.cfg), so you can have access from out your house. I'll write some posts about all those later.

10. Now you're finished to enter.

ownCloud username/password

The first thing you'll see is the welcome screen.

Welcome Screen

Here you can see the Version (and also some errors I get)...

Server Errors

Now you're ready to use ownCloud

User Interface

Δεν υπάρχουν σχόλια

Από το Blogger.