LoginSignup
0
0

More than 5 years have passed since last update.

Zabbix Agentのインストーラーをinno setupeで作ってみた

Last updated at Posted at 2017-07-17

Zabbix AgentのWindows版はバイナリで配布されていて、コマンドでのインストールが必要なためインストーラーのように自動でインストール出来る仕組みが作れないかと思いOSSの inno setup を使って簡易的なインストーラーを作って見ました。
ここでは、inno setupのインストール手順は省略します。
inno setupは、TeratermやWinSCPなどでも使われているようです。

inno setup

ドキュメント

公式

日本語

http://inno-setup.sidefeed.com/
http://www.line-eng.com/technical/index.html#installer_reference

検証方針

  • inno setupで簡易的なインストーラーを作成する
  • 64bit環境にインストールするので、Zabbix Agentは64bit版を使用する
  • 作成したインストーラーのインストール及びアンインストールが問題なく動作することを確認する

実行環境

項目 バージョン
inno setup 5.5.9
Windows 2012R2
Zabbix Agent 3.2

検証

ソース

簡易インストーラー用に以下を作成してみました。

; Zabbix Agent Installer
#define AppName "Zabbix Agent"
#define Version "3.2"
#define InstallerName "Zabbix Agent Installer"
#define SourceDirectory "zabbix_agents_3.2.0.win"
#define Archi "win64"

[Setup]
AppName = {#AppName}
AppVerName = {#AppName} {#Version}
OutputBaseFilename = {#InstallerName}
DefaultDirName = {pf}\{#AppName}
AppendDefaultDirName = no

[Files]
Source: "{#SourceDirectory}\bin\{#Archi}\*" ; DestDir: "{app}/bin" ; permissions:admins-full
Source: "{#SourceDirectory}\conf\*" ; DestDir: "{app}/conf" ; permissions:admins-full

[Languages]
Name: japanese; MessagesFile: compiler:Languages\Japanese.isl

[Run]
Filename: "{app}\bin\zabbix_agentd.exe" ; Parameters: "--config ""{app}\conf\zabbix_agentd.win.conf"" --install"

[UninstallRun]
Filename: "{app}\bin\zabbix_agentd.exe" ; Parameters: "-x"
Filename: "{app}\bin\zabbix_agentd.exe" ; Parameters: "-d"

[Code]
function InitializeSetup(): Boolean;
begin
    Result := MsgBox('Zabbix Agent' #13#13 'インストールを開始しますか?', mbConfirmation, MB_YESNO) = idYes;
    if RESULT = False then
        MsgBox('Zabbix Agent' #13#13 'インストールを中断します。', mbInformation, MB_OK);
end;

インストーラー作成

(1) inno setupを起動します。

(2) 上記ソースを貼り付けて compile します。

(3) issファイルの保存先はZabbix Agentを解凍したフォルダと同じ階層(カレントフォルダ)に保存してください。

C:\USERS\ADMINISTRATOR\DESKTOP
│  zabbix_agent_installer.iss
│
└─zabbix_agents_3.2.0.win
    ├─bin
    │  ├─win32
    │  │  │  zabbix_agentd.exe
    │  │  │  zabbix_get.exe
    │  │  │  zabbix_sender.exe
    │  │  │
    │  │  └─dev
    │  │          zabbix_sender.dll
    │  │          zabbix_sender.lib
    │  │
    │  └─win64
    │      │  zabbix_agentd.exe
    │      │  zabbix_get.exe
    │      │  zabbix_sender.exe
    │      │
    │      └─dev
    │              zabbix_sender.dll
    │              zabbix_sender.lib
    │
    └─conf
            zabbix_agentd.win.conf

(4) 問題なくコンパイルが実行できれば、issファイルが保存されたカレントフォルダに Output フォルダが作成されます。その中のインストーラーを実行します。

(5) サービスプログラムと機能 にZabbix Agentが表示されていることを確認します。

(6) 次に プログラムと機能 からZabbix Agentを削除して サービスプログラムと機能 から削除されたことを確認します。

単純なインストールは出来たけど、もう少し色々と工夫する必要があるなぁ :-(

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0