Sunday, February 28, 2016

How to install Plex Server (FREE) on your Proxmox

Plex is a media server. It is a mature project with native Apps on many popular TVs, Tablets, Computers and Phones.

Plex Media Server will help you catalog and playback your Movies, Videos, and Photos over your local network or over the internet.

Plex Media Server is FREE to download and install on your server. As of this writing Plex supports Mac, Windows, and Linux.  They are able to deliver this on multi-platform because they use Java.

I am using my Low Cost and Low Powered Home Proxmox Server I have described here:

http://proxmox-openvz.blogspot.com/2015/11/proxmox-v4x-mini-home-server-with-less.html

Here is a link to Plex's features:

https://plex.tv/features

I use Plex Media Server on my home (Proxmox) server so that my family can easily browse, search and playback home movies, videos and photos easily in almost every electronic device we have on our home.  For example we can have slideshow of our most recent vacation displayed on our living room Smart TV.

BTW, Plex Media Server can also be used on most major browser, which means if you Smart TV have an Android like (webkit) type of browser, it will most likely be able to be used as a Plex client. Which means you can playback movies, videos and photos on your TV using its built-in browser.

If you have a Roku, you can use its Plex Client App.

On you phones and tablets, you can download Plex App (not free), or you can just use your browser (free).

I hope that is a good introduction and enough to get you interested in Plex Media Server.

Lets get down to business about how to install Plex Media Server to your Proxmox Linux container:

Pre-Requisites:


  • Proxmox server any version (you can use OpenVZ / LXC does not matter).
  • Linux Container with Ubuntu 12.04 or higher
  • Plex Media Server Debian package from: https://plex.tv/downloads


Installation Steps:

Update your packages:

apt-get update

Download Plex Media Server package:

wget https://downloads.plex.tv/plex-media-server/0.9.12.19.1537-f38ac80/plexmediaserver_0.9.12.19.1537-f38ac80_amd64.deb

Install Plex Media Server package:

dpkg -i plexmediaserver_0.9.12.19.1537-f38ac80_amd64.deb


(optional) Mount your file server's directories:

See this article to learn how to mount external directory to your Plex Media Server


Go to your browser to set initial settings (my server is on local IP 192.168.1.11:

http://192.168.1.11


Add a channel (I am adding my Home Videos first):




Then, select "as many" folders from your server to be included as part of this channel:



This is what my Home Video channel setting looks like after I added 2 folders:



Scan for Videos inside the channel to index new videos:



Then, you should repeat the above steps to create more channels.  I have the following channels on my Plex Media Server (for example):

Home Videos
Movies
Photos


Configure Setting to Auto-Scan Periodically / Automatically:




THAT IS ALL!

You now have a fully functioning Plex Media Server running on your Home Proxmox Server.
Everytime somebody adds a new Movie, Photo or Video, Plex Media Server will automatically scan and update its database.  And now everybody in your home can easily enjoy these media on any device in your home!!!






Tuesday, February 23, 2016

How to add a shared directory between OpenVZ containers?

This is how I share a directory between 2 or more OpenVZ containers.  Basically I use a process called:

Mounting a Directory from Hardware Node:

http://proxmox-openvz.blogspot.com/2016/02/how-to-mount-directory-from-hardware.html


When you are able to mount a directory from Hardware Node you can have many OpenVZ containers mounting the same directory, which makes sharing directory between OpenVZ containers a reality.

You can even share directory between different physical servers. To do this, just create a network file sharing directory between your physical servers first (for example you can use NFS). Then you can mount all of these NFS mounted directories into your OpenVZ containers.

Simple and it works!

How to mount a directory from hardware node inside OpenVZ container

Sometime it is handy to be able to access a directory from the bare-metal hardware node itself.

One common use of this technique for me is to mount a shared SSD drive which is used by many OpenVZ containers. Since the SSD drive is mounted directly to the bare-metal OS for ie: /mnt/ssd.

Another purpose is to be able to have a common shared directory in the bare-metal server shared between many OpenVZ containers on that server.  The shared directory can even be an NFS Server which means you can have a shared directory between many OpenVZ located in different hardware nodes!  Now that is Cool!

Anyways this is the technique:

1. CREATE THE DESTINATION DIRECTORY

Login to the OpenVZ container where you will be mounting, create the directory and assign all permission. (in this example we will use /mnt/shared_dir as the destination directory path)

mkdir /mnt/shared_dir
chmod 777 /mnt/shared_dir

2. CREATE .mount FILE

Login to shell of your Proxmox hardware node to create <vmid>.mount file.
(in this example you should replace <vmid> with your actual OpenVZ container ID)
(in this example we assume you are trying to share /mnt/ssd from your hardware node)

cd /etc/pve/openvz
nano <vmid>.mount

Type in the following content in your <vmid>.mount file:

#!/bin/bash
. /etc/vz/vz.conf
. ${VE_CONFFILE}
SRC=/mnt/ssd
DST=/mnt/shared_dir
if [ ! -e ${VE_ROOT}${DST} ]; then mkdir -p ${VE_ROOT}${DST}; fi
mount -o noatime -n -t simfs ${SRC} ${VE_ROOT}${DST} -o ${SRC}


3. RESTART THE OPENVZ CONTAINER and TEST

Once you restart your OpenVZ, log into it and issue the following command:

df -h

You should see a new row describing your newly mounted directory.

mount

The mount command can also help you confirm it has been mounted.

What are the differences between LXC and OpenVZ?

Differences between LXC and OpenVZ

There are many articles showing tables and matching feature by feature between LXC and OpenVZ. However I was looking for the 'differences' only, which in my opinion makes all the 'difference'. :-) Just kidding. Anyhow I did some research and as of my writing today Feb 23, 2016 here are the major differences between LXC and OpenVZ that you should know:

LXC

  • built into linux kernel
  • pretty young (started 1st first 0.1.0 released in 2008)
  • Isolation method: use Cgroups and Namespaces
  • Does not support Live Migration yet (as of Feb 2016)
  • No Storage I/O priority
  • Partial Container Lockdown
  • Can Not limit kernel memory usage


OpenVZ

  • patched kernel
  • shared same developers as LXC (but started earlier)
  • Isolation method: use Jails or Zones
  • Support Live Migration
  • Has Storage I/O priority
  • Full Container Lockdown
  • Can limit kernel memory usage