This works well for me, and I hope it will for you too...
Code: Select all
First you need to find a container image for LMS. There are several ways to do this, and here is one:
Start Container Station from App Center and click +Create Container.
In the search bar, type Logitech and hit return
You should see 4 repositories along the top of the list:
Recommended, Local, IoT and Docker Hub
The search function will stop at the first hit going from left to right.
So if you already have a container package downloaded locally whose name contains the word "logitech", it will find it and stop the search.
To search in the other repositories, you have to click on the "Docker Hub". That should give you a long list of packages to choose from - all with names that contain the word "Logitech". Which package to choose, is up to you. You may have to try and fail a few times before you find one that works. A good tip is to check the version box to see what is actually available. You will probably want to have a reasonably recent version. And don't be fooled by the word "latest" which is always default. It is no guarantee that it actually is the latest. But anyway, I will explain to you later how to upgrade as long as you can find an image that will install and run in Container Station.
Trial and error here is relatively harmless - which is the whole point of Container station. If something goes wrong - just remove the container and try again.
Once you have chosen which package you want to install, click on install. In the create container window, you can change the name of the package you are about to install along with a few other parameters, but that is not so important now.
However, in order for Logitech Media Server (LMS) to be able to retrieve data from, and pass data to, the outside of the container, you must mount Shared folders for it to use. Most likely your music collection is stored outside the container (it's not a good idea to store media files inside containers as they will vanish when (if) you remove the container.
Also, you need to consider how you want port mapping to be handled. By default, Container station will configure the container network in bridge mode (NAT) with an internal network in the 10.x.x.x range while your NAS probably is connected to a 192.168.x.x network. The default LMS ports (9000, 9090 and 3483) are mapped into random port numbers which change every time you start and stop the container (which means also every time you reboot your NAS). This is not very practical - for obvious reasons. So instead you'll be more happy to configure the containers in host mode. That way, the container becomes part of the NAS network and no port mapping takes place. Of course there are disadvantages with this also. The container suddenly becomes less isolated and vulnerable to external problems. This is a security issue you have to consider.
Click on the "Advanced Setting" and then in the menu on the left side click on Network. Then change the NAT field to host.
Then move down to the Shared Folder section. In this section, you may see that some volumes are already set, i.e. /data or /media. If that is fine with you, you could use it as is, but my recommendation is that you create your own folder link - one for Music and one for Playlists. If you intend to have other folders in the future, now is a good time to establish them all. One folder which is important to create is folder where LMS can store dynamic data. This folder is named /state and you should point it to a share easily accessible to yourself. (I have not been able to figure out how to do that later, but I'm sure it can be done). If you do not point /state to a shared folder with read/write access, it will be stored under /share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes and this may cause access right conflicts.
In the "New Volume" field, type i.e. /media/Music
Then in the Mount Point under "Volume From Host" type the same (mind you that names are case sensitive).
Then in the host path, select the share that you wish to make available to the container. You will only be able to select shares already established in the NAS (QTS), so unless you have already done so - you must terminate and share you music folder first (using File Station) along with any other folders you wish to use (Playlists, state etc.)
If your Music library has a lot of subfolders (several thousands), then it may take a while before the setup page becomes responsive - and you can finally click on "create".
Now the package is downloaded from the repository and the container is created. This can take a while depending on your internet connection speed. These packages are often several hundred megabytes in size. Just be patient. You can follow the progress in the console window and by clicking on the background task icon (the inbox icon in the upper right corner of the window).
Once installation is completed, Logitech Media Server is started and it takes some time before it gets setup properly and the URL becomes visible in the container window. You cannot access LMS until the URL comes alive. Ones the URL shows up, it should be clickable as an active link that will take you to a new tab in your browser and open the default LMS Web GUI.
Some houskeeping info:
When you installed Container Station itself the first time, you were asked which folder to store images and containers in. This folder should typically be somewhere on you NAS. You find the location for this folder if you open the Contain Settings for your LMS container and look under Advanced Setting in the Shared Folder section. It will typically look someting like this:
where <default folder> is the folder you specified during installtion of Container Station.
In fact, if you navigate to <default folder>/container-station-data/lib/docker/volumes/ you will find all your containers there (several weird hexadecimal loooong foldernames, one for each container - including also old containers you may have removed (but those folders should be empty). So, as you can conclude from this - application data (not all) stored inside the container, is copied to this outside folder. This means you can get access to log files even after the a major container crash. But be sure not to run around in these folder and do stuff while the container is running.
Also, you should check the time and date setting of your container. For some obscure reason, container station does not pick up the timezone from you NAS. So you may have to change this to get corret timestamps on all log items. In order to check (and correct the time), you need to SSH into the container:
1. Open the container status page for LMS in Container Station and copy the Container ID.
2. SSH into your NAS
3. type 'docker exec -i -t <contianer-ID> bash' (without the quotes) on the command line.
4. That should take you into the container and you should see a prompt like this: root@<your-NAS-name>:/#
5. If you live in Singapore, type:
echo "Asia/Singapore" > /etc/timezone
You will find the syntax for every other place on earth here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
6. Now restart you container to see if everything is ok.
From here on, the rest is up to you.
Oh, I promised to tell you how to upgrade.
Most likely, the package you downloaded is not the most recent version of LMS. If not, LMS will tell you so in the status bar on the main Web GUI page. If there's nothing there - don't worry. Then you have the most recent version.
But if not, and you wish to upgrade, then here's how:
(This assumes that you know how to get around in LMS)
A. Cancel any ongoing media scans (LMS initiates a scan automatically when launched)
B. Click on the upgrade link which will take you to the LMS updates page. Here you should click on the "Click here for further information" which moves you onward to the information page which will give you a step by step guide on what to do. The important part there is the command including the correct path in order to do the upgrade. Make a copy of that command line for later use (store it in Notepad or somewhere else).
This command typically looks something like this:
sudo dpkg -i /srv/squeezebox/cache/updates/logitechmediaserver_7.9.0~1466175427_amd64.deb
Now, what you do not see, is that LMS downloads the deb package in the background, and because these packages can be rather large, you must not interrupt, close or stop LMS while it is still downloading. There is, regretfully, no easy way to tell when it is finished downloading except peeking into the container and looking at the content in the above given path. But if you know your internet connection speed fairly well, you have a rough idea how much time it takes to download approximately 50-100Mb (?). To be on the safe side, take a half hour nap before moving on. Your upgrade will fail if the download is not complete.
Then you need to SSH inside the container to get terminal access. Here is how:
1. Open the container status page for LMS in Container Station and copy the Container ID.
2. Use Putty (or whatever terminal emulator you like) and log into your NAS
3. Type: "docker exec -i -t <your CONTAINER ID> bash" replacing <your CONTAINER ID> with the ID you found.
4. Once inside the container, you should see something like: root@<name_of_your_NAS>:/#
5. Then type the command that you found in step B above: sudo dpkg -i /srv/squeezebox/cache/updates/logitechmediaserver_7.9.0~1466175427_amd64.deb
(replace the path and the package name with what you found)
6. Be patient. It takes a while to unpack, install and setup LMS. You will get the prompt back in the end.
7. log out of the container by typing exit
Now the updated version has been installed on top of the old one. All you need to do now is to stop and restart the container. You do that from container station itself. If everything goes well and you can finally open up the LMS web GUI again, check that you now have the updated version.
Congratulations. You're good to go!
Edit Dec. 8 2016: I have found it to be a good housekeeping practice to update/upgrade the linux version inside the container. In fact, sometimes I had to in order to be able to install a new version of the app. An example was when Madsonic upgraded to Java8. The new version could not be installed unless Java first had been upgraded.
The easiest way I have found to do this, is as follows:
1. SSH into the container (see above)
2. Type the following commands:
The above should be done before you upgrade LMS, and my advice is to add this as a good habit whether needed or not.
If you run into dependencies problems, just type:
apt-get -f install
Then reinstall (upgrade) everything again.
I am successfully running not only LMS in a container, but also Plex and Madsonic, all using the same Music library. For obvious reasons, it doesn't make much sense to run Kodi (XBMC) in a container as Kodi is not a server, and the main purpose of Kodi is to shine on you living room TV. I haven't found a way to make the HDMI i/f available to a container. I guess that's why QNAP released Linux Station and HD Station (?) :lol:
[Edit] Since I wrote this guide, I have decided to replace the container image I first used, with another - in my opinion - better image, that - among other things - support automatic update to new versions of LMS by simply restarting the container. This image is called: justifiably/logitechmediaserver. You will find it if you search for the word "justifiably" under Create Container
[Edit1] I just updated to QTS 4.3.3 and CS was automatically updated to 1.7.2320 and everything works just fine on first reboot.
[Edit2] Added recommendation to assign a share folder location in CS Advanced Setting to /state, in order to prevent access privilege errors which I've had some reports of.