This is an old revision of the document!

Recipe for Mike Radio Container

LXC Container - Debian 9

  • Create CT: debian 9.4 lxc template, 4 cpu limit, 20 gb hdd, 1024 mb ram, 512 mb swap
  • enable fuse container (see<code> echo $'lxc.autodev: 1\nlxc.hook.autodev: sh -c “mknod -m 0666 ${LXC_ROOTFS_MOUNT}/dev/fuse c 10 229”' » /etc/pve/lxc/###.conf </code>
  • add mounts of old container to new container e.g. pct set 106 --mp0 ssd160gbthin:vm-106-disk-1,mp=/mnt/old
  • pct start 206 && pct enter 206
  • …in the container…
  • reset the root password (since proxmox sets it using an older, less-secure hashing algorithm): passwd
  • migrate users:
    tail -n4 /mnt/old/etc/passwd | head -n2 >> /etc/passwd
    tail -n4 /mnt/old/etc/shadow | head -n2 >> /etc/shadow
  • migrate groups:
    tail -n3 /mnt/old/etc/group | head -n2 >> /etc/group
    tail -n3 /mnt/old/etc/gshadow | head -n2 >> /etc/gshadow
  • use console:
    adduser tdobes adm
    adduser tdobes systemd-journal
    adduser tdobes staff
    adduser mike staff

    …now you can ssh in

  • sed -i -e 's/"syntax on/syntax on/g' -e 's/"set background=dark/set background=dark/g' -e 's/"set showcmd/set showcmd/g' -e 's/"set showmatch/set showmatch/g' -e 's/"set ignorecase/set ignorecase/g' -e 's/"set smartcase/set smartcase/g' -e 's/"set incsearch/set incsearch/g' -e 's/"set autowrite/set autowrite/g' -e 's/"set hidden/set hidden/g' -e 's/"set mouse=a/set mouse=nic/g' /etc/vim/vimrc
  • vi /etc/vim/vimrc # – and uncomment autocmd block for jumping to last position
  • aptitude update && aptitude forget-new && aptitude full-upgrade
  • aptitude install ca-certificates
  • aptitude install icecast2 # select “No” to skip configuration; it seems to be broken and doesn't actually edit anything… WTF?
  • setup icecast:
    sed -i -e 's/\(<location>\).*\(<\/location>\)/\1Hobart, IN\2/g' -e 's/\(<admin>\).*\(<\/admin>\)/\\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>\)/\\2/g' /etc/icecast2/icecast.xml
    sed -i 's/ENABLE=false/ENABLE=true/g' /etc/default/icecast2
    systemctl restart icecast2
  • aptitude --without-recommends install mpd mpc ncmpc
  • merge in changes from /mnt/old/etc/mpd.conf into /etc/mpd.conf and migrate over mpd state:
    systemctl stop mpd.service
    diff -u /mnt/old/etc/mpd.conf.orig /mnt/old/etc/mpd.conf > ~/mpdconf.diff || cp -p /etc/mpd.conf /etc/mpd.conf.orig && cd / && patch -p3 < ~/mpdconf.diff && cd - && rm ~/mpdconf.diff
  • migrate ssh keys: cp -a /mnt/old/etc/ssh/ssh_host_*key* /etc/ssh/
  • migrate homes: rsync -aix --del /mnt/old/home/ /home/
  • migrate recordings: rsync -aix --del /mnt/old/var/local/music /var/local/ && chown -R mpd /var/local/music/recordings
  • migrate playlists: rsync -aix --del /mnt/old/var/lib/mpd/playlists/ /var/lib/mpd/playlists/ && chown -R mpd /var/lib/mpd/playlists
  • start mpd and update database: systemctl start mpd && sleep 2 && mpc update
  • migrate mpd state:
    systemctl stop mpd
    cp -a /mnt/old/var/lib/mpd/state /var/lib/mpd/state && chown mpd /var/lib/mpd/state
    systemctl start mpd
    mpc play # not sure why this is needed, but running it anyway


computer/mike_radio_container_recipe.1529432809.txt.gz · Last modified: 2018/06/19 13:26 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS