Below you will find pages that utilize the taxonomy term “Linux-2”
Maplins weather station fun
A while ago I bought one of the Maplins weather stations, just for fun really no plans with it. The device came with a pole to which several sensors could be attached: temperature, humitidy, wind speed, wind direction and rain level. The other important bit in the box was the control station, which is a large LCD screen based output for the information which is gathered in the sensors, it also gives an attempt at forecasting. Areas of the screen are pressure sensitive which allows for a touchscreen style interface for changing views etc.
Ensure systemd services restart on failure
I wrote a post a while ago covering the use of Monit to monitor services running and the use case I covered was to ensure these services restarted on failure. While a useful feature of Monit, it seems to be now a little redundant with SystemD having a built in restart feature.
Same use case where MySQL (or MariaDB in this case) is being killed by Apache’s oom killer.
I first copied the original systemd file associated with Mariadb from /usr/lib/systemd/system/mariadb.service to /etc/systemd/system/mariadb.service
Hardening SSH with OTP for 2 factor authentication
Something I’ve been meaning to do for a while is look into the possibility of using 2 factor authentication, or 2FA, with SSH connections. This would add a much needed level of security to servers I host out in the wild.
Here’s how I did it:
The Google Authenticator mobile app used to be an open source project, it isn’t any more but the project has been kindly forked and looked after by Red Hat under the guise of the FreeOTP project. The first step is to download the app, which is available for Android and iOS there is even a Pebble project in the works. https://fedorahosted.org/freeotp/
Etckeeper - config version control
A valuable tool I have been using for many years is etckeeper, it works by essentially turning your /etc directory into a git repository.
This is a fantasticly useful set of tools as any configuration changes can be logged and also reverted quite easily. Install and setup is exeptionally easy too!
Packages are available for most distributions, but my scenario (Fedora,CentOS,RHEL) was:
yum install etckeeper
Once the package was installed an initialisation must be performed:
SSH known hosts verification failure one liner
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
Those who regularly build and rebuild machines or virtual machines on a dhcp network will probably be faced with this quite often, this is due to the known fingerprint for the previous host being different to a new one which has aquired the same IP address.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is c5:ab:00:3c:88:7e:18:8f:46:49:1d:af:f1:8b:4e:98. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /root/.ssh/known_hosts:66 ECDSA host key for 192.168.1.165 has changed and you have requested strict checking. Host key verification failed.
Getting Fedora 21 on the Raspberry Pi 2
The recent release of the Raspberry Pi 2 uses a newer version of the ARM architecture spec, the ARM Cortex-A7 uses ARMv7 whereas the previous model ARM11 uses ARMv6. The great thing about this is the majority of Linux distros already provide an Image for this architecture. More importantly, Fedora already have images.
There is a slight caveat to the above statement however, that being they won’t just work with the Pi 2. The process isn’t that difficult either just a few steps:
Monit - monitor your processes and services simply
Monit is an application I’ve been meaning to setup for a while, I was first made aware of it from a chap I had the pleasure of talking to at OggCamp this year, he seemed to use it to the n’th degree to monitor files and services within docker containers to ensure a development environment was as it should be. This was far more than I really needed, but the monitoring of services definitely caught my attention so I set about installing and configuring. I was pleasantly surprised with the result, and how simple the whole process was.
Gluster, CIFS, ZFS - kind of part 2
A while ago I put together a post detailing the installation and configuration of 2 hosts running glusterfs, which was then presented as CIFS based storage.
http://jonarcher.info/2014/06/windows-cifs-fileshares-using-glusterfs-ctdb-highly-available-data/
This post gained a bit of interest through the comments and social networks, one of the comments I got was from John Mark Walker suggesting I look at the samba-gluster vfs method instead of mounting the filesystem using fuse (directly access the volume from samba, instead of mounting then presenting). On top of this I’ve also been looking quite a bit at ZFS, whereas previously I had a Linux RAID as the base filesystem. So here is a slightly different approach to my previous post.
Upgrade CentOS 6 to 7 with Upgrade Tools
I decided to try the upgrade process from EL 6 to 7 on the servers I used in my previous blog post “Windows (CIFS) fileshares using GlusterFS and CTDB for Highly available data”
Following the instructions here I found the process fairly painless. However there were 1 or two little niggles which caused various issues which I will detail here.
The servers were minimal CentOS 6.5 installs, with Gluster volumes shared via CTDB. The extra packages installed had mostly come from the EPEL or Glusterfs repositories, and I believe this is where the issues arise - third party repositories.
Windows (CIFS) fileshares using GlusterFS and CTDB for Highly available data
This tutorial will walk through the setup and configuration of GlusterFS and CTDB to provide highly available file storage via CIFS. GlusterFS is used to replicate data between multiple servers. CTDB provides highly available CIFS/Samba functionality.
Prerequisites:
2 servers (virtual or physical) with RHEL 6 or derivative (CentOS, Scientific Linux). When installing create a partition for root of around 16Gb, but leave a large amount of disk space available for the shared data (you can add this in the installer but ensure the partition type is XFS and that the mountpoint is /gluster/bricks/data1) Once you have an installed system, ensure networking is configured and running, in this example the two servers will be:
Raspberry Pi Wildlife Camera
A while ago I built a Raspberry Pi based nature camera, sometimes known as a trail camera. Normally I cover most of my projects on here but this one has been a little different as it was featured in this months Linux Voice magazine. For this very reason I won’t feature a write-up here, just a few images and videos captured using it and a couple of pointers to the software used in the project.
Installing dig on a CentOS or Red Hat machine
Gone are the days where we install nslookup for DNS resolution testing, the new(ish) kid on the block is dig. Although maybe not installed by default, it can be installed quite easily from yum, however it comes bundled with a number of tools so the package name isn’t all that obvious.
[root@server ~]# yum install bind-utils
Will do the trick, now how to use it?
[root@server ~]# dig @nameserver address.com
Import regular kvm image to oVirt or RHEV
I recently replaced a couple of servers within a friends business with an oVirt virtualisation setup, I’m really pleased with the whole configuration which consists of a single engine host and 2 hypervisor nodes, the storage is shared over the 2 hosts with glusterfs. The guests which run on the platform replace the services that ran separately on a couple of physical servers, LAMP stack for intranet, Asterisk PBX, postfix/dovecot mailserver, squid proxy cache, Bind DNS, and DHCP server.
2013 - A good year
I thought I’d finish off the year with a bit of reflection, overall it’s been a pretty good year in both camps of my life - the geek/tech and the family side. Obvious highs of the year include:
- Birth of my second child, Alfie.
- OggCamp 13
- LinuxCon Europe
- Barcamp Blackpool
- RossLUGs 3rd year - some fantastic meetings this year.
It certainly has been a full on year.
It’s been a really tech filled year, as since moving house last September I’ve had my own space for all my tech which is a real bonus. It’s allowed me to really get back into electronics with Arduino building the home automation system, the electric meter monitor (still to be finished) and more recently bringing a snowman christmas decoration back to life:
OggCamp and LinuxCon Europe: Part 2 LinuxCon Europe 2013
Whoa I’m getting a bit slow here!
After the full on weekend of OggCamp my marathon continued up in Edinburgh for LinuxCon Europe 2013. Unfortunately my plan of heading up straight from OggCamp was scuppered, but I set off first thing on Monday morning. I decided to stick with driving after toying with the idea of getting the train. Glad I did, the Edinburgh park and ride system is brilliant! Parked up at Sheriffhall which allowed me to stay up to 7 days, perfect.
OggCamp and LinuxCon Europe: Part 1 OggCamp
Although it’s been over a week since I returned from both these events I thought I better put a little something up about them and the experiences I had there.
Unfortunately Oggcamp and LinuxCon followed each other directly this year, so it meant a lot of heaving about over the course of about a week. Here’s part 1 where I will detail my time at OggCamp.
The event I look forward to all year, took a little longer to arrive this year due to it being moved to October (Oggtober?), happened over the weekend of the 19th & 20th October and much fun was to be had. As being part of the crew last year was so much fun (and hard work) I couldn’t resist doing the same this year, although I was a part timer this year due to also running a Fedora stand and a stand for our LUG (RossLUG). I arrived on the Friday evening to the guffaw of an unexpected art exhibition going off in the lobby of the John Lennon Art and Design building at John Moores University, I say unexpected as it was exactly that. The exhibition, although the building was booked for over 6 months, was arranged the week previous and we couldn’t gain access to setup much on the Friday. Even when that finished the caretaker decided enough was enough and it was home time. So off I went to find Rita’s B&B at the other side of town. Lovely place, a bit dated but very homely and Rita was lovely, I described her to various folks as looking like the oracle from the Matrix (the first one not the second). Proper tea, coffee and biscuits on the bedside table too!
Light control with MQTT on Arduino
It’s been a while since I stayed up most of the night writing code, mainly down to having a young daughter but also down to the fact I haven’t found anything that needed a late night hack session to produce a result. This weekend changed all that, I’ve been playing around with home automation for a while but am now actually taking the plunge. I purchased a load of Arduino and electronics kit over the last few days to start prototyping the setup.
New hosting for my blog
After one of my LUG colleagues mentioning about the BigV service from Bytemark I just had to try it. So today I prized open the wallet and set myself up an account.
For £10+VAT per month you get a VM, it comes with 25gb HD space, 1GiB RAM, 1CPU (2.2ghz AMD it seems) and 200gb bandwidth per month. All seems pretty reasonable. Their software is a breeze to use, and being command line driven its my kind of thing. The underlying tech is KVM/QEMU, and I’m guessing some kind of openstack(y) type goodness, as you can spin up a VM from their selection of images or connect your own ISO.
Why I'm uninstalling Ubuntu
I wouldn’t normally write about this kind of move, but I’m in a position where I feel I have to. A little over a year ago I made a decision to move from Fedora to Ubuntu, it wasn’t a decision that was easy after all I have been using Fedora since its first release, and Red Hat since around version 5. Needless to say I was (and still am at heart) a die hard Red Hat fan. There seemed at the time to be a draw to Ubuntu, I was feeling a buzz around the community there that I wasn’t really seeing with Fedora (although I don’t think I was looking), a lot was going on around the Unity project - whether good or bad, it was still going on. So I jumped right in, installing the latest release 11.10 I think it was, joined the forums/wiki/launchpad etc and started filing bugs and generally making a nuisance of myself.
Post Raspberry Jamboree Event
Let me start by saying, Saturday was a fantastic day out - even if I was there as crew not an attendee. The day started as most of these type of events do, runnning slightly late, I was a little worried at first as I thought I was the one running late (even though I was bang on time), but then I remembered who I was waiting for :). Eventually bumping into familiar faces everything started to fall into place. Kitting out the place with microphones and laptops for presentations in the main room seemed to go without any major hitches and led us up to the opening time of around 10:30, the usual mayhem followed as it always does with a mass of people queuing to get into the event. It didn’t seem to matter though, as all the crew were on deck and ready to deal with the, what seemed to be smiley happy, crowd.
Raspberry Jamboree Event
This coming Saturday, 9th March, I’ll be helping out as crew member at what could be the most exciting Raspbery Pi event since its launch. CPC are sponsoring the jamboree, with talks from plenty of familiar, and some not so, faces at the exhibition centre in Manchester. Much looking forward to it. Full writeup will follow after the event, I am expecting an announcement or two though, not sure what though.
Linux Outlaws Live in Liverpool
There are a number of events in my geek calendar I really look forward to throughout the year, most of them centre around a particular group of people too. This year an extra event has turned up early in the list, Linux Outlaws Live, or LOL as it seems to be more affectionately known. The live show, celebrating the 300th episode of Linux Outlaws, was held at Leaf on Bold st, Liverpool.
GlusterFS Quickstart Howto on Fedora
Here’s a (very) quick howto showing how to get GlusterFS up and running on Fedora. Its probably better situated on a distro like CentOS/RHEL, Ubuntu Server LTS or Debian stable but where’s the fun in knowing it won’t break? Most of these commands are transferrable to other distros though, its Fedora centric due to the use of yum, selinux and systemd (systemctl).
Pre-requisites: 2x (or more) servers running Fedora, I used 18 in this example but i’m sure it shouldn’t change a great deal for newer releases. If it does I’ll try update this doc. The idea behind this setup is to use 2 servers as hypervisors (KVM) and have local storage but reslience, I won’t be covering the virtualisation side, purely storage so VM’s will be adequate for this setup.
rsync with spaces in filenames fun
While I was trying to copy a load of files from one server to another I found a problem I’ve seen time and time again, rsync with filenames that have spaces in them. While normally this can be easily fixed via number of methods:
rsync ‘jon@example.com:/remote/path/filename with spaces.txt’ /local/path/
Notice the quotes around the remote path, you can also use the -s (or –protect-args) which will send the command as-is to the remote.
Post Virtualisation Talk
Well I finally got there, after a bout of illness causing me to postpone the talk, I finally delivered it last night.
The equipment performed flawlessly, thankfully.. After my asterisk talk you’d think I’d learn to turn off DNS lookups in SSH though.
The only downside was that when I ran through the talk I was installing packages so was actually tight on time, didn’t think about the fact they were already installed so I finished a good 20 mins early. Would have given me time to talk about something I really wanted to include, GlusterFS.
Virtualisation talk
So this coming Monday will be the 2 year anniversary of the Rossendale Linux User Group, not too shabby really. Not marking the occasion or anything but I’m going to be running a talk/demo on virtualisation under Linux. Seems to be the pet project I’ve worked on the most so have a fairly polished setup to talk about. But why make it easy on myself? I normally use CentOS for server builds but just for a change, as it seems to be the way I’m heading, I decided to give Ubuntu a shot.
Hourly Backup Script for Email
So I was working on a script a while ago to backup all my email on my Linux box. I put together a fairly simple bash script to delve into home directories and pick out the Maildir and back it up. Great!
DRIVE="/dev/sdb1" HOME="/home/" LIST="/tmp/backlist_$$.txt" # mount $DRIVE /backup set $(date) for DIR in `find /home/ -name “Maildir” -print`; do NAME=`echo $DIR|awk -F\/ {’ print $3 ‘}` tar vcfz “/backup/Mail/mail_full_${NAME}_$6-$2-$3.tgz” $DIR umount /backup