Just like the idea of Automatic Installation of Java programs, why don't you write a simple script to assemble it all by yourself. Of course, the tools are good, but it is still necessary to understand the background. standing on the shoulders of giants forever and not repeating the words of the wheel will sometimes impede the growth of excellent programmers.
My c ++ website is based on the cppcms library and compiled using cmake. The target deployment platform is ubuntu12.04 server (amd64bit ). First, create the create_deploy.sh script under the project directory.
#!/bin/bashsource ./tool.shremoveFolder buildmkdir buildcd buildcmake ..makecd ..removeFolder deploymkdir deploycp ./build/bin/cppweb ./deploycp ./kmconfig.js ./deploycd ./deploymkdir libscd libscp /usr/lib/libloki.so.0.1.7 ./cp /usr/lib/libmongoclient.so ./cp /usr/lib/libbooster.so.0.0.1 ./cp /usr/lib/libcppcms.so.1.0.2 ./cd ../../cp ./install.sh ./deploycp ./tool.sh ./deploy
Note that the cppcms library, MongoDB client C ++ driver 2.0, and Loki Library have been compiled and installed on the development machine.
The purpose of this script is to create the deploy directory, put the required library under the libs subdirectory, and run the cmake command to compile the website program cppweb, and then copy it to the deploy directory.
At the same time, there are two pre-prepared script files, tool. Sh, which provide basic general functions. Install. Sh is to install the library in the libs directory to the target machine and create the corresponding link.
The content of the install. Sh script is as follows:
#!/bin/bashsource ./tool.shinstallDpkg libboost1.48-all-devinstallDpkg libboost-thread1.48-devinstallDpkg libboost-regex1.48-devinstallDpkg libboost-filesystem1.48-devinstallDpkg libboost_system1.48-dev#installDpkg libace-devinstallDpkg libcrypto++-devcp ./libs/* /usr/lib/createLink /usr/lib/libloki.so.0.1.7 /usr/lib/libloki.socreateLink /usr/lib/libcppcms.so.1.0.2 /usr/lib/libcppcms.so.1createLink /usr/lib/libcppcms.so.1 /usr/lib/libcppcms.socreateLink /usr/lib/libbooster.so.0.0.1 /usr/lib/libbooster.so.0createLink /usr/lib/libbooster.so.0 /usr/lib/libbooster.so
The usage is simple:
1. Call the create_deploy.sh script to generate the deploy directory.
2. Copy the deploy directory to the target machine and run the install. Sh script.
The Install. Sh script can be further enhanced to install the cppweb program as a Ubuntu service. This is omitted.