Blog Post

Install and Use LESS on Dreamhost

I am working on a few websites and recently started using LESS CSS for creating my CSS. Anyways, I am using a Dreamhost shared server for not only my website, but other projects I am working on. Unfortunately with a shared server account, you don’t have access to sudo, so you can’t install applications. I got tired of editing my LESS files on the server, copying them locally or doing the git push and pull boogie, running a make file to build the css, and then pushing the css back to the server. I searched and searched for the answer and never found out. However, I did remember that I used to do a lot of Debian and Ubuntu packaging not all that long ago and figured I could just download all the files I need from the Ubuntu archive, extract them, and put them in their proper place. After doing all of this manually and testing it that everything worked just how I needed, I decided to write a script to do all the work. That way there I didn’t have to use this blog to provide step-by-step instructions.

Getting the script

You can either use git to grab the file or you can simply grab the script only.

With git:

git clone git://github.com/nixternal/dreamhost_less_compiler_install_script.git

If you grab the script from the above link, you will need to make it executable:

chmod +x dh_less_inst.sh

Running the script

Here comes the easy part:

./dh_less_inst.sh

What does the script do?

The script simply downloads the necessary packages from the Ubuntu archive, or a tarball if it isn’t in the archive. The following is a list of everything that gets downloaded and installed as well as where it gets placed: NOTE: $PREFIX defaults to ~/.local/usr

  • lesscss – git clone of the lesscss source. bin/lessc and lib/less moved to $PREFIX
  • libev – tarball configured, built, and installed to $PREFIX
  • node.js – deb file extracted. bin/node moved to $PREFIX
  • libc-ares, libssl, libicu, and libv8 – deb file extracted. lib/ moved to $PREFIX

What you need to add to make it work

You just need to add 2 lines to your shell’s rc file. In my case I added them to ~/.zshrc, but by default Dreamhost shared servers use ~/.bash_profile. Here are the 2 lines to add:

export PATH=$PATH:$HOME/.local/usr/bin
export LD_LIBRARY_PATH="$HOME/.local/usr/lib"

Source the edited file or log out and back in for everything to work.

Conclusion

If you have any problems, please leave a comment below.

This entry was posted in Development and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • Michiru

    I found this blog entry since I was also having the same issue, but have also found several discussions saying that running the node daemon is against TOS. This method would probably be frowned upon and get your site removed.

  • Subscribe to nixternal.com

     Subscribe in a reader

    Or, subscribe via email:
    Enter your email address:

  • Archives




semidetached
semidetached
semidetached
semidetached
%d bloggers like this: