Skip to content

Instantly share code, notes, and snippets.

@rigor789
Last active June 19, 2020 17:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rigor789/40cf6ae3000734a4a8d4 to your computer and use it in GitHub Desktop.
Save rigor789/40cf6ae3000734a4a8d4 to your computer and use it in GitHub Desktop.
ZNC install script!

ZNC install script

Usage:

Run sudo install.sh to compile ZNC

Edit default config in /src/znc.conf.default

The default user/password is admin/admin

Move the binaries to your PATH mv start-znc /usr/local/bin mv stop-znc /usr/local/bin

And then run znc with start-znc

#! /usr/bin/env bash
set -e
# Config
ZNC_VERSION="1.4"
# Ensure package list is up to date.
apt-get update
# Install runtime dependencies.
apt-get install -y sudo
# Install build dependencies.
apt-get install -y wget build-essential libssl-dev libperl-dev pkg-config
# Prepare building
mkdir -p /src
# Copy Default Config
cp znc.conf.default /src
chmod 644 /src/znc.conf.default
# Download, compile and install ZNC.
cd /src
wget "http://znc.in/releases/archive/znc-${ZNC_VERSION}.tar.gz"
tar -zxf "znc-${ZNC_VERSION}.tar.gz"
cd "znc-${ZNC_VERSION}"
./configure && make && make install
# Clean up
apt-get remove -y wget
apt-get autoremove -y
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#! /usr/bin/env bash
# Options.
DATADIR="/znc-data"
# Build modules from source.
if [ -d "${DATADIR}/modules" ]; then
# Store current directory.
cwd="$(pwd)"
# Find module sources.
modules=$(find "${DATADIR}/modules" -name "*.cpp")
# Build modules.
for module in $modules; do
cd "$(dirname "$module")"
znc-buildmod "$module"
done
# Go back to original directory.
cd "$cwd"
fi
# Create default config if it doesn't exist
if [ ! -f "${DATADIR}/configs/znc.conf" ]; then
mkdir -p "${DATADIR}/configs"
cp /src/znc.conf.default "${DATADIR}/configs/znc.conf"
fi
# Make sure $DATADIR is owned by znc user. This effects ownership of the
# mounted directory on the host machine too.
chown -R znc:znc "$DATADIR"
# Start ZNC.
exec sudo -u znc znc --datadir="$DATADIR" $@
#! /usr/bin/env bash
pkill -SIGUSR1 znc
pkill znc
// WARNING
//
// Do NOT edit this file while ZNC is running!
// Use webadmin or *controlpanel instead.
//
// Altering this file by hand will forfeit all support.
//
// But if you feel risky, you might want to read help on /znc saveconfig and /znc rehash.
// Also check http://en.znc.in/wiki/Configuration
Version = 1.4
<Listener l>
Port = 6667
IPv4 = true
IPv6 = true
SSL = false
</Listener>
LoadModule = webadmin
<User admin>
Pass = sha256#1b9a69be60544ae4a83147ebb04c4c1edc24dba4c62f8f25ef5603b06c264476#5zD6V:PYLf*jZcL8VbZY#
Admin = true
Nick = admin
AltNick = admin_
Ident = admin
RealName = Got ZNC?
Buffer = 50
AutoClearChanBuffer = true
ChanModes = +stn
LoadModule = chansaver
LoadModule = controlpanel
LoadModule = perform
</User>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment