Recipe for Gregg's Basement Server

  • base netinst install of jessie - deselect everything from tasksel
    • hostname memoryalpha – domain williams.lcl
    • default partition layout (discard, noatime on root)
    • LVM volume group 'ssd' on second drive
  • > /etc/motd
  • apt-get --no-install-recommends install aptitude
  • aptitude install ssh (this will pull in xauth, but that's okay)
  • aptitude install fbset screen rsync psmisc file patch ethtool strace tcpdump vim
  • aptitude --without-recommends install dnsutils
  • adduser tdobes adm
  • aptitude install dbus
  • sed -i -e 's/^deb.* main$/& contrib non-free/g' /etc/apt/sources.list
  • aptitude update && aptitude forget-new
  • aptitude install intel-microcode
  • aptitude install ifplugd
  • adjust /etc/udev/rules.d/70-persistent-net.rules so that eth0 is e1000e NIC
  • sed -i -e 's/^INTERFACES=""/INTERFACES="eth0"/g' /etc/default/ifplugd
  • sed -i -e 's/^allow-hotplug eth0/#allow-hotplug eth0/g' /etc/network/interfaces
  • aptitude --without-recommends install ntp
    echo '[Unit]' > /etc/systemd/system/ntp.service
    echo 'Description=Network Time Protocol daemon' >> /etc/systemd/system/ntp.service
    echo 'After=network.target' >> /etc/systemd/system/ntp.service
    echo >> /etc/systemd/system/ntp.service
    echo '[Service]' >> /etc/systemd/system/ntp.service
    echo 'ExecStart=/usr/sbin/ntpd -n -g -u ntp:ntp' >> /etc/systemd/system/ntp.service
    echo >> /etc/systemd/system/ntp.service
    echo '[Install]' >> /etc/systemd/system/ntp.service
    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/ntp.service
    systemctl enable ntp.service
  • mkdir -p /etc/systemd/system/ssh.socket.d
    echo '[Socket]' > /etc/systemd/system/ssh.socket.d/port-2222.conf
    echo 'ListenStream=2222' >> /etc/systemd/system/ssh.socket.d/port-2222.conf
    systemctl disable ssh.service && systemctl enable ssh.socket
  • mkdir -p /etc/systemd/system/getty\@tty1.service.d
    echo '[Service]' > /etc/systemd/system/getty\@tty1.service.d/noclear.conf
    echo 'TTYVTDisallocate=no' >> /etc/systemd/system/getty\@tty1.service.d/noclear.conf
  • systemctl mask networking.service # we use ifplugd instead
    echo 'D /run/network 0755 root root' > /etc/tmpfiles.d/debian-networking.conf
    echo 'F /run/network/ifstate 0644 root root - lo=lo' >> /etc/tmpfiles.d/debian-networking.conf
  • aptitude purge acpid acpi-support-base # systemd-logind takes care of this
  • sed -i -e 's/^GRUB_CMDLINE_LINUX_DEFAULT="quiet"$/GRUB_CMDLINE_LINUX_DEFAULT="quiet panic=5"/g' /etc/default/grub && update-grub
  • systemctl mask keyboard-setup.service
    systemctl mask console-setup.service
    systemctl mask rc-local.service
  • aptitude --without-recommends install nfs-kernel-server
  • aptitude --without-recommends install lvm2 mdadm bridge-utils ifenslave # when asked about arrays to start at boot, enter root filesystem or leave blank for none
  • aptitude --without-recommends install nut sshfs
  • systemctl disable nut-driver ; systemctl disable nut-monitor
  • aptitude install lsof memtest86+ parted time bzip2 sysstat
  • aptitude --without-recommends install cifs-utils
  • aptitude install unattended-upgrades
  • dpkg-reconfigure -plow unattended-upgrades # select “Yes”
  • sed -i -e 's/^127.0.1.1.*$/# &\n192.168.32.10\tmemoryalpha.williams.lcl\tmemoryalpha\tpvelocalhost/g' /etc/hosts
    
    sed -i -e 's/^iface eth0 inet dhcp$/iface eth0 inet manual\n\tup ifup vmbr0/g' /etc/network/interfaces
    echo >> /etc/network/interfaces
    echo '# bridge for Proxmox' >> /etc/network/interfaces
    echo '# auto vmbr0' >> /etc/network/interfaces
    echo 'iface vmbr0 inet dhcp' >> /etc/network/interfaces
    echo $'\tbridge_ports eth0' >> /etc/network/interfaces
    echo $'\tbridge_stp off' >> /etc/network/interfaces
    echo $'\tbridge_fd 0' >> /etc/network/interfaces
    
    reboot # to activate network changes
  • # see http://pve.proxmox.com/wiki/Package_repositories
    echo '# PVE pve-no-subscription repository provided by proxmox.com, NOT recommended for production use' > /etc/apt/sources.list.d/pve-no-subscription.list
    echo deb http://download.proxmox.com/debian jessie pve-no-subscription >> /etc/apt/sources.list.d/pve-no-subscription.list
    wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
    aptitude update
    # note: proxmox-ve apparently provides vlan, which is why we don't install it earlier
    aptitude install proxmox-ve
    # select "no configuration" for postfix
    aptitude full-upgrade
    # install the package maintainer's version of /etc/default/grub
    
    sed 's/^deb/# deb/g' -i /etc/apt/sources.list.d/pve-enterprise.list
    
    # remove subscription nag popup
    # see http://www.tolaris.com/2013/08/28/removing-the-proxmox-3-1-subscription-nag-dialog/
    # OLD VERSION:
    # pushd / # needed because the new version of patch ignores absolute paths
    # wget http://www.tolaris.com/blog/wp-content/uploads/2013/08/no_subscription_popup_pvemanagerlib.js-3.1.patch -O - | patch -p0
    # popd
    
    # NEW VERSION:
    sed -i.bak "s/data.status !== 'Active'/false/g" /usr/share/pve-manager/ext6/pvemanagerlib.js
  • aptitude purge linux-image-amd64 linux-image-3.16.0-4-amd64 && aptitude install linux-base # tell it “No”, don't abort kernel removal
  • echo '# See /usr/share/postfix/main.cf.dist for a commented, more complete version' > /etc/postfix/main.cf
    echo >> /etc/postfix/main.cf
    echo 'smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)' >> /etc/postfix/main.cf
    echo 'biff = no' >> /etc/postfix/main.cf
    echo >> /etc/postfix/main.cf
    echo "# appending .domain is the MUA's job." >> /etc/postfix/main.cf
    echo 'append_dot_mydomain = no' >> /etc/postfix/main.cf
    echo >> /etc/postfix/main.cf
    echo '# Uncomment the next line to generate "delayed mail" warnings' >> /etc/postfix/main.cf
    echo '#delay_warning_time = 4h' >> /etc/postfix/main.cf
    echo >> /etc/postfix/main.cf
    echo 'alias_maps = hash:/etc/aliases' >> /etc/postfix/main.cf
    echo 'alias_database = hash:/etc/aliases' >> /etc/postfix/main.cf
    echo 'mydestination = $myhostname, localhost.$mydomain, localhost' >> /etc/postfix/main.cf
    echo 'relayhost = ' >> /etc/postfix/main.cf
    echo 'mynetworks = 127.0.0.0/8' >> /etc/postfix/main.cf
    echo 'inet_interfaces = loopback-only' >> /etc/postfix/main.cf
    echo 'recipient_delimiter = +' >> /etc/postfix/main.cf
    echo >> /etc/postfix/main.cf
    echo >> /etc/postfix/main.cf
    /etc/init.d/postfix restart
  • aptitude install zfsutils
  • reboot # to switch to pve kernel (so we can recover backed up files from ZFS)
  • # copy in old /etc/ssh/ssh_host_*
  • aptitude install irqbalance
  • echo $'\n/tank/videos\t192.168.32.0/24(rw,async,no_subtree_check,no_root_squash)\n/tank/music\t192.168.32.0/24(rw,async,no_subtree_check,no_root_squash)\n/tank/photos\t192.168.32.0/24(rw,async,no_subtree_check,no_root_squash)' >> /etc/exports && /etc/init.d/nfs-kernel-server start && exportfs -ra
  • in proxmox web interface: datacenter → storage → add:
    • directory → “software” at /mnt/software/pve containing ISO, Templates - shared
    • ZFS → “tank” on pool “tank” - both disk image and container, thin provision
    • LVM → “ssd” on volume group “ssd” - both disk image and container
  • echo 'options zfs zfs_arc_max=12884901888' > /etc/modprobe.d/zfs.conf # (16 GB * 1024 * 1024 * 1024 * 0.75 == 75% of 16 GB RAM)
  • aptitude install samba
  • mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
  • cat > /etc/samba/smb.conf
    [global]
      security = user
      workgroup = WILLIAMS
      server string = Memory Alpha Storage Server
    
      # try to become browse master
      local master = yes
      # don't use DNS for NetBIOS lookups
      dns proxy = no
      # don't flood DNS servers with useless queries (see manpage; DC lookup still uses DNS)... also disable broadcast resolution
      # name resolve order = wins
      name resolve order = wins host
      # ensure that we follow PAM rules (hopefully this will enforce home directory auto-creation)
      obey pam restrictions = yes
      # no broadcast announcements (we're not using OS/2)
      lm announce = no
    
      # disable print server
      load printers = no
      show add printer wizard = no
      disable spoolss = yes
    
      # logging
      log file = /var/log/samba/log.%m
      # cap logfiles at 1MB
      max log size = 1000
      log level = 2
      # don't send anything to syslog
      syslog = 0
      # mail the admin if we crash
      panic action = /usr/share/samba/panic-action %d
    
      # performance tweaks
      socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE
      use sendfile = yes
      max protocol = SMB3
      # no for ZFS, yes for ext4:
      strict allocate = no
    
      # obtain permissions from parent dir
      inherit permissions = yes
      # drop connections with no open files after 15 minutes of inactivity
      deadtime = 15
      # allow Windows to handle inheritance correctly
      map acl inherit = yes
    
      # hide Apple-specific files from Windows, but delete them if we're deleting a folder
      veto files = /.AppleDesktop/Network Trash Folder/TheVolumeSettingsFolder/.AppleDouble/.AppleDB/.DS_Store/.TemporaryItems/
      delete veto files = yes
    
      create mask = 0664
      directory mask = 0775
    
      # this wreaks all sorts of havoc with symlinks
      unix extensions = no
    
      # emulate DOS attributes using xattr
      store dos attributes = yes
    
    [share]
      comment = Memory Alpha Share
      writable = yes
      path = /tank
      # see https://gist.github.com/steveh/7356e2ba93af5869f385
      dfree command = /usr/local/bin/dfree
    
    #[software]
    #  comment = MCP Software
    #  writable = yes
    #  path = /mnt/software
    #  force user = williams
    #  wide links = yes
    ^D
  • smbpasswd -a -L williams (and enter password)
  • systemctl restart smbd && systemctl restart nmbd
  • copy contents of /usr/local/bin/ from backup (dfree, zfs-get-available, zfs-get-used)
  • aptitude install sudo
  • echo $'\nALL ALL = NOPASSWD: /usr/local/bin/zfs-get-used, /usr/local/bin/zfs-get-available' » /etc/sudoers
  • copy contents of williams home directory from backup (*_jane_backup.sh)
  • copy /var/spool/cron/crontabs/williams from backup
  • chgrp crontab /var/spool/cron/crontabs/williams
  • aptitude install etherwake
  • aptitude install smartmontools
  • # web-based talker:
    aptitude install alsa-utils
    aptitude install espeak
    
    touch '/tank/data/Insteon home automation/voice_message_log.txt'
    chown williams:www-data '/tank/data/Insteon home automation/voice_message_log.txt'
    chmod 664 '/tank/data/Insteon home automation/voice_message_log.txt'
    
    echo '#!/bin/sh' > /usr/local/bin/duck_speak.sh
    echo >> /usr/local/bin/duck_speak.sh
    echo 'CARD=M44' >> /usr/local/bin/duck_speak.sh
    echo 'NORM=145' >> /usr/local/bin/duck_speak.sh # +9.0 dB
    echo 'DUCK=87' >> /usr/local/bin/duck_speak.sh # -20.00 dB
    echo 'CONTROL1=ADC,0' >> /usr/local/bin/duck_speak.sh
    echo 'CONTROL2=ADC,1' >> /usr/local/bin/duck_speak.sh
    echo 'DELAY=.01' >> /usr/local/bin/duck_speak.sh # (145-87)*.01 = 0.58 sec
    echo 'DING=/var/local/ding.wav' >> /usr/local/bin/duck_speak.sh
    echo 'DING_WAIT=0.7' >> /usr/local/bin/duck_speak.sh
    echo "LOG_FILE='/tank/data/Insteon home automation/voice_message_log.txt'" >> /usr/local/bin/duck_speak.sh
    echo >> /usr/local/bin/duck_speak.sh
    echo 'for i in $(seq $NORM -1 $DUCK); do' >> /usr/local/bin/duck_speak.sh
    echo '  amixer -c$CARD -q sset $CONTROL1 $i' >> /usr/local/bin/duck_speak.sh
    echo '  amixer -c$CARD -q sset $CONTROL2 $i' >> /usr/local/bin/duck_speak.sh
    echo '  sleep $DELAY' >> /usr/local/bin/duck_speak.sh
    echo 'done' >> /usr/local/bin/duck_speak.sh
    echo >> /usr/local/bin/duck_speak.sh
    echo 'ALSA_CARD=$CARD aplay -q $DING &' >> /usr/local/bin/duck_speak.sh
    echo 'sleep $DING_WAIT' >> /usr/local/bin/duck_speak.sh
    echo -n 'echo `date +' >> /usr/local/bin/duck_speak.sh
    echo -n "'" >> /usr/local/bin/duck_speak.sh
    echo -n '%a, %b %d, %Y %H:%M:%S (ding) -' >> /usr/local/bin/duck_speak.sh
    echo -n "'" >> /usr/local/bin/duck_speak.sh
    echo -n '` `echo $@ | tr -d ,`' >> /usr/local/bin/duck_speak.sh
    echo -n "'\r'" >> /usr/local/bin/duck_speak.sh
    echo ' >> $LOG_FILE &' >> /usr/local/bin/duck_speak.sh
    echo 'ALSA_CARD=$CARD espeak -v en-us+f2 -s 160 "$@" 2>/dev/null' >> /usr/local/bin/duck_speak.sh
    echo >> /usr/local/bin/duck_speak.sh
    echo 'for i in $(seq $DUCK $NORM); do' >> /usr/local/bin/duck_speak.sh
    echo '  amixer -c$CARD -q sset $CONTROL1 $i' >> /usr/local/bin/duck_speak.sh
    echo '  amixer -c$CARD -q sset $CONTROL2 $i' >> /usr/local/bin/duck_speak.sh
    echo '  sleep $DELAY' >> /usr/local/bin/duck_speak.sh
    echo 'done' >> /usr/local/bin/duck_speak.sh
    chmod +x /usr/local/bin/duck_speak.sh
    
    echo '#!/bin/sh' > /usr/local/bin/warning_speak.sh
    echo >> /usr/local/bin/warning_speak.sh
    echo 'CARD=M44' >> /usr/local/bin/warning_speak.sh
    echo 'NORM=145' >> /usr/local/bin/warning_speak.sh # +9.0 dB
    echo 'DUCK=87' >> /usr/local/bin/warning_speak.sh # -20.00 dB
    echo 'CONTROL1=ADC,0' >> /usr/local/bin/warning_speak.sh
    echo 'CONTROL2=ADC,1' >> /usr/local/bin/warning_speak.sh
    echo 'DELAY=.01' >> /usr/local/bin/warning_speak.sh # (145-87)*.01 = 0.58 sec
    echo 'DING=/var/local/ding-warn.wav' >> /usr/local/bin/warning_speak.sh
    echo 'DING_WAIT=1.9' >> /usr/local/bin/warning_speak.sh
    echo "LOG_FILE='/tank/data/Insteon home automation/voice_message_log.txt'" >> /usr/local/bin/warning_speak.sh
    echo >> /usr/local/bin/warning_speak.sh
    echo 'for i in $(seq $NORM -1 $DUCK); do' >> /usr/local/bin/warning_speak.sh
    echo '  amixer -c$CARD -q sset $CONTROL1 $i' >> /usr/local/bin/warning_speak.sh
    echo '  amixer -c$CARD -q sset $CONTROL2 $i' >> /usr/local/bin/warning_speak.sh
    echo '  sleep $DELAY' >> /usr/local/bin/warning_speak.sh
    echo 'done' >> /usr/local/bin/warning_speak.sh
    echo >> /usr/local/bin/warning_speak.sh
    echo 'ALSA_CARD=$CARD aplay -q $DING &' >> /usr/local/bin/warning_speak.sh
    echo 'sleep $DING_WAIT' >> /usr/local/bin/warning_speak.sh
    echo -n 'echo `date +' >> /usr/local/bin/warning_speak.sh
    echo -n "'" >> /usr/local/bin/warning_speak.sh
    echo -n '%a, %b %d, %Y %H:%M:%S (warning) -' >> /usr/local/bin/warning_speak.sh
    echo -n "'" >> /usr/local/bin/warning_speak.sh
    echo -n '` `echo $@ | tr -d ,`' >> /usr/local/bin/warning_speak.sh
    echo -n "'\r'" >> /usr/local/bin/warning_speak.sh
    echo ' >> $LOG_FILE &' >> /usr/local/bin/warning_speak.sh
    echo 'ALSA_CARD=$CARD espeak -v en-us+f2 -s 160 "$@" 2>/dev/null' >> /usr/local/bin/warning_speak.sh
    echo >> /usr/local/bin/warning_speak.sh
    echo 'for i in $(seq $DUCK $NORM); do' >> /usr/local/bin/warning_speak.sh
    echo '  amixer -c$CARD -q sset $CONTROL1 $i' >> /usr/local/bin/warning_speak.sh
    echo '  amixer -c$CARD -q sset $CONTROL2 $i' >> /usr/local/bin/warning_speak.sh
    echo '  sleep $DELAY' >> /usr/local/bin/warning_speak.sh
    echo 'done' >> /usr/local/bin/warning_speak.sh
    chmod +x /usr/local/bin/warning_speak.sh
    
    adduser www-data audio
  • # copy ding.wav to /var/local/
  • # copy ding-warn.wav to /var/local/
  • aptitude install apache2 php5-fpm
  • a2enmod proxy_fcgi
  • # This apache 2.4/php-fpm configuration works properly with paths including spaces (unlike the deleted one above). See https://wiki.archlinux.org/index.php/Apache_HTTP_Server#Using_php-fpm_and_mod_proxy_fcgi and comments on http://php.net/manual/en/features.http-auth.php about SetEnvIf line
    echo '<FilesMatch \.php$>' > /etc/apache2/mods-enabled/proxy-php5-fpm.conf
    echo '  SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"' >> /etc/apache2/mods-enabled/proxy-php5-fpm.conf
    echo '  SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0' >> /etc/apache2/mods-enabled/proxy-php5-fpm.conf # gets apache to pass http auth credentials to PHP
    echo '</FilesMatch>' >> /etc/apache2/mods-enabled/proxy-php5-fpm.conf
    echo '<Proxy "fcgi://localhost/" disablereuse=off max=10>' >> /etc/apache2/mods-enabled/proxy-php5-fpm.conf
    echo '</Proxy>' >> /etc/apache2/mods-enabled/proxy-php5-fpm.conf
  • # script to talk triggered from ISY:
    mkdir -p /var/www/html/talk
    chown tdobes:tdobes /var/www/html/talk
    echo '<?php' > /var/www/html/talk/talk.php
    echo >> /var/www/html/talk/talk.php
    echo "header('Content-Type: text/plain');" >> /var/www/html/talk/talk.php
    echo >> /var/www/html/talk/talk.php
    echo -n 'if ($_SERVER[' >> /var/www/html/talk/talk.php
    echo "'REQUEST_METHOD'] == 'POST') {" >> /var/www/html/talk/talk.php
    echo -n '  $say = file_get_contents(' >> /var/www/html/talk/talk.php
    echo "'php://input');" >> /var/www/html/talk/talk.php
    echo '} else {' >> /var/www/html/talk/talk.php
    echo -n '  $say = $_GET[' >> /var/www/html/talk/talk.php
    echo "'say'];" >> /var/www/html/talk/talk.php
    echo '}' >> /var/www/html/talk/talk.php
    echo >> /var/www/html/talk/talk.php
    echo -n 'system(' >> /var/www/html/talk/talk.php
    echo -n "'" >> /var/www/html/talk/talk.php
    echo -n '/usr/local/bin/duck_speak.sh "' >> /var/www/html/talk/talk.php
    echo -n "'" >> /var/www/html/talk/talk.php
    echo -n '. $say .' >> /var/www/html/talk/talk.php
    echo -n "'" >> /var/www/html/talk/talk.php
    echo -n '"' >> /var/www/html/talk/talk.php
    echo "');" >> /var/www/html/talk/talk.php
    echo "echo 'done';" >> /var/www/html/talk/talk.php
    chown tdobes:tdobes /var/www/html/talk/talk.php
    
    echo '<?php' > /var/www/html/talk/warning.php
    echo >> /var/www/html/talk/warning.php
    echo "header('Content-Type: text/plain');" >> /var/www/html/talk/warning.php
    echo >> /var/www/html/talk/warning.php
    echo -n 'if ($_SERVER[' >> /var/www/html/talk/warning.php
    echo "'REQUEST_METHOD'] == 'POST') {" >> /var/www/html/talk/warning.php
    echo -n '  $say = file_get_contents(' >> /var/www/html/talk/warning.php
    echo "'php://input');" >> /var/www/html/talk/warning.php
    echo '} else {' >> /var/www/html/talk/warning.php
    echo -n '  $say = $_GET[' >> /var/www/html/talk/warning.php
    echo "'say'];" >> /var/www/html/talk/warning.php
    echo '}' >> /var/www/html/talk/warning.php
    echo >> /var/www/html/talk/warning.php
    echo -n 'system(' >> /var/www/html/talk/warning.php
    echo -n "'" >> /var/www/html/talk/warning.php
    echo -n '/usr/local/bin/warning_speak.sh "' >> /var/www/html/talk/warning.php
    echo -n "'" >> /var/www/html/talk/warning.php
    echo -n '. $say .' >> /var/www/html/talk/warning.php
    echo -n "'" >> /var/www/html/talk/warning.php
    echo -n '"' >> /var/www/html/talk/warning.php
    echo "');" >> /var/www/html/talk/warning.php
    echo "echo 'done';" >> /var/www/html/talk/warning.php
    chown tdobes:tdobes /var/www/html/talk/warning.php

Streaming Music Addition

#adduser --system --home /nonexistent --no-create-home --disabled-password --group stream
adduser --system --home /nonexistent --no-create-home --disabled-password --ingroup audio stream

aptitude install icecast2 # select "No" to skip configuration; it seems to be broken and doesn't actually edit anything… WTF?

sed -i -e 's/\(<location>\).*\(<\/location>\)/\1Williams House\2/g' -e 's/\(<admin>\).*\(<\/admin>\)/\1gregg.williams@gmail.com\2/g' -e 's/\(<sources>\).*\(<\/sources>\)/\110\2/g' -e 's/\(<source-password>\).*\(<\/source-password>\)/\1**PASSWORD**\2/g' -e 's/\(<relay-password>\).*\(<\/relay-password>\)/\1**PASSWORD**\2/g' -e 's/\(<admin-password>\).*\(<\/admin-password>\)/\1**PASSWORD**\2/g' -e 's/\(<hostname>\).*\(<\/hostname>\)/\1memoryalpha.williams.lcl\2/g' /etc/icecast2/icecast.xml
sed -i 's/ENABLE=false/ENABLE=true/g' /etc/default/icecast2
systemctl restart icecast2
systemctl enable icecast2

aptitude install darkice
sed -i -e 's/RUN=no/RUN=yes/g' -e 's/USER=nobody/USER=stream/g' /etc/default/darkice

echo '[general]' > /etc/darkice.cfg
echo 'duration        = 0         # duration of encoding, in seconds. 0 means forever' >> /etc/darkice.cfg
echo 'bufferSecs      = 2         # size of internal slip buffer, in seconds' >> /etc/darkice.cfg
echo 'reconnect       = yes       # reconnect to the server(s) if disconnected' >> /etc/darkice.cfg
echo >> /etc/darkice.cfg
echo '[input]' >> /etc/darkice.cfg
echo 'device          = plughw:M44' >> /etc/darkice.cfg
echo 'sampleRate      = 44100' >> /etc/darkice.cfg
echo 'bitsPerSample   = 16' >> /etc/darkice.cfg
echo 'channel         = 2' >> /etc/darkice.cfg
echo >> /etc/darkice.cfg
echo '[icecast2-0]' >> /etc/darkice.cfg
echo 'bitrateMode     = vbr' >> /etc/darkice.cfg
echo 'format          = vorbis' >> /etc/darkice.cfg
echo 'quality         = 0.6' >> /etc/darkice.cfg
echo 'server          = localhost' >> /etc/darkice.cfg
echo 'port            = 8000' >> /etc/darkice.cfg
echo 'password        = **PASSWORD**' >> /etc/darkice.cfg
echo 'mountPoint      = house.ogg' >> /etc/darkice.cfg
echo 'name            = Williams House Audio Stream' >> /etc/darkice.cfg
echo 'description     = Live streaming audio from whole-house sound system' >> /etc/darkice.cfg
echo 'public          = yes' >> /etc/darkice.cfg

echo '[Unit]' > /etc/systemd/system/darkice.service
echo 'Description=DarkIce Live Audio Streamer' >> /etc/systemd/system/darkice.service
echo 'After=sound.target icecast2.service' >> /etc/systemd/system/darkice.service
echo >> /etc/systemd/system/darkice.service
echo '[Service]' >> /etc/systemd/system/darkice.service
echo 'ExecStart=/usr/bin/darkice' >> /etc/systemd/system/darkice.service
echo 'User=stream' >> /etc/systemd/system/darkice.service
echo 'LimitRTPRIO=95' >> /etc/systemd/system/darkice.service # when running from a systemd service, it ignores /etc/security/limits.conf
echo 'LimitMEMLOCK=infinity' >> /etc/systemd/system/darkice.service # when running from a systemd service, it ignores /etc/security/limits.conf
echo >> /etc/systemd/system/darkice.service
echo 'Restart=always' >> /etc/systemd/system/darkice.service
echo 'RestartSec=1' >> /etc/systemd/system/darkice.service
echo >> /etc/systemd/system/darkice.service
echo '[Install]' >> /etc/systemd/system/darkice.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/darkice.service

systemctl enable darkice
systemctl start darkice
echo '<html>' > /var/www/html/index.html
echo '<head>' >> /var/www/html/index.html
echo '<title>Basement Server</title>' >> /var/www/html/index.html
echo '<style type="text/css">' >> /var/www/html/index.html
echo 'body {' >> /var/www/html/index.html
echo '  background: #000;' >> /var/www/html/index.html
echo '  color: #f33;' >> /var/www/html/index.html
echo '}' >> /var/www/html/index.html
echo 'a {' >> /var/www/html/index.html
echo '  color: #faa;' >> /var/www/html/index.html
echo '}' >> /var/www/html/index.html
echo '</style>' >> /var/www/html/index.html
echo '</head>' >> /var/www/html/index.html
echo '<body>' >> /var/www/html/index.html
echo '<h1>Basement Server</h1>' >> /var/www/html/index.html
echo '<ul>' >> /var/www/html/index.html
echo '<li><a href="http://memoryalpha.williams.lcl:8000/">Live Streaming Music</a></li>' >> /var/www/html/index.html
echo '<li><a href="https://memoryalpha.williams.lcl:8006/">Proxmox VE Admin Interface</a></li>' >> /var/www/html/index.html
echo '</ul>' >> /var/www/html/index.html
echo '</body>' >> /var/www/html/index.html
echo '</html>' >> /var/www/html/index.html

# control of X-Air mixer

aptitude install liblo-tools python-liblo pyliblo-utils
computer/gregg_basement_server.txt · Last modified: 2018/11/10 20:50 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS