OwnCloud is a great dropbox/ubuntuOne/GoogleDrive alternative. Gives you the power to run your own server without having to worry about others controlling your data. I also think the features of owncloud are better than most of the other services. This article will explain how to install ownCloud on a Ubuntu 12.04 LTS server.
As of the date of writing this OwnCloud didn't offer good documentation for an install on Ubuntu 12.04. This is a in-depth explination of how to get OwnCloud running on Ubuntu 12.04 using mysql and not sqlite (although we will still sqlite if you want to use that instead).
OwnCloud has a few requirements. Run the following commands to setup prerequsits. Note that apt-get has different requirements that stated on OwnClouds Documentation. Also you could install OwnCloud using apt-get install -y owncloud but that would currently get you the 3.0 version not the 4 or 4.5 version.
sudo su apt-get install -y lamp-server^ apt-get install -y apache2 php5 php5-gd php-xml-parser php5-sqlite libcurl3-dev php5-curl libsqlite0 unzip sqlite-doc libsqlite0 mp3info sqlite unzip zip
Now I like to set my apache server's fully qualified domain name.
vi /etc/apache2/httpd.conf ServerName ownCloud :x service apache2 restart
OwnCloud recommends you use the .htaccess file to change the PHP upload_max_filesize, but I prefer to set it globally (as I usually run atrium, gallery3 or other apps on the same server).
sudo vi /etc/php5/apache2/php.ini #Change the following line to something like: upload_max_filesize = 200M :x service apache2 restart
Even though I don't use htaccess for the max filesize we should still enable the use of htaccess.
a2enmod headers rewrite service apache2 restart
Setup MySQL Database
I want to use MySQL for the install instead of sqlite, so I'll setup a database and user now.
mysql -u root -p CREATE DATABASE owncloud; GRANT ALL PRIVILEGES ON owncloud.* to 'uowncloud'@'localhost' IDENTIFIED BY 'owncloudpass'; quit
Please change owncloudpass to your own unique password, you may also change the user to whatever you want.
Now that we have all the requirements in place, I'm going to set things up a little differently than OwnClouds default setup. I'm going give owncloud a home outside my /var/www so that I can store the code in git and have the files non publicly accessable.
mkdir /owncloud cd /owncloud mkdir files sql scripts touch README.txt wget http://owncloud.org/releases/owncloud-latest.tar.bz2 tar -xjf /owncloud/owncloud-latest.tar.bz2 mv owncloud public rm owncloud-latest.tar.bz2 chown -R www-data:www-data public/ chown -R www-data:www-data files/
This is where I usually git init, but not everyone uses git so you can figure that out yourself.
We are also going to be running owncloud from a domain and not an IP so we have some further Apache configuration to do. Setup a new apache virtual host.
cd /etc/apache2/sites-avaiable vi owncloud
Place the following in the file and change the $domain to your domain
<VirtualHost *:80> ServerName $domain DocumentRoot /owncloud/public/ ServerAdmin [email protected]$domain <Directory /owncloud/public/ > Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error_$domain.log </VirtualHost>
Save and close, then enable the site. If you have your DNS pointing to your server you can now visit your $domain (in my case cloud.nickyeoman.com). If you don't have DNS setup you can set your /etc/hosts file and continue with the installation.
a2ensite owncloud serivce apache2 restart
Now open your browser to your owncloud install and run the setup, where you will create an admin account, choose your data folder and setup your database. I set the data folder to /owncloud/files even though the htaccess should suffice for apache. (I'm keeping public in git for easy updates too).
That's it your all ready to go.