Monday, June 6, 2022

[SOLVED] Install a C program in Linux Mint. :)

Issue

I wrote a basic C program. Is there any way to install it in my Linux machine as a console app?

Thanks! :)


Solution

There's no real install step in the simple case. Just put the compiled program, or a link to it, in a directory that's in your PATH. Then, when you type the program name on the command line, the program will get found and run. You can see what your current path is by doing this:

echo $PATH

For instance, on most Linux installations, your path will already include /usr/local/bin. You could put a symlink to your program there.

Alternatively, you could edit your ~./bashrc file (or similar file for other shells, if you don't use bash) to add a personal directory to your path, for instance:

export PATH=$PATH:~/bin/

...and then either put the compiled program or a symlink to it in ~/bin.


If you wanted to go down the installable route, it would depend what variant of Linux system you're using and more specifically what package manager that system uses (apt, yum, etc.). You could create a package for your program and then install that package. That's mostly only useful if you meant to distribute the program to other people (which sometimes means you have to create multiple packages — one for each variant). Linux Mint uses APT (and Synaptic for UI).



Answered By - T.J. Crowder
Answer Checked By - Mildred Charles (WPSolving Admin)