Vim-3D-blue-cloudsI’ve been using Linux for nearly a decade and a half. Back in my early college days when I first started experimenting with UNIX systems, I was forced (kicking and screaming! against my will!) to use an unintuitive little text editor called vi (it’s pronounced “vee eye,” you heretic!). Subsequently, in order to make up for some of vi‘s shortcomings, the Vim editor was born. Funny thing about Vim… once you start using it, you can’t seem to stop. Fortunately, it’s almost always there by default in every modern Linux distribution, and I even install it on my Windows machines now. My fingers are so accustomed to typing “vim” at the command prompt that it’s jarring when it doesn’t work – and this happens every time I need to edit a file in XenServer‘s console. Every. Single. Time. Sure, “vi” still works at the console, but my fingers are set in their ways, and I want all of Vim‘s functionality.

So the question became, “how can I install Vim on XenServer quickly, easily, and without screwing up anything on the system?” Fortunately, at its core, XenServer is simply a stripped-down CentOS distribution, which is itself just a recompiled version of Red Hat Enterprise Linux. If you’ve worked with RHEL in the past, then the XenServer console ends up being a very comfortable and familiar place. Still, Citrix has only a single yum repository enabled (their own), and it contains only the the base installation files. Fortunately, it’s easy to pull files from the base CentOS repositories if you know how. None of the information here is specific to XenServer or CentOS, but the steps below for installing Vim will also allow you to pull in anything else you need/want, although I wouldn’t recommend modifying the system too much.


Step 1: Get acquainted with the system


You can verify Citrix’s default yum settings easily enough. Type the following command to see the enabled repositories on the system:

# yum repolist enabled


I’m assuming you’re logged in as root, which should be automatic if you’re accessing the console from the XenCenter management application. The previous command’s output should show only the default “citrix” repository ID as enabled, which inconveniently doesn’t contain the package we want.

You can type a similar command to show all disabled repositories:

# yum repolist disabled


Citrix was nice enough to keep the CentOS repositories as part of their installation, albeit in a disabled state. Fortunately, that makes it easy for us to install what we need.


Step 2: Install Vim, or anything else you need:


There are two ways to pull packages from the base CentOS repositories. The first way is to keep the yum configuration intact while enabling the CentOS base repository for just this one installation, just this one time. I highly recommend this method! It’s quick, it’s simple, and there’s no chance of someone screwing up the system later when they work on it without realizing that the yum repositories were messed with.

Let’s install Vim with this method now. We need to enable the CentOS base repository while simultaneously disabling the default citrix repository during the installation. Here’s the command:

# yum --enablerepo=base --disablerepo=citrix install vim-enhanced


In a default XenServer installation, you should be prompted for a couple of dependencies. Allow them to install, and presto, Vim is installed! Text-editing bliss!


Alternate Step 2: Permanently change the yum configuration (not recommended):


Again, there’s another way to enable the CentOS base repository, although as I said, I don’t recommend it. To enable the repository permanently, edit the /etc/yum.repos.d/CentOS-Base.repo file on your system and switch the “enabled=0” line to read “enabled=1” instead. If you aren’t comfortable using vi, then you can do this with a single command from the root prompt:

# sed -i -e "s/enabled=0/enabled=1/" /etc/yum.repos.d/CentOS-Base.repo


Now you’ll be able to install software with the usual, simpler yum commands:

# yum install vim-enhanced
# yum install traceroute
# yum install (whatever else you want)


Again, do this at your own risk. I don’t like making permanent modifications like this if I can help it. Maybe you have a good reason… but if you think really hard about it, you probably don’t.

As you can see, the process is relatively simple. Linux aficionados know this stuff inside and out, but I’ve found that many of the people installing XenServer these days are Windows administrators looking for a cheap and powerful way to host their XenDesktop and other implementations, either in production or (more often, it seems) in a lab environment

If this write-up helped you, let me know in the comments below!

Please comment and discuss: