Now with LaTeX! (Again)

One of the things I have really enjoyed about having my website on a MediaTemple server is the fact that I now have full root access (via SSH), which means I have more control over my own setup. The downside of this is that I’m still learning a lot of the basics of how to manage a server in this manner. This results in quite a few headaches from time to time, as I have to learn how to do ‘new’ things by doing them wrong about 100 times first. Don’t worry – I haven’t managed to actually break anything yet.

One of the features of Shamus Writes that I lost when I transferred from Bluehost to MediaTemple was the ability to insert LaTeX code into my blog posts. On Bluehost, I’d had to cobble together a ‘dirty’ solution, since they didn’t allow us root access on the shared servers to install software and weren’t willing to work with those of us who wanted it to install it for us. When I switched over to MediaTemple, I was more concerned with getting everything set up and learning how everything is put together here than I was with trying to figure out why LaTeX no longer worked.

Now, five months after the transfer, I was ready to tackle the issue again. In order to run to LaTeX on a server, though, you need four things installed: 1) LaTeX (duh); 2) ImageMagick, for managing the image files; 3) dvipng, for converting LaTeX’s dvi files into a usable PNG format; and, 4) Ghostscript. MediaTemple has ImageMagick, LaTeX, and dvipng installed on the server right out of the box. What puzzles me, though, is why they neglect to install Ghostscript (GS), when that is an essential part of any LaTeX installation.

Since GS clearly _wasn’t_ installed, however, I decided it was time to venture into the dark waters of installing the application on my server. The trouble I kept running into, though, was in getting the GS install package uploaded to the server in the first place. I knew it needed to be on the root somewhere, and my first approach was to try uploading the package via FTP – but nearly every location I tried refused the upload outright and the two or three directories that _would_ allow me to upload would then refuse me permission to run the configuration command. I tossed a couple of queries at MediaTemple’s (mt) tech guys trying to find out, first, if Ghostscript was installed (it wasn’t) and then, how I would go about installing it for myself. I’d already read through the Ghostscript documentation and found the installation instructions less than adequate, given my paltry knowledge of working in Unix. Unfortunately, the (mt) support guy wasn’t much more help, referring me back to the Ghostscript website to check their documentation.

It basically took me two days to finally find “a blog”:http://nicksergeant.com/blog/django/tutorial-installing-django-mt-media-temple-dv-35-server-modpython that described the process to install a completely _different_ application on an (mt) server. The article dropped the clue of going into the directory to which you would like to install and then downloading the install package directly to that directory. That was the piece I was missing, and from there it was pretty straightforward to run through the process of configuring and building GS and then installing the program.

I definitely learned a few things, both about using shell on an (mt) server and on installing applications on said server. And I have LaTeX working again, which is a nice bonus.

5 thoughts on “Now with LaTeX! (Again)”

  1. Hi, I’m hosting in MT also, and I want to know how to use imagemagick and ghostscript to preview pdfs on the fly with php?

    I’m a graphic designer with spme programming knowledge but I’m stuck here.

    Can u help me?

    Thanks

  2. Danilo, I’m really not sure. Do you have an application that would use ImageMagick and Ghostscript to create a PDF file? Or do you need to find one?

  3. Jim what I need to know is how to configure imagemagick and how to install ghostscript in my MT account to use it with php 5 to be able to run a script I have to make on the fly previews for PDF docs.

    Any clue?

    Thanx man

  4. re: Danilo – I just wrote up a post on “how to install Ghostscript on an (mt) server”:http://shamuswrites.com/2008/11/22/howto-install-ghostscript-on-mediatemple/ for you to look at. From there it should just be a matter of configuring your PDF script to know where to look for ImageMagick and Ghostscript to run it. Is the script something you wrote or found on the Internet, because there’s usually a set of install/configuration directions included with any package like that to help you get everything set up.

  5. re: Danilo – I should also ask: are you on a (gs) or a (dv) server? It makes a difference due to the level of accessibility to the root to install applications.

Have anything to add to the conversation?