Wednesday, January 13, 2016

Adding Virtualbox Guest Additions and Google Chrome to Centos 7

One effective strategy in preparing for the RHCSA certification is to spend as much time in a Centos environment as one can doing the kinds of things one does each day with a computer.  I'm not prepared yet to give up my Ubuntu desktop, but I've found VirtualBox to be a fine way to switch OSs with ease.

We will be using VirtualBox VMs extensively in our Linux System Administration course, and we have installed two by default, one with a Gnome GUI and one without a GUI.  I want to be able to run the VM with a GUI in full screen mode on my 2560 x 1600 resolution monitor instead of the 1024 x 768 resolution that runs in the VM by default.  I would also like to be able to switch mouse control in and out of the VM without having to press the right control key.  Both of these wishes are granted by the VirtualBox Guest Additions.

As this post explains, all you have to do to get your Centos 7.2 VM ready for Guest Additions is to run:
# yum install epel-release
# yum install dkms
After that, select:
Devices -> Insert Guest Additions CD image...
from the menu of the window containing your running VM, and click on the buttons to download and then mount the image.  After doing that, I changed to the directory where the CD image was mounted with:
# cd /run/media/user/VBOXADDITIONS-$.3.34_104062
and ran:
# ./VBoxLinuxAdditions.run
and then:
# shutdown -r now
After that, I had everything I wanted.  I can resize the window, or maximize it (with Right Control & F keys).  When not full screen, mouse control is transfered to the VM whenever the mouse pointer enters its window and back to the host OS whenever the mouse pointer leaves its window.

In fact, beginning with this sentence, I editing this blog entry from my full screen Centos 7.2 desktop:

Installing Chrome


Then next task to setup a fully functioning desktop is to install Google Chrome.  Here is how to do it:
  1. Create a file /etc/yum.repos.d/google-chrome.repo with the following contents:
    [google-chrome]
    name=google-chrome
    baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
    enabled=1
    gpgcheck=1
    gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
    
  2.  # yum install google-chrome-stable
That's all there is to it.  This has been another fine experience with Centos.  I'm liking it more and more each day ;-)

Sunday, January 10, 2016

Chalk Up One for Centos: Removing Old Kernels

I have committed to memory the commands needed to remove old kernels from the Lubuntu 14.04 workstations in our lab:
# dpkg --purge linux-image-extra-[kernel version]-generic
# dpkg --purge linux-image-[kernel version]-generic
# dpkg --purge linux-headers-[kernel version]-generic
# dpkg --purge linux-headers-[kernel version]
With the frequency with which new kernel versions have been released, this can become a rather tedious process.  I have machines in the lab that have many old kernels, and this collection of 4 dpkg --purge commands has to be run for each old kernel on each machine.  I can hear the skilled sys admins out there groaning that I should just run ... (fill in the correct CLI command here - probably involving xargs or something), or set up proper configuration management using Puppet or something.

Despite my years and years teaching with GNU/Linux systems, however, I am not much of a sys admin, and I don't know how to nor do I feel confident enough to try commands like that.  I'll either end up deleting the current kernel, or spending half the day getting the command to work, and then fail to complete my teacher responsibilities (lesson planning, gradeing, etc.) as a result. In years past I've relied on bright, fast learning students to become the sys admins of our lab, but we are in a rebuilding process at present and I don't have any students with these skills at present.

I'm confident that preparing for the RHCSA certification this Spring will help me become better at this sort of thing, but I am philosophically committed to software freedom, and the idea that you have to be some sort of wizard to use free systems properly runs counter to idea that software freedom should be promoted as widely as possible.

It turns out that Centos 7 has a delightfully simple way to address the old kernel problem (see this for more information).  Just run:
# yum install yum-utils
# package-cleanup --oldkernels --count=1
I searched in vain for anything on the Ubuntu side this simple.  The best I could find was this post, which was not very comforting.

Chalk up a clear win for Centos on this one!

Saturday, January 9, 2016

GUIs, CLIs and Updates on Centos 7

