Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Getting the ultimate home theatre setup with DLNA and automatic usenet configuration is one of those things that has a very high amount of one-time setup, but very minimal maintenance afterwards and huge amounts of payoff. I often have people approach me asking how I setup my usenet system at home, well consider this a tutorial of sorts... or at least how I did it.
- The first thing to understand is how my network is laid out at home, it's fairly simple, PCs and Internet connection are upstairs, TV downstairs. I purchased two "in-line" power adapters for my home, these adapters plug into your electrical outlets and allow you to broadcast ethernet through your home power outlets. It's a bit faster than standard WIFI and a little less flakey so long as you have a solid power infrastructure in your home. To answer one of the primary concerns of "in-line" power: "Yes it does transmit through your breaker panel at home".
- So I've got one of these in-line adapters by my TV on the main floor and by my PCs on the top floor. My home router is upstairs with the PCs and the in-line power adapter is plugged into the home router. In-Line Ethernet isn't perfect, it still isn't fast enough to stream a full 1080p MKV so there is a little bit of trickery. My NAS (more on this in a little bit) and my TV is connected to a gigabit switch which is connected to the in-line power on the main floor. What this allows is full gigabit streaming between my TV and my NAS. The NAS controls everything, downloading, streaming, indexing and DLNA. The most bandwidth is used up between the TV and the NAS, not the NAS and the router, so it makes sense that the NAS and the TV should be on a gigabit switch together. Now this might cause problems if you try to stream a 1080p MKV to your PCs on the other side of your home, but you have to ask yourself what's more important? Streaming to your TV or to your PCs... to me the answer is TV.
- The NAS can be used for other purposes other than just streaming video, it can stream music, store documents, but I wouldn't really let it store files or executables that your PCs often use, these should be stored on the internal storage on your PCs. Plus if you have a NAS with RAID it can be a viable nightly backup solution if you require such a feature.
- THe NAS I purchased was a Seagate GoFlex Home 3TB. It's a single drive bay (so no RAID), but I figure I don't really need RAID as most of the things I'm putting on the NAS is pretty volitile to begin with, plus I have no need for a home backup solution as most of my important documents are on my Google Drive. Out of the box the GoFlex Home comes pre-bundled with a DLNA service, but it's pretty limited... luckly we can install a custom copy of ArchLinux ARM on it.
- It's a good idea at this point to make a DHCP reservation for your NAS in your router. This is good for port forwarding later if you want to access your media services remotely.
- To install ArchLinux I followed this guide:
- http://archlinuxarm.org/platforms/armv5/seagate-goflex-home
- I'll break it down here as well.
- Before doing anything I needed to empty out the NAS as installing ArchLinux would format the entire storage array. This was as simple as cutting and pasting the file structure to a temporary storage location on my PC.
- Next I had to create a user account on the NAS. I already was using the NAS and the Seagate dashboard had me do this automatically.
- Now I needed to get all the device information, I wrote down the PN#, SN#, MAC ADDR and PK# just for reference, also wrote down the IP address incase I forgot it.
- Next I needed to SSH into the NAS, I simply downloaded Putty, typed the IP into the hostname and the NAS prompted me for a login.
- The login is a combination of the default login, your username you previously setup and your PK#. I logged in with USERNAME_hipserv2_seagateplug_XXXX-XXXX-XXXX-XXXX where USERNAME was my username and XXXX-XXXX-XXXX-XXXX was my PK#. It prompted me for a password and I typed the password I configured with my username.
- Now to login with super user privilages. I typed sudo -E -s and my password again and was greeted with the bash prompt# signifing I'm in super user mode.
- Next I killed all the processes that start by default I simply typed:
- killall -9 mynetworkd access-patrol seagate-lifecycle oe-spd xinetd udevd httpd avahi-daemon smbd nmbd vsftpd afpd minidlna mt-daapd check_igd.pl igd-daemon
- The -9 flag uses the stronger kill signal called SIGKILL and it nearly guarantees that the process will be killed.
- Now time to kill the swap space, this is done by typing:
- /sbin/swapoff -a
- Swapping is the process where a page of memory is copied to the preconfigured space on the disk called the swap space so you can free up memory. Swapping is useful when the system requires more memory than physically availble so it swaps it to disk when not critically being used. When messing with the disk we don't want the system trying to swap memory to disk space.
- If you are curious you can do a "mount" to see what drives are currently mounted to the NAS. Our goal right now is to unmount the sda1 drive (which is the sata drive). You can see at this point there are various mounts of different sections of the SATA drive to different shares, we want to unmount all of these.
- Now we want to unmount the SATA drive so we can format it, we do this by issuing this command:
- while [ `mount | grep sda1 | wc -l` -gt 0 ]; do umount -f /dev/sda1; done
- This command will iterater through all the sda1 mounts, try to unmount them and if it can't try again. When I issued this command the minidlna mount was looping infinitly so I did a ps aux | less and tried to look for any process ID running minidlna, found the process number and did a kill -9 on that PID, ran the unmount loop again and it completed with no problem.
- You can verify that the SATA drive is unmounted by doing a "mount" and check that there are no sda1's listed.
- PREPARING THE FILE SYSTEM
- Now we start fdisk to partition the SATA drive by typing:
- /sbin/fdisk /dev/sda
- First issue command o which creates a new empty DOS partition table
- Next issue a p to list the partitions to verify that they are now removed
- Now issue a n to create a new partition
- Set it as a primary partition
- Set it as the first partition number
- Hit enter to set the first cylinder as the first part of the partition
- Now type +20G to set the size of the partition, this creates a 20gig partition for ArchLinux
- You can verify the partition by hitting p
- Now we want to create a second partition which will be the data portion of the drive
- Type n for new, p for primary, 2 for second partition
- set as a primary partition
- start with the default sector
- Now type +1700G to set the size of the partition
- We want to change the partition for sda2 so hit t to change the partition type
- Select the second partition
- and finally type 87 for the NTFS partition code
- Now we want to create the swap partition
- n for new
- p for primary
- 3 for third
- start with the default sector
- Now type +2G to set the size
- Lastly you can check the partition list again by hitting p
- Finally hit w to write
- During this process you might get an invalid flag warning, don't worry, this will be corrected by doing a write.
- Now we need to make the ext3 filesystem, required for ArchLinux. Unfortunately the default shell on this NAS has no way of creating an ext3 filesystem so we much download the executable.
- First we want to switch to a tmp directory, no use mucking up anything else.
- cd /tmp
- Remember you can do a pwd to get your current working directory.
- Now we want to wget the mke2fs archive from the archlinuxarm web server:
- wget http://archlinuxarm.org/os/pogoplug/mke2fs
- You can verify that mke2fs is there by doing a ls.
- Now we need to set the permissions on mke2fs to be executable:
- chmod 755 mke2fs
- Now we want to create an ext3 file system on sda1:
- ./mke2fs -j /dev/sda1
- The -j flag creates and ext3 journal.
- INSTALLING ARCHLINUX ARM
- Now we want to create a directory for archlinux ARM:
- mkdir alarm
- Now we want to mount the file system found on sda1 at the directory /tmp/alarm we do this by issuing the following:
- mount /dev/sda1 alarm
- You can do a mount to see the mount we just created and it's file type (ext3).
- Now we download archlinux:
- cd alarm
- wget http://archlinuxarm.org/os/ArchLinuxARM-armv5te-latest.tar.gz
- This is about a 155MB download, keep an eye on it and make sure it completes with no issues.
- Now we extract it:
- tar -xzvf ArchLinuxARM-armv5te-latest.tar.gz
- Now we remove the tar file, since it's extracted:
- rm ArchLinuxARM-armv5te-latest.tar.gz
- Finally we sync, this will write any memory to disk:
- sync
- Now we want to unmount the archlinux drive from sda1:
- cd ..
- unmount alarm
- Again you can do a mount to make sure it's unmounted
- INSTALLING UBOOT
- Ok now we install u-boot, which is a universal bootloader for embedded devices.
- We head back into our /tmp directory:
- cd /tmp
- And download the u-boot files:
- wget http://jeff.doozan.com/debian/goflex/v0.6/uInitrd
- wget http://jeff.doozan.com/debian/goflex/v0.6/ubit_start
- Make the ubit_start executable:
- chmod +x ubit_start
- And start the ubit environment:
- ./ubit_start
- CONFIGURING UBOOT
- You'll know you're in the uboot environment because your shell will change.
- First we have to install a few things into uboot, specifically the boot loader for your device, for me I have to install the goflexhome bootloader, then copy the OE U-boot into unused NAND memory:
- chain_install goflexhome
- chain_revert
- uboot_uptodate
- Now we set the mac address into u-boot:
- ethaddr uu:vv:ww:xx:yy:zz
- Couple more things to install, first the rescue system:
- on /dev/sda1 ubit_write
- And Mark the parition with the sepcia label "rootfs":
- tune2fs -L "rootfs" /dev/sda1
- REBOOTING THE DEVICE
- Now we want to exit UBIT and reboot into Arch Linux ARM:
- exit
- /sbin/halt
- Wait for the unit to shut down, then physically power the unit using the power switch or unplugging it.
- SUMMARY THUS FAR
- OK, so what did we do? First we formatted the NAS, then we prepared the filesystem for ArchLinux ARM, installed Arch, then installed a bootloader so when the NAS boots up it automatically loads Arch. Fairly simple now that you are done.
- The rest of this article is pretty much taken word for word from the following link:
- http://blog.philippklaus.de/2011/04/install-archlinuxarm-on-the-seagate-goflex-home/
- UPDATING ARCHLINUX
- First thing you'll want to do is check your DHCP reservations again, since the hostname has changed you might have to connect to a different IP address or change your reservation.
- SSH to the NAS again and you will be prompted for a login, this time use root/root.
- Now you will be at the alarm shell.
- Run a full system update first:
- pacman -Syu
- Now change the root password:
- passwd
- Now you'll want to create a useraccount to use other than root. You can define supplimentary groups for that user to be part of and also define which shell the user should use by default. Here's my script:
- useradd -m -g users -G audio,storage,video,games -s /bin/bash wmcmahon
- Now set the password for the user:
- passwd wmcmahon
- You can get the full list of all users by doing the following:
- cat /etc/passwd
- SETTING JUMBO FRAMES
- Most NAS and networking gear support "jumbo" frames. This means you can cram more information into your packet. To understand this concept ping your device in Windows. By default your packet size is 32bytes. Now issue the following command:
- ping IP -f -l 1472
- You'll see that you are now pinging with packet sizes of 1472 bytes
- Now issue the following:
- ping IP -f -l 1473
- You'll see that you are getting framentation errors. You can increase the size of frames accepted on your NAS to increase general file transfer speeds and streaming speeds. This will help with larger file sizes as there is less need for fragmentation.
- To view your current MTU (maximum transmission size) type the following into your arch shell:
- ifconfig eth0 | grep mtu
- Your MTU size is 1500, with packet headers that's roughly 1472bytes. Now let's change it:
- ifconfig eth0 mtu 4000
- The interface will go down for a second and come back up. Now go back to your windows machine and try pinging with 1473 bytes. If they don't go through then you need a networking device that handles jumbo frames. Check your router configuration. If you can't get it to work just set your MTU back to 1500.
- SETTING TIMEZONES
- You can get the list of all the availble timezones by issueing the following command:
- timedatectl list-timezones
- To set your timezone issue the following:
- timedatectl set-timezone TIMEZONE
- INSTALL YOUR NTFS PARTITION
- Ok, so now we actually want to start using our NAS as a network file server. The first step in doing this is actually creating a NFS.
- Firstly, we want to format sda2 as a ntfs file system, this can simply be done by issuing the following:
- mkntfs -Q -L <device label> /dev/sda2
- This will perform a full format, you can do a quick format by putting -Q for quick, it's up to you. When using -Q the format won't "zero" all the sectors.
- Now let's make a directory for all our NAS data to mount to:
- mkdir /NASdata
- Now we want to test the mount:
- mount -t ntfs-3g /dev/sda2 /NASdata
- You can check your mounts by typing mount and you should see /dev/sda2 on /NASdata
- Finally you can check the free space on /NASdata by issuing the following command:
- df /NASdata
- Now we have to define our mounts in /etc/fstab so the mount is auto created on boot:
- nano /etc/fstab
- At the bottom of the document enter the following:
- /dev/sda2 /NASdata ntfs-3g defaults 0 0
- The spacing matters!!
- CTRL-X to exit, Y to save
- Now we want to test the mount in fstab. If you rebooted the device right now, and there was an issue with fstab, you would need to take the drive, connect it to a Linux machine and edit the fstab file there (it sucks, I had to do this). Instead we can test the fstab mount without rebooting. First unmount /dev/sda2:
- umount /dev/sda2
- Now check your mounts to make sure it isn't listed there anymore by typing mount.
- Now perform a mount -a to load the fstab configuration.
- Type mount again and check that your drive is mounted.
- If everything is good, reboot, login as root and ensure the mount is still there.
- SETTING UP YOUR SWAP SPACE
- First thing we want to do is make your swap space, since the RAM is limited on this device:
- mkswap /dev/sda3
- To enable paging:
- swapon /dev/sda3
- Now we verify the swap is working:
- free -m
- Verify that there is swap space
- swapon -s
- Verify that there is swap space
- Now we add an entry to fstab:
- nano /etc/fstab
- Add the following entry:
- /dev/sda3 none swap defaults 0 0
- Remember spacing matters.
- Reboot and check your swap is still loaded
- INSTALL A NFS
- Before you continue with this section be aware the NFS is mainly for file sharing between Linux machines, if you aren't interested in this you can skip to the next section which is install SAMBA to share between your NAS and your Windows Machines.
- Ok now we can start playing around with NFS and configuring it for Windows.
- First download the NFS utilities:
- pacman -Sy nfs-utils rpcbind
- Now we want to autostart these services, this is normally done through /etc/rc.conf, but Archlinux now uses SystemCTL for this. In fact if you perform a systemctl you can see that your mount point is listed in the loaded services. So we want to add some services to this list:
- systemctl enable nfsd.service rpc-idmapd.service rpc-mountd.service rpcbind.service
- Again, reboot and do a systemctl to see the running services and verify that the four new services are there in the list and are loaded and active.
- Now we need to change the file permissions on NASdata:
- chmod 777 /NASdata
- Now we need to add the exports to allow specific clients to connect to the shares. You can edit the current content of exports by typing:
- nano /etc/exports
- Now type, at the end of the file:
- /NASdata 192.168.1.1/24(rw,async,insecure)
- This will allow all clients in the 192.168.1.0/24 (192.168.1.0-255) network to access your NFS shares. If your home network is different you'll want to modify this.
- CTRL-X to exit, Y to save
- Now we can reload the export share by typing:
- exportfs -arv
- You can type exportfs to see the current exports
- Now reboot to make sure nothing is broken again.
- Login with root and type exportfs to verify exports.
- INSTALL SAMBA
- First we install Samba:
- pacman -Sy samba
- By default there is no samba configuration file, you must copy the default:
- cp /etc/samba/smb.conf.default /etc/samba/smb.conf
- Next we want to add our share to the samba configuration, if we nano /etc/samba/smb.conf and scroll down to you'll find a section titled "Share Definitions". By default the home directories of the ArchLinux users are shared, however there is a section commented out that is perfect for our use. Scroll down a few sections to find the "tmp" section. Uncomment and edit the following lines:
- [NASdata]
- comment = NAS Shares
- path = /NASdata
- read only = no
- public = yes
- CTRL-X to exit, Y to save.
- We want to start the samba service at boot, much like our NFS service above (which goes into more detail):
- systemctl enable smbd.service
- systemctl enable nmbd.service
- Now we reboot, login as root, and check to see if the service is started by typing:
- systemctl
- You should see the following entry:
- smbd.service loaded active running Samba SMB/CIFS server
- Now on your windows machine you you can browse to \\alarm\NASdata, enter your ArchLinux username and password and you're in!
- Personally, I don't want to have to type in my username/password for this share (even though it's insecure).
- So let's open the configuration file:
- nano /etc/samba/smb.conf
- Scroll down to where it says "security = user" and change it to:
- security = user
- Uncomment security = user and below it add:
- map to guest = bad user
- Above this setting you'll find the "guest account" setting change it to:
- guest account = nobody
- Now scroll back down to your previous share and edit it so it looks like the following:
- [NASdata]
- writable = yes
- comment = NAS Data
- path = /NASdata
- read only = no
- public = yes
- guest ok = yes
- guest only = yes
- guest account = nobody
- browsable = yes
- CTRL-X to exit, Y to save
- Finally type:
- smbpasswd -an nobody
- Reboot your NAS and browse to your share again.
- INSTALL TRANSMISSION BT CLIENT
- Let's setup a bittorrent client, usenet isn't perfect and for that there is always bittorrent, first we need to install BT:
- pacman -Sy transmission-cli
- Now we add it to the auto-start script as before:
- systemctl enable transmission
- We can start transmission (so we don't need to reboot):
- systemctl start transmission
- And verify it's running:
- systemctl
- CONFIGURE TRANSMISSION BT CLIENT
- Ok let's stop the service so we can configure some things:
- systemctl stop transmission
- Open the default configuration file:
- nano /var/lib/transmission/.config/transmission-daemon/settings.json
- Find the line that says: rpc-whitelist-enabled and set it to false
- Start transmission:
- systemctl start transmission
- Browse to /NASdata
- cd /NASdata
- Create a directory for your torrents:
- mkdir Torrents
- Browse to alarm:9091 in your browser, click the spanner icon at the bottom, change the "download to:" folder to /NASdata/CompletedDownloads
- You effectively at this point have transmission configured, but why not setup a watch folder? So transmission constantly watches a folder for torrents, once it finds it, it will automatically download the torrent.
- So let's make another directory in NASdata called Torrent-watch
- mkdir Torrent-Watch
- Let's open the settings file again:
- nano /var/lib/transmission/.config/transmission-daemon/settings.json
- Add the following lines at the end:
- "watch-dir": "/NASdata/Torrent-Watch",
- "watch-dir-enabled": true
- Restart the service:
- systemctl start transmission
- Now when you place a torrent file into Torrent-Watch it'll automatically start grabbing it in Transmission. When transmission is done with the file it'll put it into Torrents.
- Lastly, let's add tranmission to autostart service:
- systemctl enable transmission
- Reboot and make sure it works.
- SETTING UP A DLNA SERVICE
- There are plenty of DLNA/uPnP services out there availble for ArchLinux, I had issues with MediaTomb and MiniDLNA seems to be the popular choice.
- Let's start by downloading minidlna
- pacman -Sy minidlna
- Configuration of minidlna is simple:
- nano /etc/minidlna.conf
- We'll start the service:
- systemctl start minidlna
- Let's change the scan location to:
- /NASdata
- Now let's auto-start the service:
- systemctl enable minidlna
- I had some issue with minidlna starting on boot, I did some googling and found the following service also needed to be enabled:
- pacman -Sy networkmanager
- systemctl enable NetworkManager-wait-online
- Later we will refine this a bit more.
- INSTALLING SABNZB
- Sabnzb is a usenet downloader, it's incredibly powerful and highly configurable and essential for my usenet setup.
- Start by installing Sabnzbd:
- pacman -Sy sabnzbd
- pacman -Sy python2-pyopenssl
- Let's start and stop the service to create the proper config files:
- systemctl start sabnzbd
- systemctl stop sabnzbd
- Now let's edit the initial configuration file:
- nano /opt/sabnzbd/sabnzbd.ini
- Find the "host" line and change it to 0.0.0.0 to allow access from other PCs
- Now browse to alarm:8080 and let's step through the SabNZB wizard.
- Choose your language
- Type in the host of your newsgroup provider -- use ssl if they provide it
- Port, use SSL port if they provide it
- username/password
- set connection number
- checkmark ssl if you want to use it
- Test the server connection
- Enable HTTPs
- Open the SabNZB Service:
- nano /usr/lib/systemd/system/sabnzbd.service
- Enter the following line under ExecStart:
- PIDFile=/tmp/sabnzbd-9090.pid
- Restart the service:
- systemctl --system daemon-reload
- Browse to:
- https://alarm:9090
- Under config - general
- copy the API key, this will be needed later
- copy the NZB key, this will be needed later
- Save changes
- Under config - folders
- Set your incomplete folder to: /NASdata/Incomplete
- Set your complete folder to: /NASdata/CompletedDownloads
- Set permissions to 777
- Set your watched folder to: /NASdata/SABnzbdWatched
- Save changes
- under config - switches
- uncheck launch browser on startup
- save changes
- Add sabnzbd to auto start:
- systemctl enable sabnzbd
- Reboot and ensure all the pieces are still working
- INSTALLING SICKBEARD
- First let's install the package:
- pacman -Syu sickbeard-git
- Browse to your sickbeard installtion:
- http://alarm:8081
- Update by clicking "Update Now" at the top
- If you get permission errors you'll need to chmod your cherrypy directory:
- chmod -R 777 /opt/sickbeard/cherrypy
- After the update you'll probably have to restart sickbeard:
- systemctl start sickbeard
- Browse to alarm:8081
- Under config - General
- Uncheck launch browser
- Under config - Search Settings
- Choose your NZB Method as SabNZB
- Enter the url: http://alarm:8080
- Enter your API Key
- Click Test
- Checkmark torrent search
- Browse to your torrent watch directory
- Under config - search settings
- Add your search providers
- Under config - post processing
- Set your TV Download directory to /NASdata/CompletedDownloads
- Uncheck keep originals
- check scan and process
- Create all meta data.
- Finally we add sickbeard to the startup process
- systemctl enable sickbeard
- INSTALLING COUCHPOTATO
- Up next is couchpotato, let's install it:
- pacman -Syu couchpotato-git
- Start the service:
- systemctl start couchpotato
- Browse to couchpotato:
- http://alarm:5050/
- Step through the settings much like you did with SickBeard
- The configuration of couchpotato is pretty straight forward
- Finally add the service to start on boot:
- systemctl enable couchpotato
Advertisement
Add Comment
Please, Sign In to add comment