RE: /etc/alternatives

From: Ryan Golhar (golharam_at_umdnj.edu)
Date: 08/31/04

  • Next message: dbrett: "recovering from stupidity tar"
    To: "'Wayne Pinette'" <Wpinette@cariboo.bc.ca>, <redhat-list@redhat.com>, <stuart@sjsears.com>
    Date: Mon, 30 Aug 2004 23:18:29 -0400
    
    

    I just going to delete /usr/bin/java, /usr/bin/javac, and /usr/bin/jar.

    The default installation of Sun's Java SDK will be picked up in the PATH
    in /usr/java/j2sdk...

    Thanks for your help...

    Ryan

    -----Original Message-----
    From: Wayne Pinette [mailto:Wpinette@cariboo.bc.ca]
    Sent: Monday, August 30, 2004 3:51 PM
    To: redhat-list@redhat.com; stuart@sjsears.com; golharam@umdnj.edu
    Subject: RE: /etc/alternatives

    Well, quite frankly, Im still old school. I always soft link java,
    javac etc to /usr/local/java/bin .. directory, and my /usr/local/java
    directory is always softlinked to what ever latest and greatest version
    of java I just installed. In short, I bypass alternatives. You may
    want to try something like that.

    Wayner

    >>> Ryan Golhar <golharam@umdnj.edu> 30/08/2004 12:00:42 pm >>>
    Thanks for the info. So, I'm trying to set java (in
    /usr/java/j2sdk1.4.2_04/bin/java) to be the default generic java that
    gets run. I tried

    /usr/sbin/alternatives --set java /usr/java/j2sdk1.4.2_04/bin/java

    But received the error

    /usr/java/j2sdk1.4.2_04/bin/java has not been configured as an
    alternative for java

    So, I tried installing it using

    /usr/sbin/alternatives --install java java
    /usr/java/j2sdk1.4.2_04/bin/java 200

    But that's not working, and I'm not sure what the problem is. (I also
    must admit I'm not spending enough time trying to figure it out). Do
    you know how I can get Sun's java from their JDK working again?
    Thanks,

    Ryan

    -----Original Message-----
    From: Stuart Sears [mailto:stuart@sjsears.com]
    Sent: Wednesday, August 11, 2004 2:56 AM
    To: golharam@umdnj.edu; General Red Hat Linux discussion list
    Subject: Re: /etc/alternatives

    On Wednesday 11 August 2004 04:05, Ryan Golhar wrote:
    > I installed the java SDK RPM from java.sun.com.
    >
    > Recently, however, I noticed that /usr/bin/java, /usr/bin/javac, and

    > /usr/bin/jar point to scripts in /etc/alternatives.
    >
    > I figured out that these replacements are from libgcj. It doesn't
    > look like I can until this other RPM as there are others that depend

    > on it. My question is why do they replace a legitimate program (java)

    > with a script that doesn't do anything. That just seems to break
    > everything. I remove the link so the real java program is picked up
    > correctly. Does anyone know what this is for and why its done?
    the alternatives system is there to allow you to install several
    services/packages that provide the same functionailty ( and very often
    the
    same program names) and switch between them without uninstalling either.
    Its most common use is to switch between sendmail and postfix, but links
    can
    be set up to cater for any package at all.
    How does it work?
    okay, the postfix/sendmail example:
    many programs look for a 'sendmail' binary when they want to, well, send
    mail. unfortunately both the sendmail and postfix packages normally
    provide a
    binary of this name, which means that if you want to switch from
    sendmail to
    postfix you would normally have to uninstall sendmail and then install

    postfix instead, which will involve at the very least a certain amount
    of
    downtime. On a Redhat system, these packages have been 'hacked' to
    provide
    sendmail.sendmail / sendmail.postfix (among other) binaries, so that
    this
    problem no longer exists, but how do apps know which one to call? a
    series of symbolic links are set up: /usr/sbin/sendmail ->
    /etc/alternatives/mta -> /usr/sbin/sendmail.postfix why three links
    instead of two? well, the other programs with clashing names also have
    to be dealt with, This
    is done using a series of 'slave' links which are automtically switched
    over
    when you change the master 'mta' link.
    try the alternatives command:
    [root@behemoth root]# alternatives --display mta
    mta - status is manual.
     link currently points to /usr/sbin/sendmail.postfix
    /usr/sbin/sendmail.sendmail - priority 90 slave mta-pam:
    /etc/pam.d/smtp.sendmail slave mta-mailq: /usr/bin/mailq.sendmail slave
    mta-newaliases: /usr/bin/newaliases.sendmail slave mta-rmail:
    /usr/bin/rmail.sendmail slave mta-rsmtp: (null) slave mta-runq:
    (null)
    slave mta-sendmail: /usr/lib/sendmail.sendmail slave mta-mailqman:
    /usr/share/man/man1/mailq.sendmail.1.gz
     slave mta-newaliasesman: /usr/share/man/man1/newaliases.sendmail.1.gz
     slave mta-aliasesman: /usr/share/man/man5/aliases.sendmail.5.gz
     slave mta-sendmailman: /usr/share/man/man8/sendmail.sendmail.8.gz
    /usr/sbin/sendmail.postfix - priority 30
     slave mta-pam: /etc/pam.d/smtp.postfix
     slave mta-mailq: /usr/bin/mailq.postfix
     slave mta-newaliases: /usr/bin/newaliases.postfix
     slave mta-rmail: /usr/bin/rmail.postfix
     slave mta-rsmtp: (null)
     slave mta-runq: (null)
     slave mta-sendmail: (null)
     slave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
     slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
     slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
     slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
    Current `best' version is /usr/sbin/sendmail.sendmail.

    you switch between the two systems with
    alternatives --set mta /usr/sbin/sendmail.sendmail
    (or postfix or any other that you have set up this way)
    or by using
    redhat-switch-mail
    wich will change the master link and the slaves will follow along like
    sheep.

    any help?
    ps if you want to know the command that set these things up, look at the

    install scripts for sendmail

    rpm -qp --scripts sendmail

    HTH

    -- 
    Stuart Sears RHCE, RHCX
    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe 
    https://www.redhat.com/mailman/listinfo/redhat-list
    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: dbrett: "recovering from stupidity tar"

    Relevant Pages

    • Re: [opensuse] How to monitor Linux systems from a focal/central point (was: ranting and raving abo
      ... I'm perfectly well aware of how to set up Postfix, and, for my sins, ... workstation ran Postfix, exim, sendmail or other such MTA. ... this is solely regarding the case of a minimal install on a resource-limited ... client machine that has absolutely no need for an MTA to be installed. ...
      (SuSE)
    • RE: /etc/alternatives
      ... I always soft link java, ... many programs look for a 'sendmail' binary when they want to, well, ... unfortunately both the sendmail and postfix packages normally ... postfix you would normally have to uninstall sendmail and then install ...
      (RedHat)
    • Re: Email Servers
      ... On Thu, 2004-03-04 at 15:08, Paul Dubinsky wrote: ... >> But I still have no clue what I installed I gather sendmail. ... > Sendmail and/or Postfix is installed. ... > install if you're not careful. ...
      (Fedora)
    • Re: Mail Services
      ... > package from the Fedora install. ... I like Sendmail, others Postfix or Exim. ...
      (Fedora)
    • Re: /etc/alternatives
      ... Its most common use is to switch between sendmail and postfix, ... many programs look for a 'sendmail' binary when they want to, well, send mail. ... postfix you would normally have to uninstall sendmail and then install ... is done using a series of 'slave' links which are automtically switched over ...
      (RedHat)