Phasing out OwnCloud and the Triumphant Arrival of BTSync

I posted over a year ago about installing and using Owncloud, a Dropbox type personal file-sync system complete with encryption.  It does, however, take a good deal of installation and specialized configuration.  And with every step of complexity causes more opportunities to mess something up royal and to bang my head against the wall in horrified disgust over my own incompetent button mashing.

Because of this, I almost immediately started searching for a new solution, and who should arrive but the glorious and golden haired savior of my file-syncing needs, BTSync.

All I required was three things when it came to file syncing:

  1. Unlimited space
  2. Completely free
  3. Encrypted transmissions

BTSync does all this.  All of it, I say!

Unlimited?  Well I suppose that is up to interpretation, as I suppose each synced folder is limited to the filesystem on which it is being synced.  But for my purposes, completely unlimited.  As it takes no cloud storage system, and no cloud computing service to store the data (although there are proxies that at times act as middle men for transmissions) it means that the only machines that house that data are the machines that I authorize by use of the encryption “secret” key.   Keeping it secret.  Keeping it safe.

My own.

My precious.

Free?  They haven’t, and don’t plan to ever have a plan to charge.  So, in your face, Dropbox/Anybody Else.

Encrypted transmissions?  Although it uses BitTorrent transmission protocol, it is encrypted with up to a 40 byte encryption key.  I use 20 bytes, because I’m not greedy, and if the NSA really wants to crack that encryption, I don’t want to waste government funds!  Check out my PDFs, George HW Bush!  You won’t believe what kind of order forms I’ve been creating! (I’m pretending I’m in 80’s cold war America)

All in all, BTSync is the greatest.  Thank you, noble Torrent technology, for making my life amazing once again.  I salute you and your worldwide distributive ways.

WordPress Pretty Links

I had a heck of a time getting this to work, and this is just as much for my notes as it is for the wider web world’s usage.

To use the pretty links of WordPress, I had to enable mod_rewrite in Apache.  Which was actually already enabled with my default installation.

I was using virtual hosts in the /etc/httpd/conf.d directory, so I made sure that the <Directory> configuration included these lines:

AllowOverride All
Order allow,deny
Allow from all

Also I made sure that that virtual host itself had these options set:

Options Includes MultiViews -Indexes FollowSymLinks SymLinksIfOwnerMatch

But to my deepest chagrin, it still wasn’t working.  After laying my head down on my desk and allowing the tears to flow like a mountain spring, I girded up my loins and looked again.

In Apache’s main config file, /etc/httpd/conf/httpd.conf  I found an AllowOverride  None line!  NO!  I was beat by my own laziness and ignorance again.  I commented out that line, and pretty links suddenly worked.

Learn from my mistakes, Future Dewey/World at Large.  Don’t let it fool you again.

MySql Backups

Dolphins love data managers!  It is known.
Dolphins love data managers! It is known.

MySQL is a fantastic open source database management system that manages data for a huge number of incredibly popular websites.  Twitter, Google, Facebook and YouTube all use MySQL to store and recall data, and thanks to the amazing movement of open source so can we!

Personally, I use MySQL for storage of a number of things; several time-clock programs, this WordPress blog, and my Cthulhu Character Creator to name a few.  However, the problem I’ve come up against was that all this data was stored in one location.  If the storage hardware or the operating system of the device storing it failed in some manner, I could lose it forever.

Unacceptable! Continue reading “MySql Backups”

Apache Setup

His Website Will Outfrown Yours

Apache is remarkably easy to get running.  It is all governed by the service daemon “httpd” and can be installed easily with a yum or apt-get install command if it didn’t come packaged with your distribution.  Any repository that was preinstalled should have it easily available.  The yum command in CentOS would be:

yum install httpd

The configuration file is easy to edit with the command:

vim /etc/httpd/conf/httpd.conf

Almost everything you could need for a simple webserver is already set up for you, and already configured.  The two simplest edits you can change would be the port(s) Apache listens on and the DocumentRoot setting that tells the service what local directory on the server itself will act as the root directory for web pages.

You can change it from listening from port 80 to any other valid TCP port by finding the line that says “Listen 80″  and changing it to “Listen <xxx>” where <xxx> would just be whatever port you want to try.  If you wanted port 3005 you would change the line to say, “Listen 3005″ and save the file.
Just as a side note for alternate ports, the assumed port for http url browsing is port 80.  It’s implied in all standard browsers that when you access a url or an ip of a webserver that it is to be done over port 80, unless directly told otherwise.  The method for accessing a url or ip over a specific port is to enter the url/ip like so http://<ip_or_url>:<port>

For example, accessing your loopback ip over port 3005 would work as such in a browser:

http://127.0.0.1:3005

This will access your DocumentRoot folder on the webserver, and will normally allow you to access any file inside that directory that the Apache service has access to.  The browser used to access the file will in large measure determine how that file is accessed.

DocumentRoot configuration is just as simple.  The default directory for CentOS is /var/www/html but you may want to change that for whatever reason.  It’s easy to change that by doing the same vim command as above and changing the line that starts with DocumentRoot “/var/www/html” to use whatever directory you prefer that Apache has access to.

For example, if you wanted Apache to access /home/myuser/webfiles you would change the line to look like so:

DocumentRoot “/home/myuser/webfiles”

Any time you make a change to the http.conf file and you want to see its effects, you’ll need to restart the httpd service like so:

service httpd restart

Once the service is restarted, you should see any changes immediately when you access it from a browser.

