Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference in details between "make install" and "make altinstall"

Here is my case:

I am using Ubuntu 10.04 (Lucid Lynx). The system's default Python is v2.6.5, but I need Python v2.7. So I downloaded the source from python.org and tried to install it.

The first time I installed it, I ran:

cd Python2.7.4
./configure --prefix=/usr
make
su root
make install

This installs Python 2.7 to my system. It will create a link, "python", in /usr/bin linking to python2.7 also in /usr/bin. So when I type >python, the system will start Python 2.7.4 for me just like when I type >python2.7.

But when I install this way:

cd Python2.7.4
./configure --prefix=/usr
make
su root
make altinstall

The link "python" in /usr/bin still exists and links to python2.6 which is the default system version. Of course, I can remove it and create a new soft link linking to python2.7.

What is the difference between the command "make install" and "make altinstall", except for the link in /usr/bin?

like image 990
qiuhan1989 Avatar asked Apr 15 '13 14:04

qiuhan1989


People also ask

What is make Altinstall Python?

Simply: The altinstall target will make sure the default Python on your machine is not touched, or to avoid overwriting the system Python.


2 Answers

Let's take a look at the generated Makefile!

First, the install target:

install:         altinstall bininstall maninstall

It does everything altinstall does, along with bininstall and maninstall

Here's bininstall; it just creates the python and other symbolic links.

# Install the interpreter by creating a symlink chain:
#  $(PYTHON) -> python2 -> python$(VERSION))
# Also create equivalent chains for other installed files
bininstall:     altbininstall
        -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
        then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
        else true; \
        fi
        (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
        -rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
        (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
        ... (More links created)

And here's maninstall, it just creates "unversioned" links to the Python manual pages.

# Install the unversioned manual pages
maninstall:     altmaninstall
        -rm -f $(DESTDIR)$(MANDIR)/man1/python2.1
        (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python2.1)
        -rm -f $(DESTDIR)$(MANDIR)/man1/python.1
        (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python2.1 python.1)

TLDR: altinstall skips creating the python link and the manual pages links, install will hide the system binaries and manual pages.

like image 167
Collin Avatar answered Oct 20 '22 06:10

Collin


Simply: The altinstall target will make sure the default Python on your machine is not touched, or to avoid overwriting the system Python.

like image 3
Fernando Rodriguez Avatar answered Oct 20 '22 05:10

Fernando Rodriguez