Matt Woodward's posterous

Matt Woodward's posterous

Matthew Woodward  //  * CFML, Grails, and Java Developer
* Principal IT Specialist, US Senate
* Open BlueDragon Steering Committee Member
* All-Around Geek

Nov 27 / 9:59am

Cisco AnyConnect VPN Client vs. OpenConnect on 64-Bit Linux Mint 12

Last night I decided to replace my Ubuntu 11.10 installation on my System76 Serval Pro with Linux Mint 12. I've used Linux Mint on and off since version 9, and Linux Mint 10 and 11 were my full-time OSes until I ran into some lockup issues with Mint 11 on my System76 Lemur Ultra-Thin, at which point I decided to give Ubuntu 11.10 with Unity a real shot.

Not to get sidetracked on the real topic of this post, but Unity isn't nearly as bad as many make it out to be. After using it for a week I actually started to like it and found myself quite productive with it. That said, since I've also always loved Mint I figured I better kick the tires on their latest release which is now the most popular GNU/Linux distribution, having recently bumped Ubuntu from the top spot.

If you've seen all my previous posts on getting Cisco AnyConnect running on GNU/Linux you'll know that this is an ever-changing series of problems and fixes over the years, but with Ubuntu 11.10 and Cisco finally releasing a native 64-bit version of the AnyConnect client the steps were finally limited to simply install and launch.

For some reason that isn't the case with Linux Mint 12 and as in the past the fixes that worked previously don't seem to apply to Mint 12. Downloading and installing the client is the same as previously, and the installation works fine, but at least on my machine when I try to connect I get a different certificate-related error than I've received in the past and I haven't yet determined how to resolve it.

In the mean time, some folks commented on a previous post to try OpenConnect, which is an open source VPN client designed to work with Cisco hardware. I'd tried it in the past without success against my specific VPN server but since I wasn't having much luck with AnyConnect (and to be fair, I probably only fought with it for about 30 minutes so there may well be a solution--if you know what it is I'd love to hear it!) I decided to try OpenConnect again. (An aside: my apologies for not responding to comments to that post. Posterous is having notification issues and I haven't received comment notifications for a while.)

Installation of the client and the integration with the Mint network manager is easy enough:

sudo apt-get install openconnect network-manager-openconnect

After installation completes you go to Network Settings and configure your VPN connection, which basically just requires the host name of your VPN server. With that configured you can then click on the network connection icon on the top right of the screen and select your VPN connection from the VPN list, and in my case it connected fine.

I did try running OpenConnect from a terminal and even when starting with sudo (which you have to do in order for the tunnel to be created), I got the error "No --script argument provided; DNS and routing are not configured" so although it connected to the VPN server fine, I couldn't do anything once I was connected. Using the network manager piece resolved that issue for some reason. The issue with running from a terminal is probably just a configuration thing but using the network manager is more convenient anyway, so I didn't dig into that either.

So for now at least I'll be using OpenConnect instead of AnyConnect, though if/when I install Mint 12 on one of my other machines I may try to figure out what's wrong with AnyConnect to satisfy my curiosity if nothing else. For now I just had to get something working since tomorrow it's back to work after the Thanksgiving holiday.

If anyone has AnyConnect running on Mint 12 and has ideas of what to try I'd be very interested to hear how you got things running, and I'll do a follow-up post if I figure it out when I work on it on another machine.

Filed under  //  AnyConnect   GNU/Linux   LinuxMint   Ubuntu   VPN  
Oct 16 / 10:24am

How to Create a Custom Launcher in Unity on Ubuntu 11.10

One of the first things I always have to do after a fresh install of the latest Ubuntu (or whatever distro is striking my fancy at the time) is create some custom launchers for applications like Eclipse.

Prior to Unity this was done quite easily by editing the menus. In Ubuntu 11.04 with Unity this was no longer an option, so you could right-click on your desktop and select "Create Launcher" and then move the new launcher to ~/.local/share/applications, or there was also a method of creating a .desktop file manually that did the trick.

