Wednesday, January 9, 2013

Sharing spaces between Linux hosts (Fedora 17, Rasbian 7)

I apologize for the lack of update, but I've not been feeling well.  I've been playing with my new Raspberry pi, trying to figure out what to do with it first.  Right now, my son and I are learning python together.  I want to be able to back up the pi since I don't particularly trust the SD card as a long term storage medium.  I have a laptop running fedora 17, so as an excercise, I'm going to setup a NFS (network file server) daemon on the laptop and have the raspberry pi running raspbian / wheezy.

First, since this is a lab environment at home and things tend to change around a good bit, I have all the hosts on DHCP for right now.  In production you'd want to have your hosts, especially servers with some sort of static arrangement.  I have long leases on my IP addresses on my internal router, and most of my gear is up at least once a day, so I don't tend to shuffle addresses often.  My Fedora box is named shinigami and my pi is cliffjumper.  This will be slightly confusing because shinigami, as a Fedora machine uses RPM (Redhat Package Manager) commands to install packages, and the Raspbian uses Debian's dpkg (Debian Package) commands.  I'll try to keep it as straightforward as possible.

First, we need to determine what we're going to share, and how.  For illustrative purposes, I'm going to make a space called /local on shinigami that will be shared on both hosts.

[jon@shinigami ~]$ sudo mkdir /local
[jon@shinigami ~]$

Next we want to install the server packages on the Fedora box.

[jon@shinigami ~]$ sudo yum -y install nfs-utils

I happened to already have it installed, so there was nothing of note to do here. Edit the relevant configuration files and start the services. Use whatever editor works best for you, I happen to be a 'vi' guy:

[jon@shinigami ~]$ sudo vi /etc/exports
/local 192.168.0.0/24(rw,sync,no_root_squash,no_all_squash)
[jon@shinigami ~]$ sudo systemctl start rpcbind.service
[jon@shinigami ~]$ sudo systemctl start nfs-server.service
[jon@shinigami ~]$ sudo systemctl start nfs-lock.service
[jon@shinigami ~]$ sudo systemctl start nfs-idmap.service
[jon@shinigami ~]$ sudo systemctl enable rpcbind.service
[jon@shinigami ~]$ sudo systemctl enable nfs-server.service
ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/multi-user.target.wants/nfs-server.service'
[jon@shinigami ~]$ sudo systemctl enable nfs-lock.service
[jon@shinigami ~]$ sudo systemctl enable nfs-idmap.service
ln -s '/usr/lib/systemd/system/nfs-idmap.service' '/etc/systemd/system/nfs.target.wants/nfs-idmap.service'
[jon@shinigami ~]$

The server should be up and running at this point, so we're going to have to setup the client. The following commands are under the Raspbian box:

jon@cliffjumper:~$ sudo apt-get install -y nfs-common portmap

This will install the packages you need to mount the filesystem.

jon@cliffjumper:~$ sudo service rpcbind start
Starting rpcbind daemon....
jon@cliffjumper:~$ sudo update-rc.d rpcbind enable
update-rc.d: using dependency based boot sequencing
jon@cliffjumper:~$ sudo mkdir /local
jon@cliffjumper:~$ sudo mount -t nfs shinigami:/local /local
jon@cliffjumper:~$ cd /local
jon@cliffjumper:/local$ ls -lsa
total 8
4 drwxrwxrwx  2 root root 4096 Jan  9 21:33 .
4 drwxr-xr-x 25 root root 4096 Jan  9 21:32 ..
0 -rw-rw-r--  1 pi   pi      0 Jan  9 21:33 foo
jon@cliffjumper:/local$

At this point you probably have UID mismatches, but at least you're now mounting the fileserver. You'll have all that space now available to the raspberry, but use caution; this method is not particularly secure nor is it particularly robust.

Monday, January 7, 2013

pi is online -- First impressions

