Sunday, September 2, 2018

My personal Xubuntu htpc/server setup

1. Install Xubuntu

Enable auto login https://askubuntu.com/questions/530072/how-to-auto-login-in-xubuntu
Install Chrome
Install Chrome Remote Desktop + make it use same windows server...
Using Vino instead

2. Install Emby

Mount my external HDD for Emby to have full control:
https://emby.media/community/index.php?/topic/32218-file-permissions-guide-for-new-linux-users/ and https://askubuntu.com/questions/502727/how-do-i-automount-partitions-on-statup-xubuntu-14-04,
also some bonus information for possible future use:
https://emby.media/community/index.php?/topic/37535-building-emby-in-ubuntu-server/

Autostart Emby https://emby.media/community/index.php?/topic/31993-emby-server-doesnt-autostart/
service file location /etc/systemd/system/multi-user.target.wants/emby-daemon.service
config /etc/emby-server.conf
[Service]
ExecStartPre=/bin/sleep 30

3. Install Kodi

Fix libcec https://forum.kodi.tv/showthread.php?tid=226183

4. Install Dropbox

Fix Dropbox...

5. Install Docker and a few containers


sudo docker run -d --name portainer --restart=always -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

Get the containers and some instructions from https://gitlab.com/hotio/suitarr/blob/apps/README.md and https://www.smarthomebeginner.com/install-sonarr-using-docker/

sudo docker run -d --name sonarr --restart=always -p 8989:8989 -e PUID=1000 -e PGID=1000 -e UMASK=022 -e VERSION=image -v /etc/localtime:/etc/localtime:ro -v /home/docker/sonarr/config:/config -v /mnt/my_passport/TV\ Series:/tv -v /home/docker/sonarr/downloads:/downloads hotio/suitarr:sonarr

Important: Sonarr needs adjustments in Settings -> Download CLient -> Remote Path Mappings

sudo docker run -d --name jackett --restart=always -p 9117:9117 -e PUID=1000 -e PGID=1000 -e UMASK=022 -e VERSION=image -v /etc/localtime:/etc/localtime:ro -v /home/docker/jackett/config:/config hotio/suitarr:jackett

6. And finally the web server

https://lowendbox.com/blog/how-to-setup-apache-virtual-hosts-on-ubuntu-16-04/
Required for WordPress: https://www.digitalocean.com/community/tutorials/how-to-rewrite-urls-with-mod_rewrite-for-apache-on-ubuntu-16-04 https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-16-04
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-16-04

Tuesday, April 11, 2017

Ubuntu + Kodi + IPTV + Exodus + Dropbox + Deluge cheatsheet

I have a very old laptop and want to use it as a HTPC, so I decided to install some light Ubuntu distribution and Kodi on it, accompanied by Deluge to download stuff using web interface, Dropbox for IPTV playlist and program guide and Exodus for VOD. Bellow I listed important terminal commands and other notes important for this setup to have them all in one place:
  1. First install Lubuntu or Xubuntu.
  2. Next add Kodi and Deluge repositories and update packages index:
    sudo add-apt-repository ppa:team-xbmc/ppa (Ubuntu repository has own version so this might be skipped)
    sudo add-apt-repository ppa:deluge-team/ppa (Ubuntu repository has own version so this might be skipped)
    sudo apt-get update
  3. Upgrade stuff:
    sudo apt-get upgrade
  4. Install stuff:
    sudo apt-get install kodi
    sudo apt-get install kodi-pvr-iptvsimple
    sudo apt-get install nautilus-dropbox (or download Ubuntu package from dropbox and install it with gdebi)
    sudo apt-get install deluged
    sudo apt-get install deluge-web
  5. Remove residual stuff:
    sudo apt-get autoremove
  6. Fix Dropbox:
    dropbox stop
    dbus-launch dropbox start
    Go to Dropbox preferences and disable "Start Dropbox on system startup"
    Open Autostart settings (in Lubuntu it is in "Default applications for LXSession", is Xubuntu it is in "Session and Startup") and add new item with command dbus-launch dropbox start
  7. Setup Deluge services:
    sudo leafpad /etc/systemd/system/deluged.service (in Xubuntu replace leafpad with mousepad, or any other text editor You like)
    sudo leafpad /etc/systemd/system/deluge-web.service
    Copy new files content from http://dev.deluge-torrent.org/wiki/UserGuide/Service/systemd.
    To use same account: in [Service] section change User line, remove line Group=deluge and add line Password=your_password. UMask line should also be removed.
    systemctl enable /etc/systemd/system/deluged.service
    systemctl enable /etc/systemd/system/deluge-web.service
    systemctl start deluged
    systemctl start deluge-web
    To auto-connect web UI to daemon:
    systemctl stop deluge-web
    sudo leafpad ~/.config/deluge/web-ui.conf
    Set default daemon to 127.0.0.1:58846
    systemctl start deluge-web
  8. Set Kodi to auto start:
    sudo leafpad /etc/lightdm/lightdm.conf
    Add line autologin-session=kodi
    I had some issues here, after starting this way only laptop screen would work and TV connected over HDMI would be blank, so instead I added kodi to Autostart (in Lubuntu it is in "Default applications for LXSession", is Xubuntu it is in "Session and Startup")
  9. Add source to Kodi to install Indigo: http://fusion.tvaddons.ag/ Then use Indigo to install Exodus.
    Exodus is dead, use google to install Covenant or similar add-on instead.
    This might be good time to create folders Movies and TV Series in home folder and add them to Kodi and to Deluge.
    Also if using Exodus Covenant I would recommended to add Video Database Cleaner (direct link), otherwise library cleaning might take forever.
  10. Keep Ubuntu running when idle:
    There should be some options in Power Manager.
  11. Keep Ubuntu running when lid is closed:
    There should be some options in Power Manager, if not or they do not work then:
    sudo leafpad /etc/systemd/logind.conf
    Set HandleLidSwitch=ignore
    sudo leafpad /etc/UPower/UPower.conf
    Set IgnoreLid=true
  12. Set unattended upgrades:
    There should be options for that in Software & Updates, if not here are some resources to read:
    http://askubuntu.com/questions/9/how-do-i-enable-automatic-updates
    http://askubuntu.com/questions/87849/how-to-enable-silent-automatic-updates-for-any-repository
    https://blog.sleeplessbeastie.eu/2015/01/02/how-to-perform-unattended-upgrades/

Monday, November 14, 2016

Ghost in the Shell anime chronological order

There are three independent stories that should not be mixed:

Arise, set in 2027:
  1. GitS: Arise - Ghost Pain (ova) or GitS: AAA - Ghost Pain, Part 1-2 (tv series ep. 3-4, cut down version of ova)
  2. GitS: Arise - Ghost Whispers (ova) or GitS: AAA - Ghost Whispers, Part 1-2 (tv series ep. 5-6, cut down version of ova)
  3. GitS: Arise - Ghost Tears (ova) or GitS: AAA - Ghost Tears, Part 1-2 (tv series ep. 7-8, cut down version of ova)
  4. GitS: Arise - Ghost Stands Alone (ova) or GitS: AAA - Ghost Stands Alone, Part 1-2 (tv series ep. 1-2, cut down version of ova)
  5. GitS: AAA - Pyrophoric Cult (ova) or GitS: AAA - Pyrophoric Cult, Part 1-2 (tv series ep. 9-10, cut down version of ova)
  6. GitS: The New Movie (movie)
Stand Alone Complex, set in 2030-2034:
  1. GitS: SAC (tv series season 1, set in 2030) or GitS: SAC - The Laughing Man (ova, cut down version of tv series)
  2. GitS: SAC 2nd GIG (tv series season 2, set in 2032) or GitS: SAC 2nd GIG – Individual Eleven (ova, cut down version of tv series)
  3. GitS: SAC - Solid State Society (movie, set 2034)
The movies, set in 2029-2032:
  1. GitS (movie, set in 2029, comparison of versions)
  2. GitS 2: Innocence (movie, set in 2032)
It would be recommended to start watching with the original movies (considered the best), then SAC and finish with Arise (considered the worst), however chronological order would start with Arise, followed by SAC and finished by the movies.

Some would suggest after Arise to watch the first movie, then the SAC series, then the Innocence and finish it with the Solid State Society, but as mentioned these are completely independent stories (despite sharing same world and characters) and most would suggest to not mix them up.

There is a major spoiler explaining why SAC should be watched before the movies despite set times being mixed up.

More info at r/Ghost_in_the_Shell.

Wednesday, June 1, 2016

Run Seafile Windows client as a background service

We will need:

Step by step guide:
  1. Install and configure the Seafile client as usual, turn on synchronization for desired libraries.
  2. Quit the Seafile client (right click on tray icon and choose Quit)
  3. Download and extract NSSM
  4. Start the command prompt (Win+S -> cmd) and navigate to nssm.exe file, for example if you extracted it on Your desktop, type in the command prompt CD C:\Users\Your_user_name\Desktop\NSSM_folder_name\win64
  5. Type in the command prompt nssm install ccnet (this service will manage the network)
  6. NSSM service installer window will open, click the "..." button and navigate to C:\Program Files (x86)\Seafile\bin\ccnet.exe
  7. Fill arguments as described in documentation, change Administrator to Your user name
  8. Click the tab Log on, choose "This account" and enter Your credentials
  9. Click Install service - one done, one to go
  10. Type in the command prompt nssm install seaf-daemon (this service will manage the files)
  11. NSSM service installer window will open, click the "..." button and navigate to C:\Program Files (x86)\Seafile\bin\seaf-daemon.exe
  12. As for arguments this one is a bit trickier, -c argument is same as in step 5, -d argument value can be found in C:\Users\Your_user_name\ccnet\seafile.ini file and -w value is path to Your Seafile data folder, for example: -c C:\Users\Admin\ccnet -d C:\Users\Admin\Documents\Seafile\seafile-data -w C:\Users\Admin\Documents\Seafile
  13. Same as earlier click the Log on tab, choose This account and enter Your credentials
  14. Click Install service, and it's done
  15. Now restart the PC or start the services manually (Win+S -> Services -> look for ones named ccnet and seaf-daemon)

