Chinaunix首页 | 论坛 | 博客
  • 博客访问: 107409
  • 博文数量: 57
  • 博客积分: 1200
  • 博客等级: 中尉
  • 技术积分: 555
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-26 21:13
文章分类

全部博文(57)

文章存档

2012年(14)

2011年(43)

分类: C/C++

2012-03-28 09:10:16

joe maller.com
How to install Subversion on a shared host

I’ve hosted this site and several others LiquidWeb’s shared servers for probably eight years. They are without question, the most dependable host I’ve ever used. [see update]

But LiquidWeb doesn’t offer Subversion. And I will no longer do web work without it.

For some time I’d been considering leaving LiquidWeb because the lack of svn was now hindering work on my own sites. For the same reason, I’ve had to pass them over several times when clients asked for hosting recommendations. Then the other night, I stumbled across a discussion about installing Subversion on a shared host. Why didn’t I try that years ago?

Installation Instructions

These instructions assume basic proficiency with the Unix command line. Note that the goal is to install the SVN client, plan on hosting your repositories somewhere else.

Connect to your account with ssh and create a working directory, mine’s called _src:

cd mkdir _src cd _src

Next, use wget to pull down the subversion sources. You could also use curl, but wget does the same with less typing. Choose a version from this list of Subversion sources. The parallel “subversion-deps” download includes all dependent sources required to build Subversion.


点击(此处)折叠或打开

  1. wget http://subversion.tigris.org/downloads/subversion-1.4.6.tar.gz
  2. wget http://subversion.tigris.org/downloads/subversion-deps-1.4.6.tar.gz

Next, untar the sources and dive into the directory:

tar -xzvf subversion-1.4.6.tar.gz tar -xzvf subversion-deps-1.4.6.tar.gz cd subversion-1.4.6One step, maybe (32-bit?)

At this point, depending on your server configuration, you might be able to install with the following two commands:

./configure --prefix=$HOME --without-berkeley-db \
 --with-ssl --with-editor=/usr/bin/vim \ 
--without-apxs --without-apache
 make && make install

That worked on some servers but not others, I spent many hours clumsily trying to figure out why. I found that the build process was linking to external libraries instead of the ones in subversion-deps, despite the configure directives.

On the 64-bit server (x86_64) this was a big problem, even though everything worked normally on two 32-bit (i686/i386) servers. Check server architecture with either arch, uname -a or cat /proc/cpuinfo. The solution for 64-bit machines is to build the three main components beforehand and then tell Subversion where to find them.

Build them, use them (64-bit?)

The following commands systematically build each of the three shared libraries from the Subversion-deps sources. This should guarantee that the files Subversion links to will be compatible. In each step, we explicitly enable compilation of shared libraries and prefix the files into our home directory. This looks worse than it is.

Build apr, apr-util and neon, in that order:

cd apr ./configure --enable-shared --prefix=$HOME 
make && make install 

 cd ../apr-util ./configure --enable-shared --prefix=$HOME \ 
--with-expat=builtin --with-apr=$HOME \ 
--without-berkeley-db 
make && make install 

 cd ../neon ./configure --enable-shared --prefix=$HOME \ 
--with-libs=$HOME --with-ssl 
make && make install

With those out of the way, we can now configure and build Subversion. According to the notes in Subversion’s configure file, the --with-ssl flag is not necessary since it’s just passed to neon and we already built neon. --without-apxs and --without-apache prevent Subversion from trying to install its Apache modules. Remember to point to the libraries we just built (in $HOME): (note: you may need to add the --without-serf flag as well, see this comment)

cd ../ ./configure --prefix=$HOME --without-berkeley-db \ 
--with-editor=/usr/bin/vim --with-apr=$HOME \ 
--with-apr-util=$HOME --with-neon=$HOME \ 
--without-apxs --without-apache 
make && make install

Subversion should now be installed! It’s likely you already have :~/bin in your user $PATH, if so, you can try it out right away:

svn --version svn, version 1.4.6 (r28521) compiled Jan 29 2008, 11:05:47

So far, I’ve run this against two LiquidWeb shared accounts, one LiquidWeb CPanel container on a VPS and a HostingMatters shared account running JailShell. After some limited testing accessing different repositories with https and svn+ssh, everything seems to be working.

Now I just need to figure out where to put my repositories, here are some free Subversion hosts I’ve used or are considering:

Two other sites which aren’t free, but I’m keeping in mind for the future: Wush and Project Locker.

The getting there was the hardest part

While I was finally able to streamline this down to a fairly simple process, it was not easy to get there. I don’t do much compiling from source, so I’m very clumsy about troubleshooting. If any of these steps can be simplified, please leave a note.

Here are some of the errors I saw along the way: /usr/lib/libexpat.so: could not read symbols: File in wrong format /usr/lib/libexpat.so: could not read symbols: Invalid operation /home/joe/_src/subversion-1.4.6/neon/src/.libs/libneon.a: could not read symbols: Bad value

The first two errors indicate that the build had grabbed the 32-bit libexpat from /usr/lib instead of the 64-bit version from /usr/lib64. However, redirecting to the 64-bit libraries introduced other problems such as the libneon.a bad value error. As mentioned above, what I needed to do was pull libraries from the subverson-deps code. To use those, I needed to compile each one first.

Resources:

Related: How to install Git on a shared host

Update, November 2010: Sometime this year Liquid Web disallowed compiler access. I now host my sites at WebFaction and A2 Hosting.

阅读(3132) | 评论(0) | 转发(0) |
0

上一篇:转:google mock C++单元测试框架

下一篇:没有了

给主人留下些什么吧!~~