The biggest thing that strikes me is how slow it is.  Like 386 slow.  Ran dstat and top, everything seems to be IO bound.  I'm considering installing an NFS server to see if that's faster than the SD card.  I also seem to be having power issues (maybe) because it flakes out randomly.  Right now the only thing plugged into it is my wireless keyboard adapter, but I'll 86 that tomorrow now that I have sshd running.

I went ahead and splurged for the case.  Installation took about a minute with two of the kids watching excitedly.  I feel much better about its enclosure as I'm terrified to snap off the resistor near the SD card slot.  Booted up, resized the root filesystem, tried installing a few apps with limited success (I have vim now, elinks and freedoom, but freedoom doesn't want to work with the composite out?  I'll try HDMI tomorrow.  I want to remove X off it, at composite resolutions its all but useless.

This is going to be an abbreviated entry due to illness.  Been feeling ill all day at work (still managed a productive day amazingly).  If I take tomorrow off (which is looking likely), I'll take a lot of time to play with the pi and see what I can do with it.

Sunday, January 6, 2013

Pi Projects Abound

My SD card has the OS ready to go, I'm looking at projects far and wide for my RPi coming tomorrow.  I have now no less than four projects that I expect will take some time; but each of which has at least a good chunk of the work done for each.  One of them may turn into arduino project down the road instead.

I'm also going to take apart my Roku and see if there's anything useful I can do with it.  Seems capable enough and its dead silent.  I have to see what my network can bear as far as load, so I'll need to get some network metrics stuff working between Windows (my fastest computer is still my gaming rig; soon it will be converted to Linux as well) and Linux.  If the network gear here can sustain it, it looks like streaming video isn't that bandwidth intensive and my old fashioned wired / wireless network (100 mbit LAN / 802.11 b/n wireless) should have enough to stream full 1080p (once I get a TV that can handle it).  Going to try to run the pi as a media center, a game center, a PBX and possibly as replacement for my house alarm (may need to buy a cell phone card for it at that point), plus some home automation.  The idea of having a low power computer just sitting idle takes me back to when I used to run servers everywhere in the house.  This time, they don't weigh 80lbs and cost $30 / month in electricity.

Friday, January 4, 2013

Raspberry Preparation

After Christmas, I took some holiday money I had received and ordered a Raspberry Pi, fully expecting it to be here in a month or so.  Ordered the main board and a case from Element 14 on the 28th.  It shipped today.  I also ordered a 16GB SD card known to work with the RPi, a solid known good power supply and the micro wireless network card.  I'm not sure entirely what I'm going to build with this right now, but two projects come to mind as starters:

- microMAME for playing on my main television, when the kids get bored of other stuff, toss in a throwback ROM.  Maybe Standalone?
- microPBX Use the Raspberry Asterisk project as a springboard, get it working to verify it works, break it and fix it again.
- TV receiver, similar to a Roku box, but able to more easily stream my 'local' content.
- Port Fedora or some other Linux that's not already on it to it.  This would be a challenge for me, but if I can pull it off, would be a great feather in my cap.  Start by using the existing distribution to compile the fedora compiler, move from there. EDIT: seems the Fedora guys already have it there...

As of right now, I have Wheezy burned to my SD card ready for the actual board to arrive, which should be late Monday.  I have a friends PC to complete this weekend and deliver, as well as some other opportunities to get some geek stuff done this weekend.

I'm game for other suggestions on pi Projects.  I'll probably buy multiple SD cards so I can do more than one at a time as well.  I'm working on some sort of infrastructure here so I can use git to keep everything sane.  I'm going to start cross compiling for that processor on my current i386 laptop and see how much luck I have getting some stuff ported over the weekend.

Thursday, January 3, 2013

Advice for Linux newbies

I watch G+ #Linux from time to time.  The most annoying posts always stem from the "I'm a Linux newb, what is the best distro to start learning Linux" requests from new users.  I half wonder if they're not trolling as another excuse for a distribution war.  I waded into one of these today and posted this:


There is no 'best' distro.  There is the one that will do what you want to do.  What do you want to do other than learn?  Is this for you to pursue long term employment?  
Get a distro, pick one, any one, use it as a workstation / desktop.  Learn it, break it, fix it, poke it, prod it.  Learn.  Once you've played with it, followed some tutorials on how to do specific things, then try it in a different distro.  Learn what's the same; what's different.
For absolute beginners, I'd say start with either Debian (or derivatives) or Redhat (or derivatives). 
Note I do not give advice on an exact distribution, but give leanings towards further reading (I went back and forth with the original poster a couple times, helping to nudge them in a direction.  The question in this instance asked if CentOS was a suitable version.  Rather than the conversation turning into thirty people yelling different distribution names at the poor guy, there was actual discussion.

All the people who immediately post Ubuntu or Fedora - you're not helping the cause.   You need to explain the HOW more than the WHY when suggesting something.  You need to be patient and be willing to answer questions, not just drop a name and go on to the next post.

History of the geek behind the keyboard

I've been screwing around with Linux for a long time by Linux standards.  It was my second *NIX-like operating system after SCO (System V, Release 4).  I struggled with the now long dead Yggdrasil and settled on the (at the time) super slick interface of Slackware.  It was a beautiful thing, other than having to manually configure your X.conf, getting a system up was a mere matter of swapping a bunch of 1.44 floppies into your computer to add just the packages you wanted (usually, I'd install the core and networking, then install everything else by downloading the packages after the fact) and you'd have a working system at the end of the afternoon.

Times change, I stuck with Slackware to about version 8, switched to Redhat just as they stopped providing a free version of the Operating System.  Played with BeOS for a while, became a Solaris Administrator, doing everything from basic installation to helping with complicated fail-over systems using Veritas and Sun HA.  Switched eventually to Fedora, then Ubuntu, RHEL 5, CentOS 5 and now I'm back to Fedora.  I've used FVWM95, CDE, OpenStep, Ximian Gnome, Gnome 2, Gnome 3, Unity, Enlightenment, BlackBox, xfce and too many other Window Managers to count.  I've configured networks, virtual machines, sandboxes, written device drivers, setup high volume and high profile servers on the internet.  Run bind (DNS), apache (httpd), written complex bash scripts, resorted to C++ when bash couldn't do it easily.

I'm constantly learning, trying to push through the barriers of what I know and resting on my laurels.  I've gotten to a point where there's realistically nothing I can't figure out, yet so much I have to learn.  I'm going to use this platform to HOPEFULLY help me document some of those problems as I work on them.

Tuesday, January 1, 2013

Easy Enlightenent 17 install on Fedora Core 17

For those of us who have been futzing around with different flavors of Unix / Linux / BSD for the last twenty or so years, there have been many changes to the way you do things and get them to work.  The holy grail of geekery back in the mid to late 90's was getting Enlightenment working as your window manager (the thing that acts as your main UI).  I've managed to get it working under Slackware back in the 90's, as well as RedHat on Intel and SPARC, and Solaris 7 in the 2000's (thanks to the Cuddletech packages).

Enlightenment 17 has become the replacement for Duke Nukem as the perennial vaporware.  Its been worked on for over a decade, and was finally released right before Christmas, 2012.  Rather than delve into the compile, I was ready to just see it working.  I have a spare Dell Inspiron 600m lying around that I installed Fedora Core 17 on a scant two days ago.  It has a shit video card, its 32-bit and its low on memory.  Humming along at a maximum 1.6ghz, this would be my test for my low end system.

To do the actual installation, from the enlightenment download page, it shows that the fine folks at OpenSuSE / Novell have made a repo with the appropriate rpms. 

As a regular user with sudo access:

$ wget http://download.opensuse.org/repositories/X11:/Enlightenment:/Factory/Fedora_17/X11:Enlightenment:Factory.repo

And it would be used like this in a post:

$ sudo cp *Factory.repo /etc/yum.repos.d
$ sudo yum install e17

That's it.  Log out of whatever WM you are currently using, and log in switching your session to E17.

Answer a couple questions to determine your keyboard layout, then decide how you want to handle fancy graphics.  I chose to use composting instead of 3d acceleration since the laptop in question has a basic graphic card.
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.