Drush 7.x-4.4 RPM for CentOS 5.6

I am updating the RPM for CentOS 5.6 to the latest stable build as of this writing which is Drush 7.x-4.4 .

Drush rpm for CentOS 5.5 (and probably others)

While looking at how to install drush for CentOS 5.5, I was amazed that there were no RPMs available. Luckily, someone did all the hard work and created a script to build the rpm here: http://www.workhabit.com/labs/drush-rpm-form

Using their script: http://www.workhabit.com/sites/default/files/rpm_build-drush.txt, which I am reproducing here:

view plain print about
1#!/usr/bin/perl
2# 20101012-1
3
4# This script packages Drush in binary .rpm form for easy installation. It
5# will automagically set up a proper environment for building RPMs in the
6# invoker's home directory. Note that the proper rpm building package
7# (rpm-build for RHEL or CentOS for example) must be installed. This script
8# also depends on basic utilities being available (tar, wget).
9#
10# Note that the resulting package has no actual dependencies; theoretically,
11# it should probably have dependencies on PHP. We're using non-standard PHP
12# packages and I'd like to make this script public, though. ;)
13#
14# Drush itself ends up in /usr/local/drush; a symlink for 'drush' is created
15# in /usr/bin. As per standard RPM building convention, this script should NOT
16# be run as the root user.
17#
18# Syntax is: rpm_build-drush (URL for drush version to package)
19#
20# Example: rpm_build-drush http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz
21
22### Global Variables
23# Change this to your organization/etc.
24my $packager = "Visible Systems Team";
25
26my $home = "$ENV{HOME}";
27my ($tarball, $version, $outrider);
28my @files;
29
30
31
32
33### Check for arguments
34if(@ARGV[0] eq "")
35{
36 print "Error: You must specify the URL of the drush package to download.\n";
37 exit 1;
38}
39
40
41
42
43### Grab pertinent version info
44# Get our actual package filename
45@ARGV[0] =~ m/(drush.+\.gz)$/;
46$tarball = $1;
47
48# Get our version
49$version = $tarball;
50$version =~ s/^drush-//;
51$version =~ s/\.tar\.gz$//;
52# - is invalid in RPM versioning; replace with _
53$version =~ s/-/_/g;
54
55
56
57
58### Set up our rpm building structure
59print "...Setting up build directories...\n";
60# Some of this is unnecessary given that we're creating a binary-only
61# package through unconventional means, but we might as well set up the
62# whole shebang.
63system("/bin/mkdir -p $home/rpmbuild/{BUILD,RPMS,S{OURCE,PEC,RPM}S}");
64# If .rpmmacros exists, back it up.
65if(-e "$home/.rpmmacros")
66{
67 system("cp $home/.rpmmacros $home/.rpmmacros.old");
68}
69system("echo -e \"\%_topdir\\t\$HOME/rpmbuild\" >
$home/.rpmmacros");
70if((system("mkdir -p /tmp/drush-$version/usr/local") >> 8) != 0)
71{
72 print "Error: Could not create temporary build root\n";
73 exit 2;
74}
75
76
77
78
79### Retrieve drush
80print "...Retrieving and unpacking drush...\n";
81# Retrieve
82if((system("wget -m -nd @ARGV[0] -P /tmp") >> 8) != 0)
83{
84 print "Error: Could not retrieve drush from @ARGV[0]\n";
85 exit 3;
86}
87# Unpackage
88if((system("tar -zxf /tmp/$tarball -C /tmp/drush-$version/usr/local/") >> 8) != 0)
89{
90 print "Error: Could not unpackage $tarball\n";
91 exit 4;
92}
93
94
95
96
97### Retrieve list of files included in the drush package
98@files = `find /tmp/drush-$version/usr/local/drush -type f`;
99
100
101
102
103### Write out our .spec file
104print "...Creating .spec file...\n";
105# Open the .spec file for writing
106open(SPEC, ">$home/rpmbuild/SPECS/drush-$version.spec") || die "Error: Could not open .spec file for writing.";
107print SPEC "Summary: drush\n";
108print SPEC "Name: drush\n";
109print SPEC "Version: $version\n";
110print SPEC "Release: 1\n";
111print SPEC "License: GPL v2\n";
112print SPEC "Vendor: http://drush.ws/about\n";
113print SPEC "Packager: $packager\n";
114print SPEC "Group: Development/Tools\n";
115print SPEC "BuildArch: noarch\n";
116print SPEC "BuildRoot: /tmp/drush-$version\n\n";
117print SPEC '%description' . "\n";
118print SPEC "drush - a command line shell and scripting interface for Drupal.\n\n";
119print SPEC '%prep' . "\n\n";
120print SPEC '%build' . "\n\n";
121print SPEC '%install' . "\n\n";
122print SPEC '%post' . "\n";
123print SPEC 'ln -s /usr/local/drush/drush /usr/bin/drush' . "\n\n";
124print SPEC '%postun' . "\n";
125print SPEC 'rm -f /usr/bin/drush' . "\n\n";
126print SPEC '%clean' . "\n\n";
127print SPEC '%files' . "\n";
128print SPEC '%defattr(-,root,root)' . "\n";
129# Now, drop our files in.
130for $outrider ( @files )
131{
132 $outrider =~ s/\/tmp\/drush-$version//;
133 print SPEC $outrider;
134}
135print SPEC "\n";
136print SPEC '%changelog' . "\n";
137close(SPEC);
138
139
140
141
142### Create our binary rpm.
143print "...Building binary RPM...\n";
144if((system("rpmbuild -bb $home/rpmbuild/SPECS/drush-$version.spec") >> 8) != 0)
145{
146 print "Error: Failed to create binary .rpm\n";
147 exit 5;
148}
149
150
151
152
153### Exit cleanly.
154print "\n\nBuild complete.\n";
155print "Your package should be available at $home/rpmbuild/RPMS/noarch/drush-$version-1.noarch.rpm\n\n";
156exit 0;

You will need perl and rpmbuild if you wish to build the packages:

view plain print about
1yum install perl rpm-build

Once you've got the right tools, you can build the latest ones from http://drupal.org/project/drush

view plain print about
1# perl rpm_build-drush.pl http://ftp.drupal.org/files/projects/drush-6.x-4.0-rc9.tar.gz
2...Setting up build directories...
3...Retrieving and unpacking drush...
4--2011-01-05 13:44:31-- http://ftp.drupal.org/files/projects/drush-6.x-4.0-rc9.tar.gz
5Resolving ftp.drupal.org... 140.211.166.134
6Connecting to ftp.drupal.org|140.211.166.134|:80... connected.
7HTTP request sent, awaiting response... 200 OK
8Length: 240870 (235K) [application/x-gzip]
9Server file no newer than local file `/tmp/drush-6.x-4.0-rc9.tar.gz' -- not retrieving.
10
11...Creating .spec file...
12...Building binary RPM...
13Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.56550
14+ umask 022
15+ cd /root/rpmbuild/BUILD
16+ exit 0
17Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.56550
18+ umask 022
19+ cd /root/rpmbuild/BUILD
20+ exit 0
21Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.56550
22+ umask 022
23+ cd /root/rpmbuild/BUILD
24+ /usr/lib/rpm/brp-compress
25+ /usr/lib/rpm/brp-strip
26+ /usr/lib/rpm/brp-strip-static-archive
27+ /usr/lib/rpm/brp-strip-comment-note
28Processing files: drush-6.x_4.0_rc9-1
29Requires(interp): /bin/sh /bin/sh
30Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
31Requires(post): /bin/sh
32Requires(postun): /bin/sh
33Requires: /usr/bin/env
34Checking for unpackaged file(s): /usr/lib/rpm/check-files /tmp/drush-6.x_4.0_rc9
35Wrote: /root/rpmbuild/RPMS/noarch/drush-6.x_4.0_rc9-1.noarch.rpm
36Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.38487
37+ umask 022
38+ cd /root/rpmbuild/BUILD
39+ exit 0
40
41
42Build complete.
43Your package should be available at /root/rpmbuild/RPMS/noarch/drush-6.x_4.0_rc9-1.noarch.rpm

Now we copy it to the current folder and install it

view plain print about
1cp /root/rpmbuild/RPMS/noarch/drush-6.x_4.0_rc9-1.noarch.rpm .
2yum --nogpgcheck localinstall drush-6.x_4.0_rc9-1.noarch.rpm

I built out the latest as of this writing 4.0 rpm, which is attached:
drush-6.x_4.0_rc9-1.noarch.rpm

CentOS 5.3 on XenServer 5.5 Graphical Install

In order to do a graphical install (which lets you customize your LVM volumes) you just need to add the vnc option to the "OS Boot Parameters" when creating the VM. It should look like this:

view plain print about
1graphical utf8 vnc

Once you start up your VM, it will go through a short text based configuration wizard, configuring your NIC and such, after which it will prompt you to log in using VNC.