Ubuntu – How to install Gphoto2

gphoto2kubuntuphotophotography

I'm new to (K)ubuntu. Does anybody know how to install the gphoto2 software?

Best Answer

Wow, how is the documentation for this so terrible? At the time of writing, the documentation on the official site literally says:

5.3. Configuring, building, and installing
WRITEME :-P (PKG_CONFIG_PATH, ./configure, make, make install, /etc/ld.so.conf, LD_LIBRARY_PATH, PATH, yadda yadda)

Here's how I installed it (on Ubuntu 18.04 LTS) after lots of trial and error. Keep in mind that gphoto2 is simply the CLI for libgphoto2. Simply installing gphoto2 won't do much for you.

Easy method

Use apt (or apt-get)

$ sudo apt install gphoto2
$ sudo apt install libgphoto2-6

You may be wondering why it's libgphoto2-6 and not just libgphoto2. When you're typing sudo apt install libgphoto2 press tab and see what it completes. You can also view what the latest packages are for each ubuntu build. Launchpad and packages.ubuntu.com.

After that you should be able to use gphoto2 in Terminal.

$ gphoto2 -v

should show you something meaningful.

Advanced build

If you go to the gphoto2 website, you'll notice that they've released updates to libgphoto2 since Ubuntu 18.04's latest package (2.5.16). Specifically, I want to have support for Sony Alpha A9, which requires libgphoto2 v2.5.22. You can download it from the source, but now what?

cd to the tar.bz2 file.

unzip it: autocomplete the file name by pressing tab

$ tar -xjf libgphoto2-2.5.22.tar.bz2

configure, make, make install Go into the directory. Each of these commands will take time, so enter one line at a time.

$ cd libgphoto2-2.5.22

$ autoreconf -is
$ sudo ./configure
$ sudo make
$ sudo make install

If at any point it says it looks like something went wrong, it's likely you're missing a package. I had to install: libtool, libpopt-dev, libsub-dev, libexif-dev, libjpeg-dev, autoconf, autopoint, libcdk5-dev

The github repo has an additional step of

autoreconf -is

which for me, required apt installing the autoconf and autopoint packages.

This updates libgphoto2. To update gphoto2, which I needed to do in order to use libgphoto2-2.5.22, you have to go through the same steps. Read the README.md. I had to install libpopt-dev. Running ./configure alerted me to this problem.

You may need to restart Terminal or your machine to see changes.

After that, check your version using gphoto2 -v.