Sign in to your OlinData support account for customized help. Once you login you will be able to contact our support engineers (for 24/7 support packages), register your issues and view the history of your support cases.
For today's operating systems, I think installing software can be described as copying an executable file (or files) to a path on the host filesystem where the operating system expects it to be.
On windows, the magic path is
On Linux and Unix-like systems, the magic path is something like
Using docker, the magic path is
Sometimes there are tasks to be run before or after copying files. Registering and starting services, creating users...
There are lots of tools that do these jobs for us. The user interface for installation is designed to be as easy as possible. On Linux distributions, installing the 'filebeat' program is usually something like:
yum install filebeat
On Windows we usually have the 'install wizard'. It's a graphical UI which steps through a series of questions that you usually ignore and click the 'Next' button.
There are text-based install wizards for Linux distributions, and there are package managers for Windows. But when working with other people that you've never worked with before and will likely never work with again, there's a great advantage to using the standard, least surprising methods of installing your software: they will not rely on you because they've installed and uninstalled software many times before.
A project required that the programs 'filebeat' and 'winlogbeat' were installed on a bunch of Windows servers. Sounds easy. And it was. But some easy things, like this one, can take up a lot of time. There were a few challenges.
It was impossible for me to get administrator privilege on the target machines. The ones who could install the software were extremely difficult to get a hold of. And lastly, the Windows builds for filebeat and winlogbeat do not provide an install method. Time to write an installer.
What would an installer for filebeat for Windows do? Probably the same as any other that we thought about before: copy files to a directory, register and start a system service.
What's the simplest way to make a directory and copy files on Windows? Probably the
copy command. Here's a batch script to install filebeat:
mkdir C:\Program Files\filebeat copy filebeat.exe C:\Program Files\filebeat copy filebeat.yml C:\Program Files\filebeat
We also need to register a Windows service so that we can, for example, check, start and stop the service from the normal services.msconfig console.
sc is the simplest way I found to create services in Windows. You craft a command that is executed by the service manager, and give the service a name.
After some basic experimentation on the command line here's what I came up with:
C:\ProgramFiles\filebeat\filebeat.exe -c C:\Program Files\filebeat\filebeat.yml -path.home C:\Program Files -path.data C:\ProgramData\filebeat -path.logs C:\ProgramData\filebeat\logs
And giving that to
sc is just a copy and paste:
sc create filebeat start= delayed-auto binPath=C:ProgramFiles\filebeat\filebeat.exe -c C:\Program Files\filebeat\filebeat.yml -path.home C:\Program Files -path.data C:\ProgramData\filebeat -path.logs C:\ProgramData\filebeat\logs
It would be nice to have filebeat start automatically after installation is finished. So just start it:
net start filebeat
We've now got our installer. Here it is in full:
mkdir C:\Program Files\filebeat copy filebeat.exe C:\Program Files\filebeat copy filebeat.yml C:\Program Files\filebeat sc create filebeat start= delayed-auto binPath=C:ProgramFiles\filebeat\filebeat.exe -c C:\Program Files\filebeat\filebeat.yml -path.home C:\Program Files -path.data C:\ProgramData\filebeat -path.logs C:\ProgramData\filebeat\logs net start filebeat
It's conceptually trivial to come up with an uninstaller now. We just do it all in reverse:
net stop filebeat del C:\Program Files\filebeat\* sc delete filebeat
So to install and uninstall, we can run install.bat from an unzipped filbeat archive:
cd filebeat .\install.bat
Whilst this is a simple method for installing software, it's not an easy method for those used to managing windows servers. What we're missing is the classic install wizard.
The Nullsoft Scriptable Install System (NSIS) is a small set of open source libraries and tools to create these install wizards. The best thing about NSIS is that there is no added conceptual overhead to using it to package software. We're still just copying files to special places and optionally running a couple of basic commands.
Here's an NSIS script version of our install.bat script. Note that it's still a basic top-to-bottom routine with some slightly different syntax and a couple of options.
Name "filebeat" RequestExecutionLevel admin InstallDir "$PROGRAMFILES64\filebeat" OutFile "install_filebeat.exe" Page directory Page instfiles Section "install" SetOutPath "$INSTDIR" File filebeat.yml File filebeat.exe WriteUninstaller "$INSTDIR\uninstall_filebeat.exe" ExecWait 'sc create filebeat start= delayed-auto binPath= "\"$INSTDIR\filebeat.exe\" -c \"$INSTDIR\filebeat.yml\" -path.home \"$INSTDIR\" -path.data C:\ProgramData\filebeat -path.logs C:\ProgramData\filebeat\logs"' ExecWait 'net start filebeat' SectionEnd Section "uninstall" ExecWait 'net stop filebeat' ExecWait 'sc delete filebeat' RMDir /r "$INSTDIR" SectionEnd
To create a good old fashioned GUI installer out of this we use the makensis command line utility with our script as its argument. Assuming we saved the above script as filebeat.nsi:
There'll be a new file, install_filebeat.exe. From here we all know the routine. Double click the .exe, click Next, click Next again, click Done.
Remember that we did this because an install wizard on Windows is so unsuprising and boring that we end up saving a lot of time, but not in the way we usually expect. We're not saving that much time by automating the copying of files.
We're minimising risk that the organisation sees in using your software. This is where time is taken up. Organisations have IT battle scars from badly written, poorly managed software. What if they install your stuff, something goes wrong, and they can't get rid of it easily? We can save them the trouble and yourself the frustration by making it so unsurprising to install and remove software that it's not even worth having meetings about any more.