Installing Software without Synaptic

From PCLinuxOShelp Knowledge Base

Jump to: navigation, search

How to Install Software Without Synaptic

Reprinted with permission from Bald Brick.


WARNING Installing apps that aren't in the repository is not a good idea if you are new to Linux, but if you have a testing setup, do use it.


To install an rpm, open a terminal, su to root, and either use the command

 Code:
 rpm -Uvh /path/to/the/package/you/want/to/install.rpm
 
 or
 
 Code:
 rpm -ivh /path/to/the/package/you/want/to/install.rpm


The option "-U" stands for "update", and the option "-i" for "install". "-U" is usually the safer choice; if you don't have installed an earlier version of an app "-U" and "-i" will do the same thing: install the package. If you have installed an earlier version of a package, "-U" will remove the older version before installing the new one. If you want two different versions of the same program, you have to use the option "-i", but the install may well fail.

Both the commands above will fail to finish and give you an error message if the package you are trying to install has a dependency that is missing on your system. Then you first have to locate that dependency an install it.

If the app that you want to install and one of its dependencies are both dependent on each other, you have to install them both with the same command.

If you want, you can also istall from Synaptic RPM-Installer for rpm package, this is simple desktop file to install rpm package, or analyzed rpm package via right click.

That's what great about Synaptic: it will find and install the dependencies almost automatically.


But what if you don't want to install an rpm package? What if you want to install from a tarball instead?

To install an tarball.
A tarball is simply a compressed archive. Depending on how it is compressed it may have extensions like .tar.gz or .tgz for gzip-compressed archives, and .tar.bz2 or .tbz2 for bzip-compressed archives. Other used archives is tar.xz compression.

The archive may contain anything. Some, mainly proprietary, applications come as compiled binaries, sometimes accompanied by a script or other program that installs and uninstalls them.

But the typical tarball would contain the source code of a program that you must compile yourself. When you unpack it you will usually find both the code and other necessary files in a directory with more or less the same name as the tarball itself (but naturally without the the tarball's extensions).

In that directory (or in a subdirectory) you may also find an "Info" file or an "INFO" file -- and a "README", "readme" or "Readme" file, and sometimes "INSTALL"

Before compile this source code and install, try read files COPYING, LICENSE and INSTALL, README.
The last two files should inform you:

- which dependencies you should install before compile
- how compile
- how install

More info can be also on main page website source code.

In most cases three-step recipe

./configure
make
make install

this is all you need to follow when you compile and install the application. Sometimes a lot more than three steps may be necessary, sometimes less.


But let's suppose that the three-step formula is all your application needs.

The first step is ./configure. The dot in the beginning means "this directory": you want to run a version of "configure" that accompanies the source code of the program you want to compile -- so you have to be in the directory containing the right "configure". Often that is the top directory with the same name as your tarball, but it may also be a subdirectory further down in the hierarchy. Configure script will check if you have installed the build dependencies and will inform with warnings or errors if something missing. If "./configure" gives up with an error message before finishing you have to look at what happened just before the error and try to find out what went wrong.
More often than not the reason will be a missing dependency that you have to find and install before you rerun "./configure". If you see missing dependencies in output in terminal, try find name packages with a tip -devel inside Synaptic and install. Than try again run script configure.
When the script configure was successful, you should inside source code new file, Makefile, it is needed for compile.


The second step is make. Here you should not add "./" to the beginning of the command. You want to run /usr/bin/make and as /usr/bin is in your $PATH variable you can leave out the path. But you have to remain in the directory where you ran "./configure". Command "make" will read file "Makefile" and compile your source code.
For these two steps you can remain your ordinary user. But then comes make install, and for that you should be root. (Sometimes it may be possible to install a program in your home directory, and then you don't have to be root -- but why would you want to?)




Other files.
Sometimes nothing writes or INSTALL and README files not exists.
Steps looks whichever files you can find, and you can see:

autogen.sh
configure or CMakeLists.txt
Makefile


In this order should be executed.
autogen.sh and configure file you can run from terminal inside source code like this:

./autogen.sh
./configure

autogen.sh will rebuild existing or create new configure file.

For CMakeLists.txt is needed cmake package installed, then you can run commands in terminal inside source code:

mkdir build
cd build
cmake ..

Command "mkdir build" create for you folder with name "build", "cd build" takes you to this folder,
and "cmake" command will read CMakeLists.txt which is ".." two levels above inside folders when we are.
Cmake doing the same what configure, this mean checks if you have installed all the dependencies needed to compile source code.

- If you have errors and you have installed all needed dependencies, just try update dependencies,
to do this learn how build rpm packages.
- To check missing dependencies you can check "REAME", "INSTAL" files, website with source code,
also you can check package on other linux distribution.


Next step is just:

make
su
make install

"make" will compile source code, "su" allows to log on root user, "make install" allows install ready files.
"make install" this is also the crux of problems, when you trying install files:

- other files can overwritten and system can be broken
- none tool does not monitoring what you're trying to install, so you can not also uninstall

However sometimes you can use with source code

make uninstall

but not always working with source code.
Second way to uninstall source code is create file with list all files in system before install source code,
and after install source code, the difference file lists can be used to remove files from source code in your system. A third possibility, it use options with configure or cmake,
for example:


Cmake files.

Alternate Installation:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/your/path/when/you/want/install/all/files 
make
make install (in most case without root)

Befor install files I suggest create folder where you want install files.
For me this is the best way install files, because:

- you have all in one place / folder
- for uninstall you can just remove folder with app
- your system can be more save when you install apps to /opt folder or /home/your_user_name/your_apps/name_app
- you don't need use root for install files


Example with configure:
./configure --prefix=your_path_where_app_will_installed 
make 
make install
If app not working you can try debug Debug_a_Program#Debug_with_strace_command.
and if you see: app trying open/search from source code in /usr/lib ... ,
you can try use autoconf before ./configure or other way
autoconf
./configure --prefix=your_path_where_app_will_installed 
make 
make install
Then your app should search own libs where your app ( --prefix=your_path ... )


More options you can find in:

./configure --help
cmake .. --help


Exists also gui tools for cmake,

ccmake ..

and

cmake-gui

(for this you should install cmake-qtgui package from Synaptic)


Python files.

Alternate Installation:

python setup.py install --user

In this case all will in home folder, but not in one new folder.

I suggest check output from install, because sometimes not all apps are installed in the same place in home folder.

More in
https://docs.python.org/2/install/#inst-alt-install


More options you can find in:

python setup.py --help


Alternate way to remove files with commands (from source code)

python setup.py install --user --record files.txt
cat files.txt | xargs rm -rf

After that, are still empty directories.



If you do not have any of the previously mentioned files inside source code,
maybe you download portable app ?
Portable apps you don't need compile and install, just run app and enjoy.

Other way is create from source code for example rpm package for PCLinuxOS
http://pclinuxoshelp.com/index.php/Packaging_for_PCLinuxOS


Personal tools