Tag Archives: owncloud

When Servers Blow Up – Disk Images Save The Day

We rely heavily on our ownCloud server here on the farm. Be it keeping up with our finances or maintaining health records on ourselves and our animals, we couldn’t live without it!

Friday brought severe weather in Florida, and a power outage that occurred during that storm was very hard on some of our electronics. We lost 3 cameras out in the goat pen, plus a computer monitor, and most importantly, our ownCloud server.

Yes, we have house-wide surge suppression, and yes, everything that got blown up was plugged into a further surge suppressor and UPS! Still, lightning goes where it wants, and on Friday, it chose those items.

Enter today’s tale of recovery. You see, while setting up an ownCloud server from scratch isn’t all that hard, it is very time consuming. Getting the Apache web server running just the way you want it, with SSL properly configured can take hours. But, not when you can work with a disk image!

Once our ownCloud server was up and happy many months ago, we used a Linux utility already installed in most Linux platforms, to do a mirror image disk image of our ownCloud boot disk. That disk image sat on an external USB hard drive, just waiting for the day it was needed.

First thing to do was slap a new computer together from our vast stores of often ancient computer hardware. Next, take the drive you want to use for the new server and plug it into a USB drive adapter. Those are handy devices to have around, and are very inexpensive.

Plug your hard drive via the USB cable into a working computer, and then launch the Disks utility

Click on your Menu button, and select Control Center.

Control Center

Control Center

Then select Disks which will launch today’s useful software tool.

Disks Utility

Disks Utility

Here’s where you need to use caution. Make sure that the drive you have selected is the one you wish to write to, and not your current computer’s hard drive!

Select the drive you wish to write to, select the disk image you wish to put on that disk, and let ‘er rip!

Preparing for the restore

Preparing for the restore

Because the new drive was much larger than the original, you’ll notice the warming in the above screen grab. After the disk was written, I then used GParted to resize the Linux partition to use the entire available disk space.

Of course our ownCloud data directory is on an external drive to our ownCloud server, so once the new drive was written and installed into the new computer, all we had to do was boot it up, plug our data drive in and it’s like it never blew up!

So save yourself some grief, make that disk image of your ownCloud or NAS server now, so you have it when you need it!

 

Tweaking ownCloud – Improving External Website Access

In the older versions of ownCloud we’ve always run, our extra web pages were always just dumped into the ownCloud directory on our server. With ownCloud 9 however, a security feature will fuss at you if there is anything in that directory that ownCloud isn’t expecting! Not a huge problem, but worth fixing.

My normal server configuration had the main www directory as the ownCloud main directory. First thing to do, was go into my Apache Server configuration file and point the server root, to the right place.

Changing www root

Changing www root

You can see the highlighted portion of the Apache server configuration file: /etc/apache2/sites-available/000-default.conf above, where I have changed the server root from /var/www/owncloud to just /var/www

Next you make the same change to your default-ssl.conf file so your self signed ssl certificate is covering all of your web root, not just the ownCloud directory.

Next thing to do, was reconfigure the ownCloud clients running on our desktop computers and phones.

On the desktops, first, close any running instances of the program. Do this from the software, or kill the process from your task manager.

Then, just navigate to your  /home/username/.local/share/data/owncloud/owncloud.cfg file and change to the new ownCloud location as shown below:

ownCloud configuration file

ownCloud configuration file

After you update the file, all you need to do is restart ownCloud. It will ask you once again for your user password, and you’re done!

On the phones, just navigate to the ownCloud application, delete the current server, and add in the new one. Everything will sync back up happy as can be!

Once all of that was done, I could then add my new web pages, into separate folders like you would on any web server. In our case, the new folder, called manuals, is a large collection of all of the .pdf manuals for everything we own that requires one. From our tractor, to my metal bender and everything in between!

New web pages

New web pages

In the above screen shot, you will notice an index.html file. This is just a quick java redirect directly to the ownCloud directory, in case anyone just enters the IP address to the server, but forgets the fully qualified path to ownCloud.

Using the ownCloud external web page setting, we can now have quick and easy access to instruction manuals, from any computer or phone on the farm.

Manuals web page

Manuals web page

Now, no more errors in the ownCloud administrator console, and happy family who can find what they want, when they need it!

 

Tweaking ownCloud’s Calendar

New goats are settling in, so let’s get back to some Linux fun!

We love ownCloud here on the farm, and have written several blog entries about it. One thing about this wonderful software that has always made me crazy, was that the calendar application used a colour to highlight the current day, that we just couldn’t see!

ownCloud Calendar

ownCloud Calendar

When my FLux software would cut in, the barely visible colour would not be visible.

Of course like any software, you can tweak it to your liking in just a few steps!

First open your file browser as an administrator and head to your /var/www/owncloud/apps/calendar/js directory and then open the Calendar.js file with your favorite text editor.

Caja as Superuser

Caja as Superuser

Then do a quick search for the current colour, in this case #FFC and change it to whatever you like! In the example below, I changed it to #f4e71d

Revised background colour

Revised background colour

Of course, it’s possible that if ownCloud does an update of that file, you will lose your fix, but it’s simple to change again!

