-1

I'm trying to to figure out what is the correct way to install packages that contain pre-build binaries as well as configuration files.

For example, I want to install cmake by its officially provided cmake-3.17.0-Linux-x86_64.sh script. It downloads following folders:

.
├── bin/
├── doc/
├── man/
└── share/

which each directory contain some specific files. I put them under "/opt".

When I build from source with genral 'configure-make-make install' steps, these directories distributed under "/usr/local/share", "/usr/local/bin" etc.

What is the proper way after put these files to appropriate directories? I think I miss something with my homework and need to a back to the basics moment, but where? Any pointer is really welcome.

0

The installation script has a few options that it accepts:

$ ./cmake-3.17.0-Linux-x86_64.sh --help
Usage: ./cmake-3.17.0-Linux-x86_64.sh [options]
Options: [defaults in brackets after descriptions]
  --help            print this message
  --version         print cmake installer version
  --prefix=dir      directory in which to install
  --include-subdir  include the cmake-3.17.0-Linux-x86_64 subdirectory
  --exclude-subdir  exclude the cmake-3.17.0-Linux-x86_64 subdirectory
  --skip-license    accept license

With the --prefix option, you can choose exactly where to install it. Here, I'm installing it in /opt:

$ ./cmake-3.17.0-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/opt

(I'm also accepting the license with --skip-license and opting for creating the directories directly beneath the installation prefix and not in a separate cmake-3.17.0-Linux-x86_64 directory with --exclude-subdir).

After this, you will need to add the bin directory (/opt/bin in the above example) to your $PATH. You do that by modifying your shell's startup files. If you're using bash, this means adding a line saying

PATH=$PATH:/opt/bin

to your ~/.bashrc or ~/.bash_profile file. This change will enable you to use cmake as any other command and will be in effect the next time you log in.

The share directory contain files that cmake uses. You will not need to do anything special with this.

The man directory contain manuals. To be able to read these with the man command, set your $MANPATH variable like so:

export MANPATH="$(manpath -g):/opt/man"

(this obviously still assumes you used /opt as the installation prefix).

The doc directory contains some documentation in HTML format that you could read in a browser (start at /opt/doc/cmake/html/index.html).

| improve this answer | |
  • Yes, I didn't mention that, but that's not the question. I install them on /opt, but what's next? Should I add new downloaded bin/ directory on path, or what's with the share/ directory and other? – adem Apr 1 at 22:25
  • @adem See update. – Kusalananda Apr 1 at 22:28
  • Having a ~/local/bin directory isn't seems to natural solution to me and your answer become something entirely other since your first post. Unfortunately I can't vote it. – adem Apr 1 at 22:39
  • @adem I've changed the installation prefix to /opt to be more in line with your question. Let me know what you're missing from this answer. – Kusalananda Apr 2 at 5:40
  • @adem If I'm not answering your question, you may want to clarify what it is you'd like us to answer. Do that in the question itself, not in comments. – Kusalananda Apr 2 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.