All HowTo's Web Servers

Roll your own Dropbox, Installing Owncloud

I love the idea of my files being at my finger tips when I need them no matter where I am… I hate the idea of other people having my files at their finger tips when ever they want them. Good thing there is Owncloud, Owncloud is written in php and if you want you can dig down and check out the core functions as well as make new functionality of your own, this also allows you to see exactly what is happening with your data and see how secure or insecure it is.

This article is going to show you how to do a basic install of Owncloud on Gentoo, this is a simple installation and there are so many security and performance tweaks that can be made that I am going to cover them in another article later. Lets get started..

The first thing that we have to do is get a working Apache and PHP installation.

Install Apache:

emerge --ask -jv www-servers/apache ; rc-update add apache2 default

If Apache is running then make sure you stop it

/etc/init.d/apache2 stop

Add Apache to the global USE flags in /etc/portage/make.conf

vi /etc/portage/make.conf
#Edit the USE= line to match below, keeping in your other use flags that are already set such as -doc
USE="-doc apache2"

Change the default for the /etc/conf.d/apache2 config file as below

vi /etc/conf.d/apache2
#Replace: 
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE"
#With: 
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"

Now we can install PHP because it will pick up the global Apache USE flag in the make.conf

emerge --ask -jv dev-lang/php

Once it has finished installing you will need to setup your Apache2 module file.

vi /etc/apache2/modules.d/70_mod_php5.conf

Your file should match the below screenshot, Sorry about the screen shots for the commands involving PHP, our blog does not want to play nice.
ApacheModule

You can create a PHP test file using the below command, if PHP is working then it should print This is a test to the screen when viewed from a web browser
PHP_TestFile

Be sure to start up Apache and then give it a try

/etc/init.d/apache2 start

Now that we have got a working Apache2 and PHP5 setup we can continue on and setup Owncloud. For this example we are using version 8.1.0 but the steps should be almost identical no matter which version you use, you might just have to swap out the PHP version for a newer one.

First we need to make a change to the package.use file

echo '>=dev-lang/php-5.6.12 sqlite zip xmlwriter pdo gd curl' >> /etc/portage/package.use

Now we should be able to emerge Owncloud

emerge --ask -jv www-apps/owncloud

This will do a rebuild of PHP due to that package.use change we made and then it will start on installing Owncloud. Assuming that all went smoothly you should now be able to restart apache2 and then test your installation.

/etc/init.d/apache2 restart

If you have Firefox installed you can run the following to test your install, if not then you will have to do it from another machine.

firefox http://localhost/owncloud

Now you can just set a username and password for the admin user and that is it you now have your own cloud!

You will see a warning about sqlite being the database and warning of possible performance issues. If we wanted to we could include mysql as the backend for the system and if you were deploying this in a business or a heavy usage situation then you would want to however, for a home cloud or just some simple testing then sqlite will be fine. You can always decide to change later on, it is as simple as backing up your owncloud data directory, adding a use flag and then running an emerge. Perhaps another article on that later.

Leave a Reply

Your email address will not be published. Required fields are marked *