I should note that really, the proper place to fix this problem is in the themes, changing the colour in the style sheet. I’d done that without success, which is why I went ahead and changed it in the javascript file instead…

 

Expand Your OwnCloud Server Usefulness

The Following instructions are no longer valid in ownCloud 9+

We love our ownCloud server here on the farm. As we’ve discussed before, it keeps the farm and family well organized and secure.

With ownCloud running on a LAMP stack, let’s take advantage of that server by adding other useful goodies to it!

The root of your www server directory will contain a directory called owncloud, and there is nothing to keep you from adding other handy web-type resources to it. Here on the farm, we  use our server to also store all of our equipment manuals that we may need to view quickly.

In today’s example, I have a rather extensive web page I built up years ago for my antique Wheel Horse tractor. The page contains dozens of charts, manual sheets, parts lists etcetera. Having all that information available anywhere on my network is really handy!

As seen in this example, my www root has an OwnCloud directory, and the index.html file just does a quick redirect to the ownCloud instance. I do it this way so I can easily add new resources, like the tractor directory as shown.

Root www directory

Root www directory

Once you have your new web resource uploaded to your server, you will then go to the ownCloud Admin panel to add the external link to your ownCloud software. Note that you need to link using a secure connection, so don’t forget the https://

OwnCloud Configuration

OwnCloud Configuration

Once you’ve told ownCloud about your new page, you will find that page in the ownCloud main menu! In this example, Tractor.

New Menu Item Called Tractor

New Menu Item Called Tractor

Clicking on my new Tractor menu item, takes me to an embedded page of my tractor information, with the ownCloud menu still handy at the top, so you can check your calendar or start making your parts list for repairs.

Tractor manuals, I've collected for my old Wheel Horse.

Tractor manuals, I’ve collected for my old Wheel Horse.

I’ve got separate web pages on my ownCloud install for most of the equipment I’ve collected manuals for. All equipment manuals we get are scanned, saved as a PDF and then stored as web pages on our ownCloud server.

ownCloud and LAMP, what can’t it do!

 

Software: Updating ownCloud

Program Note: Always read the release notes when upgrading ownCloud or any other major software package!

I use a very old, AMD, single processor, only 1 gig of RAM, machine for my ownCloud installation. I use it, because that’s what was laying around the farm unused, when I decided that ownCloud was a system I really wanted to have!

I was delighted to find my ownCloud software showing me that the update was available:

Updating ownCloud

Updating ownCloud

The system has worked very well, and when ownCloud 8 came out, of course I wanted to upgrade!  Upgrading was not without a hiccup or two, but they were all pretty easy to fix.

First thing to do of course,  is make a backup of your server! I use an external hard drive for this purpose.

My ownCloud server is running Linux Mint 13, which is based on Ubuntu 12.04. Not a problem in itself, but it meant that the repository for 12.04 didn’t have the latest PHP engine available. I was running php5.3, but ownCloud 8 requires php5.4 or later. Of course I found this out AFTER I started the upgrade. *(I did skim the upgrade notes, but not well enough!)  when I was treated to the following web page after I did the ownCloud update via the built-in update manager:

First screen after updating ownCloud

First screen after updating ownCloud

Updating to php5.5 was pretty simple however, it was just a matter of adding the correct repository to my Software Sources, and then doing the update. In my case, I added the following repository:

http://ppa.launchpad.net/ondrej/php5/ubuntu

Then did a sudo apt-get update  – followed by sudo apt-get upgrade

at which point I now had php5.5 installed on my machine.

Next it’s important to restart your web server. Do this on most Mint systems by this command:  sudo service apache2 restart

After restarting my server, ownCloud finished doing the automatic update, and then went right to a blank window. Yes folks, I had forgotten to disable my 3rd party applications!  I knew I should have done it before I started the update, but I just plum forgot.

Not a huge problem though, just open a Terminal window inside your ./var/www/owncloud/ directory, and use the ownCloud occ tool to turn off your applications manually. In my case, it was the Calendar and Contacts applications that were causing the problem.

You need to run the commands as the www-data user, hence in the examples below, I am using the -u www-data switch when running the occ php application as in these examples:

sudo -u www-data php occ app:disable calendar

sudo -u www-data php occ app:disable contacts

…and any other 3rd party application that is preventing ownCloud from running.

A quick visit to the ownCloud application page, found the ownCloud 8 versions of Calendar and Contacts for download. Then all you need to do is expand the archives and dump them right on top of the old files in the www/apps/ directory on your ownCloud server.

Restarting my server once again, found ownCloud working smoothly and happy, just as it was before I started the upgrade process.

The only other small thing I had to take care of, was that ownCloud was reporting that my php software wasn’t using the character set that is preferred. Heading over to the php.ini file, that is found in your etc/php5/apache2/ directory, it was a simple matter to uncomment the setting, as shown:

Changing the default character set for php

Changing the default character set for php

Lessons learned:

1. Always carefully read the release notes!

2. Make sure your current server meets the minimum requirements. Usually related to php and mysql versions.

3. Download any updated 3rd party applications ahead of time so you have them ready.

Even with a few hiccups, it still only took about 30 minutes to get everything happy and running again.