For our company needs, we need to sell one of our software on *nix-like system. How can we distribute and protect our software ?

I know that almost every program on linux is open-source, so how can we protect source code ?

Do we need distribute part of source code in object files ?

Software written in C.

  • There is no requirement to distribute your software as open source. You protect your commercial software with a licence agreement - whether open source or not.
    – nvogel
    Jun 14 '11 at 19:14
  • 1
    @twoface88: Source code protection really a common illusion
    – Predator
    Jun 14 '11 at 19:15
  • Edited the title to make the question more obvious from the front page
    – jkerian
    Jun 14 '11 at 19:25

You can distribute your program for Linux just as you would for Windows, by shipping your compiled code with any resources it will use. You don't need to include the source (unless your product is derived from GPL code). Just build without symbols and distribute the binaries. You'll probably want to statically link libraries to make distribution simpler.

  • 2
    Do i need to have compiled version for every *nix-like system ? ubuntu, freebsd, centos, etc ?
    – twoface88
    Jun 14 '11 at 19:17
  • 1
    FreeBSD uses a different ABI, so yes you would, unless your customer's FreeBSD system uses a linux-compat layer. Ubuntu and CentOS will probably need different packages as their package managers are very different (apt vs the RPM-based yum).
    – yan
    Jun 14 '11 at 19:26
  • 1
    yan's last comment about "You'll probably want to statically link libraries to make distribution simpler" is pretty important here. Some libraries like glibc are pretty good at controlling their versioning, but many are not. It's not the distribution that will give you trouble, it's the supported software in each distribution. (For example, how many versions of Debian will you be supporting?)
    – jkerian
    Jun 14 '11 at 19:30
  • all of most popular *nix systems
    – twoface88
    Jun 14 '11 at 19:59
  • One note about distribution avenues: If your selling a CD containing a package (.deb or .rpm etc) then you can't do this, but if your binary is freely available and you sell a license key that you use to activate the software, then you can create your own software repository. This makes distributing binaries and updates to your users easier by leveraging the existing package management systems. Jun 14 '11 at 20:46

You can simply build an installer package exactly as you would on windows.
Redhat's .rpm and Debian/ubuntus .deb - are basically the same concept as Microsoft's MSI.

There are other package formats but almost everybody can use these two.

For details of the tools and steps needed to create the packages see:
Packaging software with RPM
Basics of the Debian package management system

  • If only there were an apt-get equivalent for MSI...
    – dan04
    Jun 15 '11 at 0:08
  • 3
    @dan04, try the --credit_card_details and --keep_paying_for_new_versions flags Jun 15 '11 at 2:22

If making the source code available is impossible (for business reasons), the answer is simple: You ship the compiled binary. This means that you won't be able to leverage the various *nix package managers to handle compilation for you across the platforms you will support, but that's the tradeoff you make by not making your source code available.

Otherwise, you use a proprietary/commercial license and trust your users, just like many companies that target commercial code for *nix platforms.

  • most *nix package formats allow binary packages. Jun 15 '11 at 1:30
  • @Tim yes, but most don't allow closed source packages. In any event, they wouldn't be able to build the binaries if they don't have the source, which is the point of leveraging the package distributors. Jun 15 '11 at 1:34
  • if you're selling software you will have to run your own repository. Jun 15 '11 at 1:43
  • @Tim what's your point? Jun 15 '11 at 1:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.