Owncloud Part 2

After some research it became pretty clear that getting SSL to work with a private key would be simple.  You must make sure that openssl is installed, and yum installing it should do everything required to get that working.
# Generate private key
openssl genrsa -out ca.key 1024

# Generate CSR
openssl req -new -key ca.key -out ca.csr

# Generate Self Signed Key
openssl x509 -req -days 999 -in ca.csr -signkey ca.key -out ca.crt

# Copy the files to the correct locations
cp ca.crt /etc/pki/tls/certs
cp ca.key /etc/pki/tls/private/ca.key
cp ca.csr /etc/pki/tls/private/ca.csr
Then you have to tell Apache to use the new keys by editting the ssl.conf file.
vi +/SSLCertificateFile /etc/httpd/conf.d/ssl.conf

Add in lines:
SSLCertificateFile /etc/pki/tls/certs/ca.cr
SSLCertificateKeyFile /etc/pki/tls/private/ca.key

Once the correct SSL Certificates were installed, and the Apache service was restarted, the SSL kicked in.  Using a browser to access OwnCloud over https just started working.  All you have to do is accept the untrusted certificate when accessing the page. Once you tell your client to accept using that key, all functionality of the site will now operate the same, but will now use https, including downloading files through encrypted means.

The trouble, however, is that it is a private key, and therefore is automatically not trusted.  In order for any windows OwnCloud client to work, it has to be a trusted certificate.

The easiest way to trust a certificate in windows is to open Internet Explorer to the https url and click on the “Continue to webpage” option.  Once it’s using that certificate, it will say something along the lines of “Certificate Error” in the URL line.  Click on that, and it should allow you to “View Certificates” from which you can install the certificate and place it into a specific “store” called something along the lines of “Trusted Root Certificate Authorities” which will basically allow any kind of SSL communication using that certificate.
Once that’s installed on the windows client as a trusted certificate, the windows OwnCloud client was able to sync with the https URL.

Owncloud Part 1

OwnCloud is a DropBox-type file-sync system that is open source and free for use.
Implementing OwnCloud was troublesome for me at first, as it had moments where it was easy as pie, and moments where I lost the will to continue living in a world where I couldn’t control my own Linux machine.
The initial setup was fairly simple.  Getting the OwnCloud tar package and dropping it into the Apache DocumentRoot was simple enough.  Then I had to give Apache permissions for it with the ‘chown -r apache: /apache/document/root/owncloud’ command.
The PHP pages guide you the rest of the way, and with the newest version of OwnCloud handles everything with SQLite instead of giving you any options, which actually makes things easier
The problem came with me trying to fiddle with settings of OwnCloud once I had it installed.
For example, on my first installation attempt, I hadn’t really hammered out where I was planning on storing the files uploaded through OwnCloud, assuming that I could change it later.  When I attempted to switch that file location later through some mild config changing, the world collapsed in on itself and I suddenly could no longer log into the OwnCloud admin interface at all.
Despite my attempts to drop any SQLite tables associated with OwnCloud, I actually was not able to get OwnCloud working again until I reinstalled the operating system and started from scratch.  There may be tools associated with OwnCloud that can do this easily, but it was a serious keyboard pounding moment for me.
Owncloud is limited in its file size capabilities by your system’s PHP configuration.  You can change that configuration by editing the /etc/php.ini file and editing the upload_max_filesize and post_max_size variables to a larger size.  These are both usually limited to 10 megabytes and will usually show up as two separate lines like so:
upload_max_filesize = 10M
post_max_size = 10M
You should change these to be the maximum size that you expect for files that you will be syncing.  If you wanted to change it to one gigabyte limit you would use 1G instead of the 10M.  I arbitrarily set these to 4 gigabytes, and have had no issues with syncing xvid video files or other semi-large files.
Once that was complete, however, syncing directories with windows clients has been a snap.  The only other issue I had was getting everything working over SSL…

Rolling Out WordPress

WordPress’s Gritty Reboot

Rolling out WordPress was actually the last of the administrative acts I have accomplished on this server, and it was by far the easiest of the implementations.  I feel sheepish even calling it an implementation.  It was almost embarrassingly easy to get it up and running. I downloaded the latest version of WordPress from the WordPress download sections into my /usr/src directory.  This I did with:
cd /usr/src
wget http://wordpress.org/latest.tar.gz
After it completed its download, I untarred it, then copied it in its entirety to my apache document root directory.
tar xvf latest.tar.gz
cp -r wordpress /my/apache/documentroot/
Then, I gave apache ownership of the whole directory with:
chown -R apache: /my/apache/documentroot/wordpress
Then opening up a web browser to the WordPress index I followed the install methods.
But wait, a snag!  Mysqld wasn’t working!  WordPress alerted me to the fact that my PHP installation didn’t have the proper Mysql integration!  Oh no!  All is lost, and life is meaningless!
Except, all that was required, as I already had PHP installed was to make sure that the php-mysql package was installed.  The CentOS community repos make this available as a yum install.  So I went ahead an did that with:
yum install php-mysql
After getting php-mysql installed, WordPress held my hand the rest of the way, and it was up and running within seconds.  It was remarkable.  Bless open source web development and the heroes that keep it moving forward.  Bless them one and all.

Second Time Around

This is another go around for doing site administration.

I’m doing this via a virtual server, so we’ll see how well it translates.

It’s definitely exciting, and I feel like it should work out well, VirtualBox allows for snapshots and backing up as easy as setting a Belvedere timed copy command.