Read the NSSM Usage guide for more information.

Update: documentation linked in step 7 is no longer available, but You can check required parameters by executing commands ccnet -h and seaf-daemon -h in folder C:\Program Files (x86)\Seafile\bin\.

Friday, April 22, 2016

Upgrading Uniform Server

As there is no official guide on how to upgrade Uniform Server from one version to another I decided to compile one myself, keep in mind that I might miss something and update this guide from time to time when I run into an issue:
  1. Export Your databases using phpMyAdmin
  2. Export Your databases users using phpMyAdmin because databases export does not do that
  3. Stop Apache and MySQL, if You are running them as Windows services - uninstall them
  4. Rename Your UniServerZ folder to UniServerZ-backup or something
  5. Put Your new UniServerZ folder where Your old one used to be
  6. Check .httaccess files for stuff that might conflict
  7. If everything is OK copy www folder from UniServerZ-backup to UniServerZ
  8. If You use VHosts copy vhosts folder from UniServerZ-backup to UniServerZ compare \core\apache2\conf\extra\httpd-vhosts.conf files and copy extra lines at the end from UniServerZ-backup to UniServerZ - this one did not work for me, I had to recreate vhosts in UniController and after that do the copying, might have something to do with hosts file
  9. If You use SSL copy ssl folder from UniServerZ-backup to UniServerZ, compare \core\apache2\conf\extra\httpd-ssl.conf files and copy extra lines at the end from UniServerZ-backup to UniServerZ
  10. Compare \core\mysql\my.ini files and copy settings from UniServerZ-backup to UniServerZ if needed
  11. Compare \core\php70\php_production.ini files and copy settings from UniServerZ-backup to UniServerZ if needed
  12. Start the new UniController.exe (as administrator if You need to edit start-up settings)
  13. Enter the root MySQL password, preferably same as the old one for simplicity
  14. Edit start-up settings if needed
  15. Reinstall Windows services if needed, start the Apache and MySQL
  16. Import (or recreate) Your databases users using phpMyAdmin
  17. Import Your databases using phpMyAdmin
Bonus:
  • If You need to access Your databases from outside:
    1. Comment the "bind-address=127.0.0.1" line in UniServerZ\core\mysql\my.ini file (it might be already done in 10th step)
    2. Change the hostname for database users using phpMyAdmin

Wednesday, March 30, 2016

IPTV M3U players

If You have a IPTV playlist in M3U format and want a convenient way to watch it, there are quite a few different solutions for it and not all of them might be suitable for every circumstance, and as I have quite an experience with this situation, I'll try to list all the useful stuff I had a chance to try out.

Before I begin, Your playlist might be compiled from multicast streams and Your router might forbid multicast packets to pass through it, so You either need to enable multicast in Your router or use udpxy, but this post is not about that, so lets assume that router is set up and streams reach the device You want to watch on, here is a list of players tested by me:

Simple stand alone players:
Media Centers - most feature packed solutions:
  • Kodi + IPTV Simple Client - my personal favorite, works great on Windows, should be same on Mac and Linux, however did not test it on Android
  • MediaPortal - another very powerful media center package with great EPG support, but quite hard to set up compared to Kodi or Plex
  • Plex + IPTV.bundle - plugin made by me, EPG is much humbler and playback capabilities are quite limited compared to Kodi or MediaPortal, but devices supports is wider, check github repository for more information
  • New! Emby - did not test much but it has IPTV support out of the box
DLNA servers - when You are limited to DLNA:
  • xupnpd - ultra compact DLNA server, no EPG but completely free, can be installed on a router!
  • Serviio - very powerful DLNA server, lacks EPG and free version is limited
Smart TV apps and widgets - when you can't run a dedicated server, these are hosted solutions:
Links for further research:

And finally my choice of EPG "grabing" is WebGrab+Plus.

Thats it for now, If You have a solution not listed in here, please share it in the comments bellow.

Tuesday, March 29, 2016

Phone bike mounts and holders

I am not affiliated by any of these companies, but I used their stuff and it's great, so just sharing and saving for myself so I do not need to google every time I get a new phone: