CentOS7でzncのインストール

  • バージョン確認
$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
  • zncはcentosの標準のyumレポジトリに入っていないのでepelのレポジトリを追加する
$ sudo yum -y install epel-release
$ sudo yum -y install znc
  • zncの初期設定
    • 公式ドキュメントに従ってzncユーザーで実行
    • Listen on port は適当な番号でよいが、6667, 6668 はブラウザで接続拒否されるため他の番号推奨
    • Set up a network は後で実施するので no とする
$ sudo -u znc znc --makeconf
[ .. ] Checking for list of available modules...
[ >> ] ok
[ !! ] WARNING: config [/var/lib/znc/.znc/configs/znc.conf] already exists.
[ ** ]
[ ** ] -- Global settings --
[ ** ]
[ ?? ] Listen on port (1025 to 65534): 1031
[ ?? ] Listen using SSL (yes/no) [no]:
[ ?? ] Listen using both IPv4 and IPv6 (yes/no) [yes]:
[ .. ] Verifying the listener...
[ >> ] ok
[ ** ] Enabled global modules [webadmin]
[ ** ]
[ ** ] -- Admin user settings --
[ ** ]
[ ?? ] Username (alphanumeric): h-sasaki
[ ?? ] Enter password:
[ ?? ] Confirm password:
[ ?? ] Nick [h-sasaki]:
[ ?? ] Alternate nick [h-sasaki_]:
[ ?? ] Ident [h-sasaki]:
[ ?? ] Real name [Got ZNC?]:
[ ?? ] Bind host (optional):
[ ** ] Enabled user modules [chansaver, controlpanel]
[ ** ]
[ ?? ] Set up a network? (yes/no) [yes]: no
[ ** ]
[ .. ] Writing config [/var/lib/znc/.znc/configs/znc.conf]...
[ !! ] This config already exists.
[ ?? ] Are you sure you want to overwrite it? (yes/no) [no]: yes
[ .. ] Overwriting config [/var/lib/znc/.znc/configs/znc.conf]...
[ >> ] ok
[ ** ]
[ ** ] To connect to this ZNC you need to connect to it as your IRC server
[ ** ] using the port that you supplied.  You have to supply your login info
[ ** ] as the IRC server password like this: user/network:pass.
[ ** ]
[ ** ] Try something like this in your IRC client...
[ ** ] /server <znc_server_ip> 1031 h-sasaki:<pass>
[ ** ]
[ ** ] To manage settings, users and networks, point your web browser to
[ ** ] http://<znc_server_ip>:1031/
[ ** ]
[ ?? ] Launch ZNC now? (yes/no) [yes]:
[ .. ] Opening config [/var/lib/znc/.znc/configs/znc.conf]...
[ >> ] ok
[ .. ] Loading global module [webadmin]...
[ >> ] [/usr/lib64/znc/webadmin.so]
[ .. ] Binding to port [1031]...
[ >> ] ok
[ ** ] Loading user [h-sasaki]
[ .. ] Loading user module [chansaver]...
[ >> ] ok
[ .. ] Loading user module [controlpanel]...
[ >> ] ok
[ .. ] Forking into the background...
[ >> ] [pid: 11089]
[ ** ] ZNC 1.6.5 - http://znc.in
# 事前確認
$ sudo firewall-cmd --list-all --zone=public
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens32
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

# zncの初期設定で設定したポートを追加
$ sudo firewall-cmd --add-port=1031/tcp --zone=public --permanent
success

# リロード
$ sudo firewall-cmd --reload
success

# ポートが開いたことを確認
$ sudo firewall-cmd --list-all --zone=public
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens32
  sources:
  services: dhcpv6-client ssh
  ports: 1031/tcp
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:
  • ブラウザで管理画面にアクセス
  • 管理画面でネットワーク(IRCサーバ)を追加
    • [webadmin]-[Networks]で[Add]をクリック
    • [Network Info]を入力
      • [BindHost]は"0.0.0.0"
      • 日本語を使う場合、[Server encoding]は"Parse and send as ___ only"を選択してテキストボックスに"JIS8"と入力する
      • [Save and continue]をクリック
    • [Channels]で[Add]をクリック
      • チャンネルを追加する
  • 管理画面でログモジュールを追加
  • IRCクライアントからzncサーバに接続
    • znc_server_ip:1031
  • その他
    • configの場所
      • /var/lib/znc/.znc/configs/znc.conf
    • ログの場所
      • /var/lib/znc/.znc/moddata/log/ユーザー名/ネットワーク名/チャンネル名/