In Ubuntu 11.10 the right-click menu option for "Create Launcher" was removed (you can read more about why here), so we're really left with no easy way to create custom launchers. I consider myself a gearhead but even I didn't care for the "just launch the binary from the terminal" suggestion by some people in the bug thread.

So in my semi-obsessive reading about all of this last night I came across a metion of a package called alacarte that brings back the classic menu editing functionality we knew and loved back in the pre-Unity days.

Just install it:

sudo apt-get install alacarte

Then run it (alacarte from a terminal, or just hit super and search for alacarte), and you've gone retro with your menu editing.

One of the 10,000 things I love about free sofware--if there's an annoyance like this chances are someone else who's annoyed will fix it, or you can always jump in and fix it yourself. Clearly this wasn't something on which the Ubuntu developers were going to budge but the alacarte solution works extremely well.

Filed under  //  Free Software   GNU/Linux   Linux   Open Source   Ubuntu   Unity  
Oct 15 / 10:56pm

Installing Cisco AnyConnect on 64-Bit Ubuntu 11.10

Every six months for the past few years I've been posting how to install Cisco AnyConnect on the latest 64-bit releases of Ubuntu and for a couple of cycles Linux Mint since I was using that as my primary OS for a while.

This time around it's finally downright boring, which is a good thing. No more installing 32-bit libraries, creating symlinks to Firefox libraries, etc. etc. you just do the following:

  1. Hit your company's VPN server in a browser and log in with your user name and passcode
  2. Click the AnyConnect link on the left
  3. Click "Start AnyConnect"
  4. This will attempt to install AnyConnect via your browser's Java plugin. If this works, you're done! If this doesn't work (give it at least 60 seconds), read on.

In my case on the two machines on which I attempted this it didn't work. The browser-based install just hung even though I verified I have Java installed and the browser plugin is working.

If you don't have Java installed, however, the browser-based installation will detect that and give you a download link for the installer. So what I did was in Firefox I went to Edit -> Preferences -> Manage Add-Ons -> Plugins and I disabled the IcedTea-Web Plugin, which is the Java plugin that Firefox ships with.

I then restarted Firefox and repeated the steps above, only this time on step 4 it detected I didn't have Java installed and provided a link to the 64-bit installer. Download that file (vpnsetup.sh), chmod +x it, run it, and you're done.

I'm a little disappointed I didn't have to the usual dance on this, but it finally just works.

Filed under  //  AnyConnect   Cisco   GNU/Linux   Linux   Ubuntu   VPN  
Oct 15 / 10:45pm

Fix for Empathy AOL IM Login Issues on Ubuntu 11.10

I've installed Ubuntu 11.10 on my two System76 laptops (I have a Lemur and a Serval), and on both machines I noticed while I was configuring Empathy it wouldn't log into AOL IM successfully.

After verifying I wasn't fat-fingering my password I did some poking around and came across a post-install to-do list for Ubuntu 11.10 that fixed the issue for me. You can of course pick and choose which plugins to install, but I suspect just using the latest version did the trick. There were some on-again off-again bugs related to AIM and ICQ logins during 11.10 development.

Full details are in the linked blog post above, but here's the basics:

sudo add-apt-repository ppa:telepathy/ppa
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install empathy

With the new version the AIM login issue immediately went away.

 

Filed under  //  GNU/Linux   Linux   Ubuntu  
Oct 13 / 3:50pm

Manually Installing Java Plugin for Firefox on 64-Bit Ubuntu 11.10

Since I always forget how to do this I figured I'd blog it for my own purposes so I don't have to sift through Google every time.

This assumes you have the JDK installed under /opt/java/jdk1.6.0_27 -- adjust accordingly if you have things installed elsewhere or only have the JRE.

Open up a terminal and do this:

cd /usr/lib/mozilla/plugins
sudo ln -s /opt/java/jdk1.6.0_27/jre/lib/amd64/libnpjp2.so

Then restart Firefox if it's running.

Now to look into doing this for Chrome ...

