Install Firefox in Linux - Tutorial

Discussion in 'Linux, BSD and Other OS's' started by Anti-Trend, Apr 18, 2005.

  1. Anti-Trend

    Anti-Trend Nonconformist Geek

    Likes Received:
    118
    Trophy Points:
    63
    A Tutorial: Howto Install Firefox in Linux

    I would normally recommend you install software through the software manager of the distribution of your choice. It's easier that way, just a few clicks, and any software you install will be updated regularly along with the rest of your OS. However, every now and again there will be a program which is not provided in your distro's software repository. In that case, you'll need to know how to install software in a logical, proper, and secure way. That being said, let's get to the tutorial.

    First, download a copy of the latest Firefox installer for Linux. The Firefox installer is compressed as a tar.gz archive, which is the most common format for compressed archives in Linux. We'll need to uncompress the archive before we can run the installer. We could do this graphically, using the 'ark' or 'fileroller' programs, but let's do it from the command line for simplicity's sake. Start a terminal. At the command prompt, type:
    Code:
    tar xzvf firefox-1.0.3-installer.tar.gz
    ...assuming of course that you downloaded it to the root directory of your home, and that the version you've downloaded happens to be 1.0.3. :) Since users in a Unix-like system can only write to their home directory by default, you will need root (administrator) privileges for the rest of this exercise. Get root access by typing:
    Code:
    su - root
    ...and entering your root password. Next, you will want a folder in which to keep your manually-installed applications. To me, "apps" makes sense for the folder name, so let's go with that. Type the following in the terminal:
    Code:
    mkdir /usr/local/apps
    Now, we'll want to install Firefox there. Change directories into the Firefox installer's folder, and run the installer by typing the following:
    Code:
    cd firefox-installer
    sh firefox-installer
    You'll be presented with a lovely installer GUI, in which you'll gleefully click 'next' until you come to the screen in which it's asking where you'd like it be installed. In that path, you'd make it:
    Code:
    /usr/local/apps/firefox-1.0.3
    ...assuming the version you're installing is 1.0.3 of course. Once the installation is complete, a new Firefox window will open. Success! Close the Window now without doing any surfing (you're still running it as root, remember?). Now we've installed Firefox to a place on the system which makes sense, and in which normal users can run firefox normally, save their settings, install extensions & skins, etc., yet cannot actually harm the Firefox program in any way. However, it's still not convenient for users to run Firefox at this stage; they'd have to type /usr/local/apps/firefox-1.0.3/firefox every time they wanted to run it. Not exactly efficient.

    Next, we'll concentrate on making Firefox easy to run and simple to upgrade. For that, you'll be introduced to symbolic links. Symbolic links are a pretty cool feature of Unix-like systems that makes things a lot easier on everybody. The gist is that you make a placeholder that points a file's true location to a more convenient location. This affords us the best of both worlds -- convenience and organization. First, for simplicity, we'll cd (change directory) to the apps directory:
    Code:
    cd /usr/local/apps
    Now we will make a link from firefox-1.0.3 to simply firefox:
    Code:
    ln -s firefox-1.0.3 firefox
    At this point, a user could execute Firefox by typing /usr/local/apps/firefox/firefox ...starting to get it? OK, well obviously nobody wants to type the full path every time, even thus shortened. So we're going to make yet another symbolic link:
    Code:
    ln -s /usr/local/apps/firefox/firefox /usr/local/bin/firefox
    Now there's a link to the Firefox executable in the folder /usr/local/bin/, which is called 'firefox'. Since /usr/local/bin is in the user's path, all a user has to do to execute Firefox now is type firefox, no matter which directory they're in! Simple?

    Mandrake / Mandriva-Specific Info:
    Now, you probably want a nice icon that represents Firefox so you don't have to type the command in the shell every time, even though we've made it a lot easier. This will vary a bit from distro to distro, but in Mandriva Linux you'd type (as root):
    Code:
    menudrake
    ...since you're running as root, you'll be prompted as to whether or not you want to edit the system-wide menu, or just the 'root' user's menu. Choose 'system'. Now, expand the 'Internet' section. Highlight 'Web Browsers'. Click 'Add Application', for the title type firefox and for the description, Firefox. Now for the pretty icon. Click on the button which says 'No Icon', and for the path choose 'Browse custom directory'. Browse to /usr/local/apps/firefox/icons/, and hit 'Open'. Choose mozicon50.xpm (aka the big one). Hit the 'Save' button. It'll take a second to rebuild the menu system. You're done, you can close out menudrake now and log out of your root account by typing exit a few times. If you want an icon on your desktop now, just open your menu and drag your freshly baked Firefox link right onto your desktop. There you go! :)


    Upgrading Firefox Later:
    Now, since you've got some symbolic links in place, all you have to do in order to upgrade Firefox to a new version is make a new folder for the updated version in /usr/local/apps/, just like you did for the first one (e.g. /usr/local/apps/firefox-1.0.4/). All we have to do is delete the symbolic link which links /usr/local/apps/firefox-1.0.3 --> /usr/local/apps/firefox, then make a link to the new version:
    Code:
    rm -rf /usr/local/apps/firefox
    ln -s /usr/local/apps/firefox-1.0.4 /usr/local/apps/firefox
    You don't have to remake any of your other links or icons, because your symbolic link, /usr/local/bin/firefox, points to /usr/local/apps/firefox/firefox, which hasn't changed at all. Also, by using the same procedure detailed above and simply making a few logical adaptations, you can do the same thing with Thunderbird and many other applications.

    -AT
     
    Matt555, Fred, Addis and 1 other person like this.
  2. ninja fetus

    ninja fetus I'm a thugged out gangsta

    Likes Received:
    65
    Trophy Points:
    48
    Very nice AT. I'd hook you up with some phatty points for that, but I gotta spread the word.
     
  3. Anti-Trend

    Anti-Trend Nonconformist Geek

    Likes Received:
    118
    Trophy Points:
    63
    The inception of Firefox into the official Mandrake/Mandriva software repository (and many other major distros) obsoletes this tutorial somewhat, at least for those users who's distro officially supports Firefox. I recommend that anyone running a distro which has an official way of installing Firefox (or indeed any software) do it that way. As I stated previously, that way is less cumbersome and Firefox will receive regular updates through your distro's package manager, just like the rest of the system. That being said, I'll leave this thread stickied because the concept still applies to many things, and not all distros have maintained binaries of Firefox.

    -AT
     
  4. ninja fetus

    ninja fetus I'm a thugged out gangsta

    Likes Received:
    65
    Trophy Points:
    48
    It may not be of full use under Mandrake/Mandriva but it helped me through some questions areas like the directory to install too
     
  5. fredjb

    fredjb Geek Trainee

    Likes Received:
    0
    Trophy Points:
    0
    Thanks, Anti-Trend for your: 'A Tutorial: Howto Install Firefox in Linux'

    I am trying to install Firefox 1.0.4 in Kubuntu 5.04. Following your tutorial, I got as far as:
    Code:
      'cd firefox-installer' OK, but when I tried: [code] 'sh firefox-installer', I got the reply: './firefox-installer-bin: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory'
    
    Can you please help? What have I done wrong?
    
    Best
    
    Fred
     
  6. Anti-Trend

    Anti-Trend Nonconformist Geek

    Likes Received:
    118
    Trophy Points:
    63
    Hey Fred.

    Sounds like you need to install libgtk in order for the installer to work. If you don't have them, you'll need the GCC libraries as well. In actuality though, you don't really need all that just to run Firefox. Instead of downloading the Firefox installer, try the compressed archive instead. Just extract the contents to /usr/local/apps/firefox-1.0.4/ (or wherever you're keeping it), set the privileges so that it is read-only to users, and run it once as root to generate the necessary files. If you need help with the specifics, just let me know.

    -AT
     
  7. fredjb

    fredjb Geek Trainee

    Likes Received:
    0
    Trophy Points:
    0
    Thanks, AT. As I'm a very new Linux-newbie, I'd be gratefulif you would 'help me with the specifics' in a step-by-step fashion.

    Thanks again

    Fred
     
  8. botanick

    botanick Geek Trainee

    Likes Received:
    0
    Trophy Points:
    0
    Hi AT,

    I just found your very helpful tutorial and followed the steps. Since I'm a newbie I decided to run Debian/Knoppix 3.8 from hd which contains Firefox 1.0.2 pre-installed and also a launch icon on the kde panel. To upgrade it to 1.0.4 I followed your instructions and had no problems until the last step: ln -s /usr/local/apps/firefox/firefox /usr/local/bin/firefox since I dont have a bin directory in /usr/local. Instead, I have a directory called sbin so I created the symbolic link there. Then as user I executed "firefox" command and - not surprisingly - the 1.0.2 version started. I assume I should first uninstall the old version (and probably make some other changes as well).

    Could you help me with a short tutorial how to do that?
    Thanx,
    botanick
     
  9. Anti-Trend

    Anti-Trend Nonconformist Geek

    Likes Received:
    118
    Trophy Points:
    63
    OK, what you're going to need to do is download the non-installer version of Firefox from a Mozilla.org mirror. Since Mozilla.org's FTP servers are distributed across many mirrors around the world, and since each mirror uses a slightly different layout, I can't give you a direct link to download the file; you'll have to browse the FTP mirror for it. But a typical path to find it would look something like this:

    ftp://ftp.mozilla.org/ --> pub --> mozilla.org --> firefox --> releases --> 1.0.4 --> linux-i686 --> en-US

    The current version of the file you're looking for as of this writing is called firefox-1.0.4.tar.gz, and is about as simple to install as the installer version (perhaps more so). The original tutorial posted above still applies for most of this procedure, so follow it up until it tells you the part which includes "cd firefox-installer" and "sh firefox-installer", which you will disregard. Instead, once you've extracted the contents of your firefox-1.0.4.tar.gz (by default it'll extract to a folder called 'firefox'), just change the ownership of that file to root and move that whole folder to the /usr/local/apps directory you've created. Accomplish this by typing the following commands (as root):
    Code:
    chown -R root:root firefox
    mv firefox /usr/local/apps/firefox-1.0.4
    ...assuming, of course, that you're situated in the same directory as the 'firefox' folder you've just extracted, and that the version you're installing is "1.0.4". Pick back up in the original tutorial on the part where it tells you "cd /usr/local/apps", and it should apply nicely from there on out.

    All the best,
    -AT
     
  10. Anti-Trend

    Anti-Trend Nonconformist Geek

    Likes Received:
    118
    Trophy Points:
    63
    Your /sbin folders are typically reserved for administrative-related functions which normal system users often don't have access to. In your case, I'd recommend substituting the path /usr/bin in place of /usr/local/bin. And you're right, it's probably best that you remove Firefox 1.0.2 before proceeding.

    All the best,
    -AT
     

Share This Page