March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  
97

Categories

Archives

Fixing Ruby Support in Vim on Fedora 10, 11, and CentOS 5 & Installing the Vim Textile plugin

Background

A while back I was trying to get the vim textile plugin installed and ran into a problem. Apparently the vim that’s included with Fedora 10, 11, and CentOS 5 doesn’t include ruby support. This bug report explains what’s wrong with vim and how it’s missing ruby support. The problem is visible with this command:

1
2
3
4
% vim --version | grep ruby
+printer +profile +python +quickfix +reltime +rightleft -ruby +scrollbind 
...
...

The –ruby tells us that ruby support isn’t enabled. The only solution I’ve seen thus far is to rebuild vim. Not really a huge deal but it’s work non the less 8-).

Rebuilding vim with ruby support

Here’s how I fixed it.

download vim Source RPM (SRPM)

1
% wget http://mirrors.xmission.com/fedora/updates/10/SRPMS/vim-7.2.148-1.fc10.src.rpm

confirm that ruby is installed

1
2
3
4
5
6
% yum list installed ruby*|column -t|grep ruby
ruby.i386        1.8.6.287-2.fc10  installed
ruby-devel.i386  1.8.6.287-2.fc10  installed
ruby-irb.i386    1.8.6.287-2.fc10  installed
ruby-libs.i386   1.8.6.287-2.fc10  installed
ruby-rdoc.i386   1.8.6.287-2.fc10  installed

make sure you have your own rpmbuild directory

1
2
3
4
% mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
 
# caution with this second command if you already have your own .rpmmacros, this will overwrite!
% echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

rebuild vim / re-install vim

1
2
rpmbuild --rebuild vim-7.2.148-1.fc10.src.rpm
rpm --force -Uvh /root/rpmbuild/RPMS/i386/vim-{c,e,m,X}*

check that vim now has ruby support

1
2
3
4
% vim --version | grep ruby
+printer +profile +python +quickfix +reltime +rightleft +ruby +scrollbind 
...
...

Ahh. a +ruby means it worked.

Textile Plugin for vim

Now onto installing the vim textile plugin.

First things first, we need to install rubygems

1
% yum install rubygems

Next we need to install the RedCloth gem, it’s required by the textile plugin

1
2
3
4
5
6
% gem install RedCloth
Building native extensions.  This could take a while...
Successfully installed RedCloth-4.2.2
1 gem installed
Installing ri documentation for RedCloth-4.2.2...
Installing RDoc documentation for RedCloth-4.2.2...

Finally, install the textile plugin

Downloading the textile plugin from here,


…. Continue reading → Fixing Ruby Support in Vim on Fedora 10, 11, and CentOS 5 & Installing the Vim Textile plugin »»

[one-liner]: Shell Builtins

Background

I recently worked a problem in a previous post where it wasn’t clear which version of the command nohup was getting used. The version that was built into the C-shell interpreter, or the executable sitting under /usr/bin/nohup. This brought up an interesting point, how do you know what commands are builtins to the shell itself?

Enter the commands: builtins and enable

These are 2 commands that I’d never even heard of until I started doing research for this post. They both basically do the same thing. They show you all the builtin commands for a particular shell, builtins for C-shell, and enable for Bourne Shell.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# C-shell builtins
 
#NOTE: run this command within a C-shell (aka. csh or tcsh)
% csh
 
% builtins
:          @          alias      alloc      bg         bindkey    break
breaksw    builtins   case       cd         chdir      complete   continue
default    dirs       echo       echotc     else       end        endif
endsw      eval       exec       exit       fg         filetest   foreach
glob       goto       hashstat   history    hup        if         jobs
kill       limit      log        login      logout     ls-F       nice
nohup      notify     onintr     popd       printenv   pushd      rehash
repeat     sched      set        setenv     settc      setty      shift
source     stop       suspend    switch     telltc     termname   time
umask      unalias    uncomplete unhash     unlimit    unset      unsetenv
wait       where      which      while
1
2
3
4
5
6
7
# Bourne Again Shell builtins
 
#NOTE: run this command within Bourne Again Shell (aka. bash)
% bash
 
