2

We've got a PHP script running MongoDB in the background. I want to make it a bundle (Installer) for Unix.

I will use it to install the following on any machines:

  1. Install Apache, PHP + MongoDB
  2. Setup the PHP + MongoDB project

Can anyone direct me to an appropriate resources to achieve this?

What are your suggestions? What is the best solution if you want to deploy a package to a client?

derobert
  • 107,579
  • 20
  • 231
  • 279
iron man
  • 21
  • 1
  • That's impossible: there is at least fife different package management systems, also almost every distro have its own repository! – Eddy_Em Jul 24 '13 at 20:54
  • No, I mean i just want to bundle all my projects into a single installation file so that my client can just run it and everything else should be setup in time – iron man Jul 24 '13 at 20:58
  • Well, then simply write all sequence of commands that you did into a single bash file. Something like `emerge apache; …` and put settings into archives with absolute path (and last string of your script would be something like `tar -zxvf settings.tgz`), of course, file with settings should be near that script (or even inside it). – Eddy_Em Jul 24 '13 at 21:06
  • What distro are you using? – slm Jul 25 '13 at 01:10
  • Red Hat OS 5.5. – iron man Jul 25 '13 at 18:33

1 Answers1

3

Perhaps too big of a hammer for your particular case, but this tool may actually open up possibilities you never imagined before. Take a look at Puppet. It's a configuration management tool that allows you to control your clients in a centralized and OS-agnostic manner.

In Puppet, you ensure that a certain package is installed by writing something similar to the following in a configuration file (on the server):

$package_name = $operatingsystem ? {
                 debian  => 'apache-for-debian',
                 redhat  => 'apache-for-rhel',
                 default => 'apache',
}
package{$package_name: ensure => installed}

As for your home-brewed PHP script, you can put it under Puppet's tree on your server and have the clients download it with something similar to the following:

file{'my_script':
      ensure  => file, #as opposed to directory
      path    => '/path/on/client/myscript',
      mode    => 0755,
      source  => 'puppet:///path/on/server/myscript',
}

You can have Puppet check periodically for changes in the configuration on the server and mirror them on the local host (client). This means that maintaining your PHP script after installation is also centralized.

Joseph R.
  • 38,849
  • 7
  • 107
  • 143
  • Hi, Thanks for your reply! When you say 'configuration on the server and mirror them' is it manditory? We just want to give our client everything bundled so that he/she can run them on their machine and everything should be setup (or with little effort from the client). Just my little PHP script+Mongodb (PHP installation included) that's it! Is it possible with Puppet? – iron man Jul 25 '13 at 18:35
  • @ironman Not sure I get your comment. The end users will not need to deal with any sort of "bundle" or installer: Puppet will handle that as provided by you in its configuration file(s) (called a manifest): you instruct Puppet to install whatever tools you need and copy your home-brewed script and ensure it's executable. This is all transparent to the end user. – Joseph R. Jul 27 '13 at 13:37