5

I am installing the latest FFmpeg from this guide:

In some places it suggests performing make install without sudo, here is a single example of several:

cd ~/ffmpeg_sources
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
cd x264-snapshot*
PATH="$PATH:$HOME/bin" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-openclcd ~/ffmpeg_sources
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
cd x264-snapshot*
PATH="$PATH:$HOME/bin" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-opencl
PATH="$PATH:$HOME/bin" make
make install
make distclean

Should I being using sudo make install instead ?

My intention is to make the packages available for all users, including Apache/PHP.

g_p
  • 18,504
dotancohen
  • 2,815

5 Answers5

9

In your case you don't need to do a sudo make install as you will install the library in your $HOME. You have configured the build to use a prefix and bindir to install it in your $HOME.

To make the package avaiable to other programs it would be better to choose directories outside of your $HOME. Then you will need to do the make install using sudo.

Uwe Plonus
  • 709
  • 4
  • 14
  • So I should eliminate the --prefix clauses altogether, if my intention is to make the package available for all? – dotancohen Sep 15 '14 at 07:59
  • @dotancohen Yes. Then the library will be installed in the usual place for libraries (e.g. /lib). – Uwe Plonus Sep 15 '14 at 08:00
  • /usr/local/lib, by default. It may also be a good idea to install into a separate directory using the DESTDIR variable and use a tool like GNU Stow to manage a symlink tree in /usr/local. – Simon Richter Sep 16 '14 at 06:04
4

It depends upon where your package is going to be install.

During installation you need to enter sudo if you are performing installation in the system directories like /usr. You are needed to enter this because you do not have the write permission in that directory. A local install will not require sudo before make install

g_p
  • 18,504
4

As an addendum, consider using checkinstall to generate a managed package, then installing it with dpkg or another apt tool. For installing software from source this can relieve many headaches when it comes time to upgrade, remove, or resolve problems.

orbatos
  • 61
2

The guide you are following assumes that you wish to install ffmpeg to ~/bin/ in your HOME direcetory. This has the advantage of not needing sudo for installing but we will not be able to use ffmpeg system-wide from all users.

In addition, this path does not exist in a default Ubuntu installation, where self-compiled sytem-wide software should preferably go to /opt. See What is the best place to install user apps?.

In case we need to have access to ffmpeg from all users we should use an installation path outside our HOME for make install. This of course then requires sudo for installing. See also FFmpeg Compilation Guide.

Takkat
  • 142,284
0

If you are in doubt, almost certainly the answer is you should not use sudo.

Each time you try sudo make install you expose your system to potential bugs, as root.

I am a practicing sysadmin and regularly need to setup software for third parties; unless there is something that is truly system-aspect (such as a kernel module), most of the software gets installed and lives happily in user-space, even when shared by many, by employing ./configure --prefix

fi. >1000 software components visible here are all setup under a single regular user: https://hpc.uni.lu/users/software/

Example:

  • CUDA is a GPU development environment provided by nVidia; that's installed without sudo
  • nVidia GPU drivers though, need lower level access and thus, are done via sudo/root
  • 1
    Thank you. Assuming that I were to install software that is to be used by all users, how would I do that without sudo? Do you suggest adding the binaries to each individual users' ~/bin/? Or perhaps creating a dummy user software and adding his ~/bin/ to all users' paths? – dotancohen Sep 16 '14 at 05:28
  • @dotancohen: this was never confirmed, apologies: indeed, the last aspect you describe is exactly the way HPC sites across the world organise their software trees (multiple compilers, libraries, mpi stacks etc) and it is the recommended approach for 3rd party software. You generally do not want to mix system (upstream) software from 3rd-party, because down the road their joint maintenance becomes nightmare (example trouble points: zlib, libreadline, ncurses, boost... there are many many more). – fgeorgatos Jun 24 '17 at 08:11
  • @all: and here is the technology used to accomplish this, on HPC sites: https://en.wikipedia.org/wiki/Environment_Modules_(software)

    More generally, blind sudo make install across 1000s of software packages is very unsafe practice, because you are basically saying: "hey guys, I trust you all to be doing the right thing with your make installs". You can trust one or two persons to be doing the right thing, but not a thousand!

    – fgeorgatos Jun 24 '17 at 08:14