Filed under  //  Firefox   GNU/Linux   Linux   Ubuntu  
May 28 / 4:18pm

Cisco AnyConnect VPN Client on 64-Bit LinuxMint 11

I've posted before about getting Cisco AnyConnect running on Ubuntu 9.10 and Ubuntu 10.04, but I've since started using LinuxMint as my daily driver and did a clean install of MInt 11 today. Mint is based on Ubuntu so on Mint 10 the previous strategy to get AnyConnect running worked fine, but I had to take a different approach after installing Mint 11. (I suspect it'll be the same issue on Ubuntu 11.04 but I haven't tried it.)

In doing a bit of research I came across this link that explains quite correctly that you don't need to actually download and extract Firefox to get this all working, which is what I had been doing previously. The Cisco client (for some stupid reason) expects certain things to be in a /usr/local/firefox directory but you can simply create that directory, download some other files, and then create the appropriate symlinks in /usr/local/firefox to make AnyConnect happy.

I also ran into some inexplicable weirdness related to a certificate file in my ~/.mozilla/firefox profile directory but I'll cover that as I outline the steps I took to get AnyConnect working.

Summary of Steps

Follow these and if you're lucky it'll work; if it doesn't read the information that follows for more details and troubleshooting ideas.

  1. Follow the steps in this blog post, which are as follows:
    1. sudo apt-get install ia32-libs lib32nss-mdns
    2. sudo mkdir /usr/local/firefox
    3. sudo ln -s /usr/lib32/libnss3.so /usr/local/firefox
    4. sudo ln -s /usr/lib32/libplc4.so /usr/local/firefox
    5. sudo ln -s /usr/lib32/libnspr4.so /usr/local/firefox
    6. sudo ln -s /usr/lib32/libsmime3.so /usr/local/firefox
    7. sudo ln -s /usr/lib32/nss/libsoftokn3.so /usr/local/firefox
  2. Download the AnyConnect installer from somewhere. The usual method of browsing to your VPN server and logging in may not work, so see below for details.
  3. Run the installer from the directory to which it was downloaded (sudo ./vpnsetup.sh). The daemon may fail to start at this point but don't worry if it doesn't.
  4. If the daemon failed to start, start the VPN daemon: sudo /etc/init.d/vpnagentd_init start
    1. You shouldn't get an error regarding /opt/cisco/vpn/bin/vpnagentd not being found at this point if you followed the above steps accurately. If you do, read on to see if any ideas come out of any of the subsequent discussion.
  5. Start the AnyConnect client. It should be in your Internet programs menu.
    1. If you get a "server certificate problem" error, stop Firefox and delete ~/.mozilla/firefox/YOUR_PROFILE.default/cert8.db where YOUR_PROFILE is whatever random string Firefox assigned your default profile (you should only have one directory with .default at the end of it in ~/.mozilla/firefox). In my case this problem didn't rear its head until after I rebooted, so you might want to reboot at the end of all of this to make sure everything's working.

If you're still getting errors read on for more info ...

Downloading AnyConnect

I ran into problems right out of the gate on Mint 11. On Mint 10 as well as previous versions of Ubuntu I could at least hit my VPN server in a browser, try to fire up the Java applet, and when that fails it prompts you to download, but this time around the "launching Java applet" screen on the VPN server just hung. I verified that Java is enabled in Firefox and tested with other applets so I'm not sure what the issue is there, particularly since this did work on my 32-bit machine with Mint 11.

So word of caution: you need to get the installer elsewhere, or at least I did. There may be a solution to this I haven't yet come up with so if you know what's up here, please be sure and comment.

Luckily I had the installer backed up from when I copied my home directory to an external hard drive prior to installing Mint 11, so I ran the installer from my home directory.

sudo ./vpnsetup.sh

