Automatic Installation of cppcms Program

Source: Internet
Author: User
Tags mongodb client

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.