How To Create A .deb Package From Source & Install It Automatically

Server Norckon 311℃ 0评论

ubuntu-deb-package

INTRODUCE

Usually, we install a opensource software from source code directly. But if we want to transplant a opensource software from develop environment to server environment there have 2 ways:

  • Build and install opensource software on server
  • Build from development PC and install on server

Install on server is a very easy way to do that, but it will takes more resource from server system, is very dangerous for server. I recommend build it from development PC and transplant to server. But how to do it?

INSTALL DEPENDENCIES

To build a package from source code need some tools and libraries.

Install dependency tools:

$ sudo apt-get install -y build-essential automake autoconf libtool pkg-config intltool checkinstall

Install dependency libraries:

$ sudo apt-get install -y libcurl4-openssl-dev libxml2-dev libgtk2.0-dev libnotify-dev libglib2.0-dev libevent-dev

MAKE SOURCE CODE

Same as install from source code, need configure and make first, but needn’t make install it.

For example install wget from source code:

# wget http://server:port/path/wget-1.18.tar.gz
# tar -zxf wget-1.18.tar.gz
# cd wget-1.18/
# ./configure
# make

STOP IN HERE, DONOT RUN make install COMMAND !!!

BUILD A PACKAGE AND INSTALL IT

Keep in wget work directory, and run checkinstall to build a package, After build package, checkinstall will install package automatically.

Run checkinstall and follow guide to build a package, new package stored in your work directory (e.g. ~/wget-1.18/wget_1.18-1_amd64.deb)

root@localhost:~/wget-1.18# checkinstall

After guide, package has been installed in your system, to remove it:

# dpkg -r wget

REFERENCE

AUTHOR

Pekaikon Norckon
2016-06-26 (SUN)

喜欢 (0)
COMMENT
Cancel Comment

EMOJI

Hi, We need some information

  • Nickname (*)
  • E-Mail (*)
  • Website