This at least got the daemon installed for me, but it failed to start after installation (usually it starts fine after it's installed), throwing an error about /opt/cisco/vpn/bin/vpnagentd file not being found. The file's definitely there so I'm not sure what its problem is, but this gets resolved in the subsequent steps so you can ignore that error for now.

Install Necessary Libraries and Create Symlinks

See the above steps for details (all the steps under #1 above). In my case this resolved the file not found error the daemon was throwing when I tried to install AnyConnect prior to creating those symlinks. If you do that step first everything should work.

Launch the VPN Daemon

sudo /etc/init.d/vpnagentd_init start

If that throws errors doublecheck all the symlinks you created above. Note that in previous versions one of the things you were supposed to install and symlink to was sqlite3.so but that does not seem to be necessary.

Launch the AnyConnect Client

You should now be able to launch AnyConnect from your Internet programs menu. If you get a "server certificate problem" error, for me this seemed to be related to a certificate file in my Firefox profile.

How I came across this was after I rebooted and started Firefox on my 32-bit machine, since my home page is my Google Mail login, Firefox immediately threw a "Could not initialize the browser's security component" error. I found information on that error on Mozilla's site, so on GNU/Linux this means stopping Firefox and deleting the cert8.db file that's in your profile (~/.mozilla/firefox/YOUR_PROFILE.default).

On my 64-bit machine the behavior was slightly different. Everything seemed to work with AnyConnect until I rebooted, at which point it threw the server certificate error. I then launched Firefox and it popped up a completely blank alert window, but when I closed that window and Firefox finished loading, I noticed I couldn't browse to any sites. No matter what I put in the location box the top of the Firefox UI was completely unresponsive.

Since I'd happened to have the security component issue on my 32-bit machine, I figured even though on the 64-bit machine it wasn't actually showing me the error, that might be the problem. Sure enough when I deleted the cert8.db file Firefox then began to work, as did the AnyConnect client. I rebooted to make sure it wasn't a fluke and thus far everything is working.

Remaining Issues

At this point the only remaining issue is that for some reason when I connect to the VPN, AnyConnect doesn't minimize itself into that little "stacked blue balls" icon thingee over near the clock. It just minimizes itself and shows up in your task bar like any other program. Minor annoyance but it does behave correctly on my 32-bit machine so I'm not sure what's going on there.

Hope that helps some others who are trying to get this running!

Filed under  //  AnyConnect   GNU/Linux   LinuxMint   Ubuntu   VPN  
Apr 17 / 12:43pm

Accessing and Restarting Desktop CouchDB on Ubuntu/Mint

Recent versions of Ubuntu (and Ubuntu-based distros like LinuxMint) ship with Desktop CouchDB to interact with Ubuntu One and store things like replicated bookmarks in Firefox, contacts in Evolution, and some other data.

If you want to access Futon (CouchDB's web-based admin tool) for this instance of CouchDB you need to do a bit of hunting, but I found this page on freedesktop.org that was very helpful, and I thought I'd document here as well in case I forget this information in the future (which I'm sure I will!).

Accessing Futon

Open a terminal and navigate to ~/.local/share/desktop-couch and open couchdb.html in a browser (e.g. firefox couchdb.html), or navigate to file:///.local/share/desktop-couch/couchdb.html in your browser. This takes you to a page that will redirect you to Futon after a few seconds, at which point you can see which port CouchDB is running on and what the admin user name is.

If CouchDB Desktop Isn't Running

In my case CouchDB Desktop wasn't running for some reason so I had to follow these steps to get it going again:

  1. Open a terminal and do killall beam.smp and then killall beam (do this as your user, not as root or using sudo). I got 'no process found' errors in both cases but this will make sure all CouchDB Desktop processes have been killed.
  2. Again in a terminal, do rm ~/.config/desktop-couch/desktop-couch.ini
  3. Still in your trusty terminal, do dbus-send --session --dest=org.desktopcouch.CouchDB --print-reply --type=method_call / org.desktopcouch.CouchDB.getPort
    This will restart CouchDB and tell you what port it's running on.
  4. Open the couchdb.html file referenced above and you should be redirected to Futon
Filed under  //  CouchDB   GNU/Linux   LinuxMint   Ubuntu  
Oct 18 / 6:38pm

Fix for Eclipse Menu Issues in Ubuntu 10.10 Netbook Edition

This is but one of the many,many reasons I love free software.

In my previous post about Ubuntu 10.10 Netbook Edition I pointed out there are some issues with the menus in some applications, which in my case I ran into with Eclipse (actually SpringSource Tool Suite). I posted to the Ubuntu Forums and in no time a kind user pointed me to this bug report (which I somehow missed in my searches before posting to the forums), and also provided the fix for the issue which is simple enough. Basically you just have to tell Ubuntu not to use its own menus when you start the application, so from a terminal you do this to start the app:

UBUNTU_MENUPROXY= /home/mwoodward/sts/STS

Note that there is a space after the equals sign. Of course if you're having this issue with another application you'd just substitute the path to that application where I have /home/mwoodward/sts/STS And you can obviously throw this into a launcher script so you don't have to remember to type this every time.

I was also having problems with the menus on UltraEdit so I was happy to see this fix resolved those issues as well. With a workaround for this issue I now give the Unity interface a grade of a nice solid B as opposed to the C I gave it in my previous post. There are still some quirks here and there but at least now I can use STS without any issue.

I'm always amazed, yet never surprised, at the excellent support available from the community of free software projects. With commercial software you pay for support, and in my experience it isn't very good as a rule, but with free software you have legions of users at the ready to help other users, and you can also pay for commercial support if you so need or desire.

What's not to love?

Filed under  //  Eclipse   GNU/Linux   Java   Linux   Ubuntu  
Oct 17 / 3:44pm

Thoughts on Ubuntu 10.10 Netbook Edition

This isn't intended to be a full-blown review since there are plenty of those out there, but while I was installing Ubuntu 10.10 Netbook Edition on my Asus 1000HE this weekend, I thought I'd jot down my basic thoughts.

Installation

A+++. Absolutely amazing. 25 years later Windows still doesn't even come close to having such a fantastic installation process. Fast, clean, and flawless. Couldn't ask for anything better.

Boot Time

Notably faster than 10.04 on my netbook. My main laptop has a solid state drive and already boots up in about 7 seconds with 10.04, so I can't wait to see if 10.10 makes a difference on that machine.

Ubuntu Font

Ubuntu ships with a new default font called (not surprisingly) Ubuntu. It took some getting used to at first, but I like it! Very readable and easy on the eyes, not to mention Ubuntu-sheik styling.

Unity Interface

I have to give Unity about a C for the time being. The idea of it is awesome, but there are a lot of idiosyncrasies and display issues.

For example, Eclipse flat-out doesn't work because the entire top menu bar in Eclipse doesn't appear. There are also many applications (UltraEdit being one example) on which there are too many menu items across the top for the Unity interface to handle correctly, so they spill over into the notification icons on the right-hand side of the screen. (See screenshots for some examples.)

It's not so bad that I'm going to uninstall 10.10, but I really hope they address the issues soon. If I had to use Eclipse on a regular basis on my netbook I'd simply have to move over to Crunchbang or Easy Peasy, or back to Ubuntu 10.04 which ran Eclipse just fine.

Unity also seems just a bit sluggish on my 1000HE. Not to the point where it's irritating to use, and a VAST improvement over some of the release candidates. I was using RC1 a few weeks ago and the entire machine was horrendously slow, so if you tried an RC and were turned off by the performance, rest assured they fixed that issue for the most part. Seems just a bit more slow than 10.04 when doing certain things, but overall the performance is acceptable.

Software Center

Huge success here. Software Center got a major upgrade both visually and in terms of functionality. I still do most of my installs in a terminal, but Software Center is a real treat to use. Search and categorization is better and when installing a .deb, there's a very nice progress bar and clear notification of when the install is complete. It's a lot more easy to use and clear, particularly for less technical users.

Other Random Thoughts

  • 10.10 is a bit more locked down than 10.04 was in terms of customization. If you like doing a lot of customization to your desktop, menu items, etc. this probably isn't the distro for you. Adding a launcher for programs you install yourself, for example, simply isn't possible from what I've seen because you can't customize the launcher directly, and not all programs support the "Keep in launcher" option when you right-click in the launcher after starting the program from a terminal. This isn't really a criticism per se since if all you want to do is surf the web and read your email 10.10 is fantastic for that, but if you're more of a hacker with your machines, look elsewhere.
  • Ubuntu One got some really nice new features that I haven't had time to dig into just yet. Definitely notice fewer random "your login failed" type issues so they've clearly been focusing a lot of attention here.
  • The Ubuntu One music store is really awesome. I still have to jump over to Amazon.com's MP3 store for some things that Ubuntu One doesn't have, but overall it's really nice and incredibly usable.
  • The social features in 10.10 seem about the same to me as on 10.04, with maybe just a bit more polish. Note that if you rely on using Gwibber for interfacing with Facebook (which I don't), there is a bug that is preventing a lot of people (myself included) from being able to successfully add their Facebook accounts to Gwibber. Facebook *chat* works fine in Empathy, but Gwibber has issues.
Overall this is another great release from Ubuntu. If any of the annoyances I'm outlining here are dealbreakers, just stick with what you have for now. The new features are nice, and I like upgrading every six months to have the latest and greatest, but I'm not sure this is a "must have" upgrade. To be fair the .10 releases aren't really supposed to be "must have" since they don't have long term support (LTS) like the .04 releases, but there's enough here to warrant an upgrade if you're not put off by a couple of glitches here and there.

Will I upgrade my main laptop with Ubuntu 10.10 desktop? Still debating on that one. Short answer is "probably" since I doubt I'll run into the display issues with Eclipse, and my main laptop is in need of a scrubbing anyway. And if I can brag to all my friends that my laptop boots up in 5 seconds instead of 7, all the better.

(download)

Filed under  //  Free Software   GNU/Linux   Linux   Netbook   Open Source   Ubuntu  
Oct 16 / 9:13pm

HOWTO: Setting Up a New Ubuntu GNU/Linux Box for Java/CFML Development

Since I wind up doing this every six months with each new release of Ubuntu, I thought this time around I'd document how I set up an Ubuntu GNU/Linux box for Java and CFML development. This is partly so I don't scratch my head thinking "was there anything else?" next time, but mostly for people who want to dive into GNU/Linux from another platform and need a quick step-by-step guide to help them get productive quickly.

Note that if you're setting up an Ubuntu server, the server-related stuff that follows (Apache, Tomcat, and MySQL) will be pretty much the same on a server as it is on a dev machine with a couple of differences. First, you'll want to have Tomcat autostart at boot on a server (which I don't do on my dev machine). Second, and this is a matter of personal preference, I tend to put Tomcat in my home directory on my dev box, but in /opt on the server.

So open up a terminal and let's the the easy apt-get stuff out of the way first.

INSTALL APACHE

sudo apt-get install apache2

INSTALL MYSQL

sudo apt-get install mysql-server mysql-client
 

INSTALL VIM & EMACS

sudo apt-get install vim emacs

You can also install Java and Tomcat via apt-get, but I prefer to download these items directly from their respective sources. We'll start with Java.

DOWNLOAD/INSTALL JAVA

  1. Open a browser and go to http://java.sun.com (sorry Oracle, I'm not using your URL until you turn this one off!)
  2. Mouse over "Downloads" and click on "Java for Developers"
  3. Scroll down a bit on the next page and click on the "Download JDK" button (you'll want the full JDK, not just the JRE)
  4. On the next page, click on the Platform button and choose either "Linux" (32-bit) or "Linux x64" (64-bit) as appropriate for your machine. Then scroll down and hit the "Continue" button.
  5. Under "Available Files" on the next page, click on the .bin file, not the .rpm.bin file.
  6. After the download completes (and I'm assuming you downloaded to your Downloads directory), open a terminal and do the following, hitting enter after every line (note the file name may be different based on the version you download):
    cd ~/Downloads
    chmod +x jdk-6u22-linux-i586.bin
    ./jdk-6u22-linux-i586.bin
  7. You'll see all the files extract, and you'll wind up with a jdk1.6.0_22 directory (or perhaps something different based on the version you downloaded). Personally I like to have Java in my /opt directory, so if you want to follow suit, type the following in your terminal (again hitting enter after each line):
    sudo mkdir /opt/java
    sudo mv jdk1.6.0_22 /opt/java

ADD JAVA ENVIRONMENT VARIABLES TO .bashrc

With Java in place, I like to set a couple of variables in .bashrc to make Java and Java applications a bit easier to work with. Navigate to your home directory (cd ~/) and open up .bashrc in vi or your favorite editor. Note that if you're new to GNU/Linux, the . before the file means it's hidden, so you won't see it in a plain old ls, but of course ls -a will show it.

With .bashrc open, scroll down to below the HISTSIZE and HISTFILESIZE lines (at least that's where I put this stuff), and you're going to add the following lines:

PATH=${PATH}:/opt/java/jdk1.6.0_22/bin
 export PATH
JAVA_HOME=/opt/java/jdk1.6.0_22
export JAVA_HOME

Save the file, and then you'll have to log out of your terminal and log back in for these settings to take effect. Type exit and then hit enter to close your terminal, and then re-open the terminal. To make sure your settings took, type the following in your terminal, hitting enter after each line:

echo $PATH
echo $JAVA_HOME

You should see the Java directory included in your path, as well as see it for the value of JAVA_HOME.

Note that by editing .bashrc the changes only affect your user. If you want these settings available to all users, you'll be editing /etc/profile instead.

DOWNLOAD/INSTALL TOMCAT

With Java in place, let's grab Tomcat. You can of course substitute a different JEE server or servlet container if you're so inclined, but if you do you're on your own for the setup. ;-)

  1. Go to http://tomcat.apache.org in your browser.
  2. On the left-hand side under "Download" click on the latest version, which is currently Tomcat 7. (Note that Tomcat 7 is still technically in beta if you care about such things.)
  3. On the download page, scroll down a bit and under "Core" click on the .tar.gz link.
  4. After the file downloads (again assuming you have downloads go to your Downloads directory), in your terminal do the following (hit enter after each line):
    cd ~/Downloads
    tar -xvf apache-tomcat-7.0.2.tar.gz
  5. You'll see the files extract, and at the end of that process you'll have an apache-tomcat-7.0.2 directory in your Downloads directory. I prefer to have that in my home directory on my dev boxes, so type this in your terminal and hit enter (assuming you're still in your Downloads directory):
    mv apache-tomcat-7.0.2 ../
  6. Next to make Tomcat a bit easer to access, we'll add a symlink called tomcat that points to the real Tomcat directory. More terminal stuff:
    cd ../
    ln -s apache-tomcat-7.0.2 tomcat
With all that in place you can now access the Tomcat directory structure via ~/tomcat which I find pretty handy.

CONFIGURE TOMCAT

Next we need to configure Tomcat a bit, so in your favorite text editor, create a setenv.sh file in Tomcat's bin directory. If you want to do this in your terminal with vi, type the following:

cd ~/tomcat/bin
vi setenv.sh

What we'll be adding to this file is some settings that Tomcat will use when it starts up. Depending on your machine and/or preferences you may want to adjust the memory settings, but if you aren't sure what this stuff does, these are decent generic settings and you can always change them later.

Add these two lines to setenv.sh and then save the file:

export JAVA_HOME=/opt/java/jdk1.6.0_22
export CATALINA_OPTS="-Xms512m -Xmx1024m -XX:MaxPermSize=384m"

Again if you know what you're doing here, feel free to change your memory settings accordingly.

You should now be able to fire up Tomcat without any errors, so navigate to ~/tomcat/bin in your terminal and type ./startup.sh

You'll see a few lines spit out to the terminal, and if you don't see errors, open up a browser and go to http://localhost:8080 If you see the Tomcat welcome screen you're good to go.

Note that I won't be covering additional Tomcat configuration here, particularly hooking it into Apache, because there are a ton of other howtos and blog posts about that very topic. If you have specific questions in this area I'm happy to help, so comment below and I'll either comment or write another blog post as necessary.

ADDITIONAL CONFIGURATION

There's one additional bit of configuration I tend to do because particularly on a dev box, you'll run into a problem with this sooner or later if you abuse your machine like I do.

In a terminal (you and your terminal are friends by now, right?), or using your favorite text editor, you're going to edit /etc/security/limits.conf to increase the maximum number of files your user can have open. Open that file and add the following lines to the bottom of the file:

yourusername soft nofile 10000
yourusername hard nofile 10000

DOWNLOAD AND INSTALL SPRINGSOURCE TOOL SUITE/ECLIPSE

Unless you already have a favorite Java IDE, much as it's not in fashion to say so I'm a big fan of Eclipse. I personally have been using SpringSource Tool Suite (STS) for quite a while now, and it's a great Eclipse-based IDE for Java, Groovy, Grails, and of course CFML development once you throw in CFEclipse.

After downloading the Eclipse or STS of your choice, extract the files and then move them to your home directory (at least that's where I put them). This should be old hat by now--in your terminal do:

 cd ~/Downloads
tar -xvf NAME_OF_FILE_HERE.tar.gz
mv NAME_OF_EXTRACTED_DIRECTORY_HERE ../

STS has a bit of a different directory structure since it comes with tcServer and Roo, so you'll actually go into the directory and be moving the STS directory into your home directory. Since it has a long name like springsource-tool-suite-sts-2.3.2-RELEASE or something like that, I tend to move and rename to something shorter, e.g.:

mv LONG_DIRECTORY_NAME_HERE ~/sts

Once things are moved, you can go into the directory that you moved to your home directory (which will be either sts or eclipse most likely), and then type either ./STS or ./eclipse to launch the program.

ADD LAUNCHER FOR STS/ECLIPSE

Although you can certainly start STS or Eclipse from the terminal if you like, most people tend to like to have a pretty button to click on to launch the program. The bad news is you have to add this yourself. The good news is it's very easy.

  1. Right click on the Ubuntu logo in the top left of the screen, and click on "Edit Menus."
  2. Click on "Programming," and then click on "New Item" on the right-hand side of the window.
  3. Leave the type drop-down set to "Application"
  4. For "Name" type whatever you want the name to be (e.g. Eclipse, SpringSource Tool Suite, whatever)
  5. For "Command" you need to tell the launcher not only where the executable is, but also where to find Java. So assuming your executable is ~/eclipse/eclipse you'd enter the following in the Command box:
    /home/yourusername/eclipse/eclipse -vm /opt/java/jdk1.6.0_22/bin
  6. You can leave the "Comment" box blank, but if you enter something here it's what will show up when you mouse over the icon for the application.
  7. Click on the "spring"-looking icon in the left-hand side of the Create Launcher box and you can choose an icon. Note that they're kind of in a weird format. STS comes with its own icon so you can navigate to the STS directory and select the icon.xpm file. If you're using Eclipse you can search for 'eclipse icon launcher ubuntu' on the interwebs and find stuff you can use.
  8. Click OK and your launcher will be added to the Programming menu when you click on Applications in the top left of the screen.
INSTALL CFECLIPSE

If you're a CFML developer you likely already know how to install CFEclipse and since Eclipse is Java based it's the same on every platform. If you're not familiar with installing CFEclipse, head on over to the web site and you'll find great instructions.

That's pretty much it! You're now a hard-core Java/CFML developer on GNU/Linux, other than all that pesky Tomcat/Apache configuration of course. As I said earlier if you need help with that, comment below and I'll do my best.

Enjoy!

Filed under  //  CFML   GNU/Linux   Java   Linux   Open BlueDragon   Railo   Ubuntu