In addition to running Centos 7 in VirtualBox to prepare for the RHCSA exam, I am installing it on several machines in our IT lab at the Arlington Career Center, since the best way to become truly comfortable with an OS is to use it in day to day activity.  After many years (since 2004) using Ubuntu as my desktop OS, I feel very comfortable with its quirks and with navigating my way around Launchpad and Personal Package Archives (PPAs) and such to find and install the software I need.

Centos 7 is new to me, so it will take me awhile to reach that same feeling of comfort.  I had an early experience that is a bit disconcerting, which raises some questions I would like to get answered early on in the process.

Following the instructions in the text we are using to prepare for the RHCSA, I selected "Server with GUI" from the software selection dialog.  When the install finished, I had a Gnome Shell 3 desktop.  The following screenshot shows this desktop with the System Tools menu displayed:

 
I'm in the habit of running system updates obsessive compulsively (as I do most everything), so the first thing I did after completing the install was click on the "Software Update" menu to run updates.  The next screenshot shows the update process underway:


When it finished, I was caught by a surprise.  The menu options under "System Tools" had changed, and options "Software" and "Software Update" weren't there anymore:


I've been telling my young charges that "real sys admins don't use GUIs" since the beginning, so I would be perfectly comfortable if it were the case that the proper way to update Centos 7 is just to run:
# yum update
and that we should simply avoid the GUI update and package tools which have now disappeared anyway. I'll be more comfortable when I can read this as official Centos doctrine, so I'll be looking for statements to that effect as I continue learning.  I also need to find out how to work with RPM repositories, and which ones I should add to our lab workstations that will best provide software I will want without causing conflicts and breaking things.

To see if I could learn more about the disappearing menu items, I did a Google search on "Software Update" disappears from Centos 7 after running it and found this, which was helpful. It seems odd to me that such a big change would be made between what I would assume to be a minor release update (7 to 7.2), but getting a feel for how things work in Centos is what I am after, so this experience will be part of my education.

Tuesday, January 5, 2016

Starting the New Year with RHCSA Study

During the Spring semester, I will be working with four students in a dual-enrolled (high school and college credit) course titled: ITN 170: Linux System Administration. While learning to administer GNU/Linux systems, we will also be preparing for the RedHat Certified System Administrator (RHCSA) exam.

I will document our progress here, and ask that the four students keep blogs of their own.

I first used RedHat software in 1995 with the original RHL 1.0 release in May of that year.  I had been using Slackware prior to that, and RedHat quickly became my distro of choice.  It remained so until the first release of Ubuntu in 2004. So this will be something of a return to my past, and I'm looking forward to seeing how much of what I remember still holds.

As a first task, I wanted to find out how to easily remove old kernels from the Fedora 23 box we setup in the lab.  A quick search revealed this. It couldn't be much simpler:
  • # dnf install yum-utils
  • # package-cleanup --oldkernels --count=1
My next task was to install VirtualBox.  This is a single command on Ubuntu, but is a bit more complicated on Fedora.  Not too bad, however, with the documentation here.  I used the following four step process:
  •  # cd /etc/yum.repos.d/
  •  # wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
  • # dnf update
  • # dnf install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms
So 2016 will be the year I return to my RedHat roots.  Happy New Year!

Sunday, November 1, 2015

Setting-up OpenGeo and TileCache Servers

 

Installing OpenGeo Suite


In my previous post I talked about the impact that Boundless is having on my GGS 692: Web-based GIS course.  It turns out the impact is even more than I reported, since our final project for the course will be based on the Building a GeoNames Heat Map tutorial found on the Boundless website.

We were given a VirtualBox hard drive image at the beginning of the course, with Ubuntu 12.04 and all the software we would need for class, including the OpenGeo Suite. While I've been using this image, I want to be able to set up everything myself, so I'm going to try to install the OpenGeo software on an Ubuntu 14.04 virtual machine.  I'll be following the instructions for installing OpenGeo Suite 4.7 on Ubuntu 14.04 here.  Following those instructions, I did:
$ sudo su -
# wget -qO- https://apt.boundlessgeo.com/gpg.key | apt-key add -
# echo "deb https://apt.boundlessgeo.com/suite/latest/ubuntu/ trusty main" > /etc/apt/sources.list.d/opengeo.list
# apt-get update
# apt-get install opengeo-server
This installed 244 new packages, including each of the components listed here. The OpenGeo Suite is certainly free software, but it uses both Java and Mono, and I'm a Python fan, so while I'll learn to use GeoServer for class, I'm going to pursue another, lighter map server stack at the same time.

 

Installing TileCache


TileCache is an implementation of the Tile Map Service (TMS) specification written in Python.  I setup an Ubuntu 15.10 server for this project and installed tilecache with:
$ sudo aptitude install tilecache
It installed 17 dependencies, including python 2.7, along with the tilecache package.  I am beginning to wrap my head around how this map server works.  It is built on three layers:
The geospatial data objects are stored in a PostGIS database.  Mapnik turns the data into images (tiles), which TileCache serves through the web. TileCache implements the Tile Map Service (TMS), a specification developed by OSGeo.

On the client side, a JavaScript library like Leaflet assembles the tiles for viewing.

Continuing with the server installation:
$ sudo aptitude install python-mapnik
$ sudo aptitude install postgresql-9.4-postgis-2.1
 With the software for the two servers installed, my next task will be to load the data for my GIS 692 class onto the OpenGeo server and the Arlington County map data onto the TileCache server.

Saturday, October 31, 2015

Boundless Geospatial Opportunities

A few weeks ago in GGS 692: Web-based GIS we were assigned a set of exercises writing spatial SQL queries on a spatially enabled database. The reading material for the lesson consists mainly sections from an Introduction to PostGIS tutorial produced by a company named Boundless.

It wasn't until I began reading the tutorial that I realized just how much of the curriculum of our course comes directly from the Boundless materials.  By providing high quality, classroom ready learning materials, Boundless has changed the curriculum in the GIS program GMU from one using proprietary software to one built on free software tools.

I only wish other projects in the free software movement could take this valuable lesson from Boundless and find a way to get their tools into classrooms. If we want to change the world, this is an important part of how we have to do it!

Sunday, October 4, 2015

A Geospatial Werewolf

I've been contemplating a post with the tile "Seduced by the Dark Side - Or Why I Love My MacBook Air".  I decided not to devote a whole post to such evil things, so I'll restrict myself to a few paragraphs and then move on to better things.  Let me just admit it.  I really like using the MacBook Air that I was given at work.  I didn't buy it.  I know it's evil (really, really evil, in fact, since it is sooo seductive), and I will certainly do all I can to resist its evil temptations.  I've already removed all the Apple Store paid for applications that were on it, and I've installed Homebrew and a host of free software (things like QGIS and pgAdmin3).  I also installed VirtualBox and set up a Lubuntu 14.04 VM on it, which I use most of the time. In spite of all that, I have to admit that I really like using it.  I like the way it looks.  I like the way it feels in my hands and under my fingers as I type on it.  I like the way it responds so smoothly and quickly. There, I've come clean and got that out of my system.  The last thing to mention is that when I told my friend Kevin Cole that I had been seduced by the dark side, he knew without being told what I was going to say, and sent me this link, which pretty much hits the nail on the head...

Lubuntu 15.10 - A Geospatial Werewolf


Moving back into the realm of freedom, the upcoming release of Lubuntu 15.04, which I am running now on a few different machines but which will have its official release on October 22nd, offers new Python 3 versions of the geospatial libraries I described in a post back on April 19th. It also comes with QGIS version 2.8, which is a good thing indeed, since the version 2.4 that came with previous versions did not work properly (I couldn't get it to create layers using the DB Manager).  Here are the Python 3 GIS packages I installed on this new version, code named Wily Werewolf:
  • python3-gdal
  • python3-pyproj
  • python3-shapely
  • python3-mapnik
The last one in particular was not available in previous releases. And as if a sign of its strong GIS support, the default background on the Lubuntu version features a TIN pattern.  Here is a screenshot with QGIS running:
I've been tasked this week with looking into how to use mapnik.  Thanks to Wily, I'll be able to do this in Python 3.