Monday, April 20, 2020

Deploy C++ Program to CentOS Server with Similar Configuration

Deploy C++ Program to CentOS Server with Similar Configuration

Here is an simple tutorial that shows how to deploy a C++ program to a Linux server which has similar architecture and software package as your development Linux workstation.

  1. Compile your C++ program into executable
  2. Here is a shell script that Copying shared library dependencies. You can use this script to copy all dependent dynamic libraries into one folder. (note: you may want only keep those custom libraries you used and remove those libraries provide by operating system)
  3. Copy your C++ program and the library folder to the linux sever you want to deploy on, using the following command to put the dynamic folder name to link library path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your_library_path
  • Note: if you want this setting to be persistent, you need to add this command to your .bash_rc or .bash_profile file.

No comments:

Post a Comment