Sisay Zinabu Sisay Zinabu - 1 year ago 117
Linux Question

C++ linux install executable file on deploy environment

Hello every one i need to deploy linux(centos) c++ project with make file or script. By one makefile or script install dependency and project executable binary.
my dependency applications libboost-devel,gcc-g++ and pcre. my excuteble binary file is run_excute

myk myk
Answer Source

Yip sure - put the below commands into a file. At the top of the file add:


Save the file - lets say you call it install; on the command line type:

chmod +x ./install

Then to build and install your program type:

sudo ./install

Alternatively, if you've got some time on your hands:

As an example the basic rpm build process for fedora is:

Step 1: setup your machine to do packaging:

dnf install @development-tools fedora-packager rpmdevtools

Step 2: source and Makefile Place these in ~/rpmbuild/SOURCES

Step 3: Create a spec file In ~/rpmbuild/SPECS create file called myname.spec. It should contain something like:

Summary:            My program description
Name:               myname
Version:            0.0.0
Release:            0
License:            GPLv2
Group:              Applications/Databases
Source:             https://xyz.tar.gz
URL:                http://myurl
BuildRequires:      libicu-devel
BuildRequires:      pcre-devel

A couple of lines describing the package

%setup -q

cd %{myname}/source
make %{?_smp_mflags}



* Tue Nov 10 2015 Yours Truly <> - 0.0.0-0
- Some change comments

Step 4: create the source and binary rpm

cd ~/rpmbuild/SPECS
rpmbuild -ba myname.spec

Step 5: use the rpm

cd ~/rpmbuild/RPMS/x86_64
rpm -Uvh ./myprogram-version-release.a.whole.lot.of.stuff.rpm
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download