HOWTO: PlexConnect with own IP via LXC

  • PlexConnect & Apple TV need to have ports 80 & 443. Instead of using port redirection i opted to do this via LXC container.


    Heres a HowTo for OMV 1.19+. Please note that im using static DHCP mappings, you have to change the network sections if you want to use manual IP. And its a plain config, so if needed please take care to harden your LXC container (iptables, ssh and so on).


    Word of wisdom: you shouldnt do that like me as root, use sudo instead ;)


    ----


    # prepare Network for lxc:


    # edit /etc/network/interfaces (example for ipv4 & dhcp static lease only, adjust if needed)


    --- snip ---
    # The primary network interface
    #allow-hotplug eth0
    #iface eth0 inet dhcp
    auto eth0
    iface eth0 inet manual
    #iface eth0 inet6 manual


    auto br0
    iface br0 inet dhcp
    bridge_ports eth0
    bridge_fd 0
    bridge_maxwait 0
    #bridge_hello 0
    #bridge_maxage 0
    #bridge_stp off
    --- snap ---


    # restart network


    service network restart


    # check network settings


    ifconfig


    # lxc install


    # Install required packages


    apt-get install lxc


    # Install optional packages


    apt-get install bridge-utils libvirt-bin debootstrap


    # edit /etc/fstab:


    --- snip ---
    cgroup /sys/fs/cgroup cgroup defaults 0 0
    --- snap ---


    # check fstab entry:


    mount /sys/fs/cgroup


    # check lxc config:


    lxc-checkconfig


    # The lxc-checkconfig program is reporting "Cgroup memory controller: missing". If you want memory control via cgroups then you need to recompile the linux kernel (or simply add cgroup_enable=memory to the kernel command line on jessie or later).

    # Template installation (the Templates included in Wheezy dont work):


    wget https://github.com/simonvander…debian-wheezy-robvdhoeven -O /usr/share/lxc/templates/lxc-debian-wheezy
    chown root:root /usr/share/lxc/templates/lxc-debian-wheezy
    chmod +x /usr/share/lxc/templates/lxc-debian-wheezy


    # create Plexconnect container


    lxc-create -n plexconnect -t debian-wheezy


    # edit /var/lib/lxc/plexconnect/config


    --- snip ---
    lxc.utsname = plexconnect
    lxc.network.type = veth
    lxc.network.flags = up
    lxc.network.link = br0
    lxc.network.hwaddr = xx:xx:xx:xx:xx:xx # {mac address for container}
    # if not using static dhcp leases you will need this sections too:
    #lxc.network.ipv4 = xxx.xxx.xxx.xxx/xx # {ip address for plexconnect container / netmask }
    #lxc.network.ipv4.gateway = xxx.xxx.xxx.xxx # {ip address of gateway }
    --- snap ---



    # start container
    lxc-start -n plexconnect -d


    # container status
    lxc-info -n plexconnect


    # make plexconnect container autostart


    ln -s /var/lib/lxc/plexconnect/config /etc/lxc/auto/plexconnect


    # login to container
    lxc-console -n plexconnect


    # from here everything is done inside the plexconnect container


    # login as root/root


    # change root password
    pwd root


    # edit /etc/network/interfaces (example for dhcp static lease, change for manual ip if needed)


    --- snip ---
    auto lo
    iface lo inet loopback


    auto eth0
    iface eth0 inet dhcp
    --- snap ---


    # restart network
    service networking restart


    # check network config
    ifconfig


    # install python & git


    apt-get install python git


    # install plexconnect


    cd /opt
    git clone https://github.com/iBaa/PlexConnect.git


    # create certificate for ATV


    cd /opt/PlexConnect/
    cd assets/certificates/
    openssl req -new -nodes -newkey rsa:2048 -out trailers.pem -keyout trailers.key -x509 -days 7300 -subj "/C=US/CN=trailers.apple.com"
    openssl x509 -in trailers.pem -outform der -out trailers.cer && cat trailers.key >> trailers.pem


    # start PlexConnect to create basic settings


    ./PlexConnect.py


    <Ctrl-C>


    # edit /opt/PlexConnect/Settings.cfg
    # for more info: https://github.com/iBaa/PlexCo…d-use-and-troubleshooting


    --- snip ---
    ip_pms = xxx.xxx.xxx.xxx # {IP of Plex Host = OMV IP}
    enable_plexgdm = False


    --- snap ---


    # start PlexConnect


    ./PlexConnect_daemon.bash start
    ./PlexConnect_daemon.bash status


    # for ATV configuration see https://github.com/iBaa/PlexConnect/wiki/Install-Guide


    # stop PlexConnect
    ./PlexConnect_daemon.bash stop


    # Create Auto Startup File for PlexConnect


    # edit /etc/init.d/plexconnect


    --- snip ---


    --- snap ---


    chmod +x /etc/init.d/plexconnect


    update-rc.d plexconnect defaults


    # start plexconnect


    /etc/init.d/plexconnect start


    -----


    Have Fun!


    Btw. it was my first experience with LXC, maybe there is room for improvement ;)

    Tom


    ----


    HP N54L, 6GB, 5disc Raid5, SSD Boot with OMV 5
    HP N54L, 16GB, 4disc ZFS pool, SSD Boot with other NAS system

    4 Mal editiert, zuletzt von tom_tav ()

    • Offizieller Beitrag

    Looks interesting. You should put a lot of that post in code boxes :)

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.6 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • jaja i know ;) im already happy that i did note the steps this night so i could post this. And as you can see, my bad habits to do that stuff as root user ... LOL


    If there will be a howto section here i promise to make it more presentable :)


    Next project will be Transmission inside LXC (for own ip to do better traffic shaping)

    Tom


    ----


    HP N54L, 6GB, 5disc Raid5, SSD Boot with OMV 5
    HP N54L, 16GB, 4disc ZFS pool, SSD Boot with other NAS system

    Einmal editiert, zuletzt von tom_tav ()

    • Offizieller Beitrag

    We do have a guide section with a thread just on the template wanted for guides.

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.6 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • ha you got me. will try to make a nice version during the next days.

    Tom


    ----


    HP N54L, 6GB, 5disc Raid5, SSD Boot with OMV 5
    HP N54L, 16GB, 4disc ZFS pool, SSD Boot with other NAS system

  • Btw. there is a bug in the start-stop-daemon / init scripts. If you have running lets say sshd on the host and inside the container you have also sshd running - "service sshd stop" on the host will stop also the sshd inside the container. This is because the pid is not handled by the init scripts and so a host init script kills all instances, even those inside containers (the container instances are also in the host ps list). Bug is known since 2011 (maybe before) and still unfixed ... bummer


    p.s. used sshd just for example, didnt check if the bug affects this service

    Tom


    ----


    HP N54L, 6GB, 5disc Raid5, SSD Boot with OMV 5
    HP N54L, 16GB, 4disc ZFS pool, SSD Boot with other NAS system

    Einmal editiert, zuletzt von tom_tav ()

  • Debian does not embrace the use of sudo like Ubuntu does. ;)


    Greetings
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!