% enable | cut -d" " -f2 | sed -e :a -e '$!N;s/\n/ /;ta'
. : [ alias bg bind break builtin caller cd command compgen complete continue declare dirs disown echo enable eval exec exit export false fc fg getopts hash help history jobs kill let local logout popd printf pushd pwd read readonly return set shift shopt source suspend test times trap true type typeset ulimit umask unalias unset wait

NOTE: The command is enable. I’m simply running the output of enable through this cut & sed filter so that the output of enable is more concise for this example.

nohup

As you can see, by looking at the output from builtins, the command nohup is listed there, which means that C-shell has it’s own implementation of nohup. Looking at the output from enable, you can see that Bourne Shell, doesn’t include it’s own builtin for nohup, so it would use /usr/bin/nohup. Pretty simple, eh?

NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.

[one-liner]: Using dig to Mine Useful DNS Info

Here are 2 quick tips for using the Linux command dig to mine some interesting DNS information.

Background

dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. Other lookup tools tend to have less functionality than dig.
.

Tracing a DNS Query

Similar to a traceroute, you can use the dig command’s +trace option to follow the path of servers that a DNS look-up touches. For example, here’s how my domain, lamolabs.org would look:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% dig lamolabs.org +trace
 
; < <>> DiG 9.5.1-P2-RedHat-9.5.1-2.P2.fc10 < <>> lamolabs.org +trace
;; global options:  printcmd
.			518400	IN	NS	H.ROOT-SERVERS.NET.
.			518400	IN	NS	I.ROOT-SERVERS.NET.
.			518400	IN	NS	J.ROOT-SERVERS.NET.
.			518400	IN	NS	K.ROOT-SERVERS.NET.
.			518400	IN	NS	L.ROOT-SERVERS.NET.
.			518400	IN	NS	M.ROOT-SERVERS.NET.
.			518400	IN	NS	A.ROOT-SERVERS.NET.
.			518400	IN	NS	B.ROOT-SERVERS.NET.
.			518400	IN	NS	C.ROOT-SERVERS.NET.
.			518400	IN	NS	D.ROOT-SERVERS.NET.
.			518400	IN	NS	E.ROOT-SERVERS.NET.
.			518400	IN	NS	F.ROOT-SERVERS.NET.
.			518400	IN	NS	G.ROOT-SERVERS.NET.
;; Received 304 bytes from 192.168.1.101#53(192.168.1.101) in 7 ms
 
org.			172800	IN	NS	B0.ORG.AFILIAS-NST.org.
org.			172800	IN	NS	B2.ORG.AFILIAS-NST.org.
org.			172800	IN	NS	C0.ORG.AFILIAS-NST.INFO.
org.			172800	IN	NS	A2.ORG.AFILIAS-NST.INFO.
org.			172800	IN	NS	D0.ORG.AFILIAS-NST.org.
org.			172800	IN	NS	A0.ORG.AFILIAS-NST.INFO.
;; Received 432 bytes from 192.203.230.10#53(E.ROOT-SERVERS.NET) in 106 ms
 
lamolabs.org.		86400	IN	NS	ns1.mydomain.com.
lamolabs.org.		86400	IN	NS	ns2.mydomain.com.
lamolabs.org.		86400	IN	NS	ns3.mydomain.com.
lamolabs.org.		86400	IN	NS	ns4.mydomain.com.
;; Received 114 bytes from 199.19.57.1#53(D0.ORG.AFILIAS-NST.org) in 147 ms
 
lamolabs.org.		3600	IN	CNAME	bubs.dyndns.org.
lamolabs.org.		86400	IN	NS	ns1.mydomain.com.
lamolabs.org.		86400	IN	NS	ns2.mydomain.com.
lamolabs.org.		86400	IN	NS	ns3.mydomain.com.
lamolabs.org.		86400	IN	NS	ns4.mydomain.com.
;; Received 204 bytes from 64.94.31.67#53(ns2.mydomain.com) in 75 ms


…. Continue reading → [one-liner]: Using dig to Mine Useful DNS Info »»

Howto Install Windows Print Drivers onto a Central Samba Share

If you’ve followed my blog for a while you’ve probably noticed that I like to automate just about everything. I can’t stand doing anything manual, at least more than once. So of course when I setup a network printer, I like to have the Windows drivers that go along with each printer available automagically over the network. This technique isn’t glaringly obvious so I thought I’d quickly document how I accomplished it.

Background

This technique requires that you already have both Samba & CUPS servers setup and configured. You should also already have the printer whose drivers we’re going to install configured and working through CUPS. You can read how I did this for the MFC-8480DN printer in this previous post.

Getting Started

First things first, you typically want to grab a copy of the Windows drivers for your particular printer. Remember, in this example I’m using the network capable, Brother MFC-8480DN, that I discussed in this previous post. I downloaded the Windows drivers from the Brother’s website here. Here’s a link the specific driver bundle that I used. Brother calls this bundle the “Add Printer Wizard Driver”. I then set them aside, so I could focus on getting the special Samba share, print$, configured. This is a special share where print drivers for all versions of Windows can be staged, for later consumption by Windows client systems that add this printer.

Samba

adding the print$ share

For my setup, which is a CentOS 5 system, I added the following stanza to my /etc/samba/smb.conf file.

1
2
3
4
5
6
7
8
9
# /etc/samba/smb.conf
 
[print$]
  comment = Printer Driver Download Area
  path = /etc/samba/drivers
  browseable = yes
  guest ok = yes
  read only = yes
  write list = @samba-printers, root

NOTE: The unpacked driver files that get added to the print$ share will be stored under /etc/samba/drivers on the Samba server. You can put them really anywhere, but I chose to keep them with the Samba config. files.

samba-printers Linux Group

Next, I created a special Linux group that I arbitrarily called samba-printers. Users in this group, in addition to root, will be the only users that have permission to add Windows drivers to the print$ Samba share. I accomplished this by adding the line below to the /etc/group file on the Samba server.

1
2
3
# /etc/group file on Samba server
 
samba-printers:x:1020:root,user1,user2

The 2 user accounts, user1 & user2, are both Linux accounts as well as Windows accounts. In my home network I typically create them this way to make things like this simpler. If you happen to user different user accounts on Windows vs. Linux you can map the Windows accounts to Linux accounts through the Samba config. file /etc/samba/smbusers.

creating /etc/samba/drivers

Next, I created the directory /etc/samba/drivers and permissioned it with our newly created Linux group using these commands:

1
2
mkdir -m ug+rwx,o-w,g+s /etc/samba/drivers
chgrp samba-printers /etc/samba/drivers


…. Continue reading → Howto Install Windows Print Drivers onto a Central Samba Share »»

Mono is not a Wolf in Sheeps Clothing

wolf_in_sheep1I think people are missing the mark a bit on what .Net and Mono are, in terms of whether they’re a threat or not a threat to Linux and F/OSS. Hidden in all the speculation and conjecture of why Microsoft is budding up with Novell and SUSE to help support Mono is this one unarguable fact.

Without Mono, .Net is a one trick pony. .Net can only run on a Windows server stack. Java, the piece people seem to be missing here, can run on pretty much any stack. In fortune 500 land, Java == Enterprise. Microsoft wants a piece of this pie, but .Net all by itself on a Windows stack, is no Java.

I think Microsoft saw they had a weakness with .Net vs. Java, and tried to close this gap by extending a olive branch to Mono. Think about it, Microsoft had been slamming Linux and F/OSS prior to the announced deal with Novell, they could never create this capability directly in house, without losing all credibility. What’s their next best move? Partner with someone on the outside who can deliver .Net capabilities on other OS stacks. All the while Microsoft can keep bad mouthing these other OS stacks, just enough so they remain credible with their customer base.

The real battle ground? I think going forward the true battle ground for Linux and F/OSS is in delivering solutions that are F/OSS. What do I mean by this? I mean that we as a community need to make sure that we implement solutions that use generic off the shelf open source bits for whatever we deliver. By doing this we guarantee that nothing we implement can be locked in by any one vendor.

So, for example, if you need to create any software for a client or for yourself, you should be using things like Java, or Ruby on Rails, or Perl, or Python, or Mono. You shouldn’t be developing directly against the latest version of .Net on the Windows stack. In using any of the above software stacks that I just mentioned, you can pretty much be guaranteed, your software project will be portable to any OS stack.

Why I Love Linux and F/OSS

Recently I was reminded of why I love using Linux & F/OSS and it isn’t for any of the reasons that most people would guess. It isn’t JUST because …

  • the software is free as in beer
  • the source code is easily accessible
  • the software solutions are usually superior to commercial solutions

No, these are all what I would consider, gravy to why I truly love Linux & F/OSS.

The best reason?

The PEOPLE!

Take the LinuxPlanet Blogs maintainer, Linc Fessenden. One of the hosts of The Linux Link Tech Show, he spends his own time to: (1) setup and (2) maintain a great service, on top of everything else he does for the community through his blog and his participation in the weekly TLLTS podcast.

Recently I contacted Linc to see if he could add a couple of extra plugins to the WordPress install of LinuxPlanet:linuxplanet. Granted not a huge task, but he could just as easily said no or ignored my request all together. After an email exchange of all of 10-15 minutes, the plugins were added. Something as simple as this is at the core of what makes Linux and F/OSS great.

Comparing something like this to my experience with commercial software options, and I think Linux and F/OSS are already light years better than anything the proprietary software options have to offer.

In closing, week in and week out I listen to podcasts and read blogs that are put out tirelessly by people that are real and genuine people like myself that are just trying to understand the world around them and make it better than they found it. So to all these people I just want to say “THANKS!”

Page 1 of 3123