(This is part of My ownCloud Adventure)
For any adventure to come to a successful conclusion, the proper preparations must first be made.
With my previous experience working with the Raspberry Pi I was able to quickly get a dedicated server setup and connected to my Synology NAS via NFS.
I should mention here, to plant a seed of thought, that throughout my endeavors the security posture of my system has been a constant consideration. As an example, with my NFS configuration there are mounts available on my network that I did not give my ownCloud host access to… I am just not comfortable with some files being remotely accessible.
While not exhaustive, there are some common tasks that should probably be performed when setting up a new Raspbian instance:
SD Card Images
Throughout my adventure I made extensive use of Win32 Disk Imager to create images of the SD card. This allowed me to configure common features once and just reload an image to start over if needed.
For example, I have an image that I created after performing my basic Raspbian updates and configurations. After that I have an image with SSL certs and MySQL already taken completed. This definitely made it much easier to go from Apache2, to lighttpd and finally end up at nginx with a “clean” system.
To allow any of the webservers to utilize HTTPS, generating SSL certificates is the first task. There are MANY resources available out there, but here are the basic commands I performed.
- cd /etc/sll
- sudo mkdir localcerts
- sudo openssl req -newkey rsa:2048 -x509 -days 365 -nodes -out /etc/ssl/localcerts/myServer.fqdn.pem -keyout /etc/ssl/localcerts/myServer.fqdn.key
- sudo chmod 600 localcerts/meister*
These commands result in 2 files as output: a PEM certificate & a key. Both are used by any webserver to enable HTTPS.
You will be asked a number of questions during key generation. Since this results in a self-signed key, answer them however you like. Except for the FQDN question, I’m not sure any of them even technically matter. And in the case of the FQDN question, I didn’t care if its value matched my dynamic DNS name or not.
The one important technical detail is that if you do not want to enter a password every time your webserver starts, then do not enter a password when prompted.
ownCloud supports multiple database backends, but I chose MySQL since its familiar to me (although I do wish MariaDB were available in the Raspbian repository).
- sudo aptitude
- Install MySQL server
- The install will ask for a ‘root’ password for your new database server
- A script that performs a number of standard bets practice configurations. Be sure to follow its recommendations!
- mysql -u root -p
- No need to put your password in as an option, you will be prompted
- At the “mysql>” prompt
- create database myOcDbase;
- create user ‘myOcUser’@’localhost’ identified by ‘myUserPass’;
- create user ‘myOcUser’@’127.0.0.1’ identified by ‘myuserPass’;
- grant all privileges on myOcDbase.* to ‘myOcUser’@’localhost’;
- grant all privileges on myOcDbase.* to ‘myOcUser’@’127.0.0.1’;
Good Resource: http://dev.mysql.com/doc/refman/5.5/en/index.html
Getting a hold of ownCloud is not difficult and can be accomplished via various means.
I originally dabbled with manually adding an ownCloud repository to my system’s repo list. I just followed the instructions found for Debian off ownCloud’s Linux packages install link.
- cd /etc/apt/sources.list.d
- sudo nano owncloud.list
- Enter: “deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/ /”
- save and exit
- wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key
- apt-key add – < Release.key
- sudo apt-get update
- sudo apt-get install owncloud
While this method did work and is not a bad way to go, especially considering its many advantages… I was unsure of how quickly the repository would be updated with new versions, so I instead elected to go with the manual install.
- wget http://download.owncloud.org/community/owncloud-5.0.10.tar.bz2
- As versions change, this link will change. So be sure to get the latest Tar link.
- tar -xjvf owncloud-5.0.10.tar.bz2
- mv owncloud owncloud_5.0.10
- cp -r owncloud_5.0.10 /var/www
- cd /var/www
- sudo chmod -R www-data:www-data owncloud_5.0.10
- sudo ln -s owncloud_5.0.10 owncloud
- Using a symbolic link in this fashion can help in the future with manual updates. Just follow ownCloud’s manual update instructions and pre-position the latest version’s directory under /var/www and re-do the symlink for a quick and easy upgrade
And that seems to wrap up the common activities across each of the volumes in my adventure.