-
1Step 1
Setup USB storage
Because of the Omega's limited storage, we'll need an external drive in which to place our downloads. Follow these commands on your Omega Console to mount the drive.
1-A) Plug in the USB Storage
1-B) Usually, it will get mapped to the sda1 device. Double check the mapping:
ls /dev/sda*
1-C) Create a mount point directory
mkdir /mnt/sda1
1-D) Mount the drive, using 'mount <device> <mount point>'. For example:mount /dev/sda1 /mnt/sda1/
The storage can now be accessed at /mnt/sda1
1-E) To safely remove the drive, use 'umount <mount point>'. For example:
umount /mnt/sda1/
For the purposes of this guide, let's assume the USB device was mounted to /mnt/sda1
For more on using USB storage (including automated mounting):
https://wiki.onion.io/Tutorials/Using-USB-Storage -
2Step 2
Setup Swap File
Because of the Omega's limited memory, we need to setup a swap file on the USB storage to extend the available memory. Follow these commands on your Omega Console to setup the swap file.
2-A) Install the required package
opkg update opkg install swap-utils
2-B) Use the dd utility to create the file that will become the swapfile.
The dd utility can be dangerous if used incorrectly
dd if=/dev/zero of=/mnt/sda1/swap.page bs=1M count=256
2-C) Setup the swap file as a swap area
mkswap /mnt/sda1/swap.page
Running the free command will show you that nothing has changed yet2-D) Activate the swap file
swapon /mnt/sda1/swap.page
Running the free command again will show that the swap row is populatedFor more on using swap files (including automated swapping):
https://wiki.onion.io/Tutorials/Extending-RAM-with-a-swap-file -
3Step 3
Install Transmission
We'll need a client to download files via BitTorrent; Transmission works well on OpenWRT so let's install the daemon as well as the web interface packages:
opkg update opkg install transmission-daemon transmission-web
-
4Step 4
Setup Transmission
We'll now configure Transmission to best suit our purposes. Transmission's configuration file can be found at /etc/config/transmission, so we can use UCI to easily change the configuration options. If you're unfamiliar with UCI, check out Onion's UCI tutorial.4-A) Make sure that Transmission is enabled and set a logical location for Transmission's own configuration directory:
uci set transmission.@transmission[0].enabled='1' uci set transmission.@transmission[0].config_dir='/etc/transmission'
4-B) Set the download and incomplete download locations to directories on the mounted USB drive:uci set transmission.@transmission[0].download_dir='/mnt/sda1/download' uci set transmission.@transmission[0].incomplete_dir='/mnt/sda1/download/incomplete'
4-C) Create these directories with the mkdir commandmkdir /mnt/sda1/download mkdir /mnt/sda1/download/incomplete
4-D) Commit the changes to the configuration fileuci commit transmission
-
5Step 5
Enable the Transmission Daemon
Now that Transmission has been configured, let's enable the daemon so that it starts automatically when the Omega boots/etc/init.d/transmission enable
And let's actually launch the daemon:/etc/init.d/transmission start
-
6Step 6
Install the Console App
The Transmission web interface will be running on port 9091 of your Omega, but wouldn't it be nice if this were accessible from the Console?
Luckily, it can be! Simply install it with the following commands
opkg update opkg install transmission-console-app
-
7Step 7
Configure Access to the Web Interface
The Transmission Web Interface needs to be told which IP addresses are allowed access via a whitelist.7-A) First check the current entries in the whitelist. Make sure to note the current entries, we'll want to preserve them:
uci show transmission.@transmission[0].rpc_whitelist transmission.cfg025f8f.rpc_whitelist='127.0.0.1,192.168.1.*'
7-B) Allow Access to users Connected to the Omega's APAny users connected to the Omega's AP should be able to access the Transmission App, so lets add that now.
By default, the Omega's AP network will assign addresses in the 192.168.3.* space, but that's configurable so let's check:
uci show network.wlan.ipaddr network.wlan.ipaddr='192.168.8.1'
In this case, the address range was changed to 192.168.8.*.Let's add this address range to the whitelist:
uci set transmission.@transmission[0].rpc_whitelist='127.0.0.1,192.168.1.*,192.168.8.*' uci commit transmission
Restart the Transmission daemon for the changes to take effec/etc/init.d/transmission restart
7-C) Find your Omega's IP address. Run the ifconfig command:ifconfig
The IP address is printed in the inet addr field, under the wlan0section.
7-D) Allow Access to Users on an Existing WiFi Network.
For the purposes of this tutorial, let's say your Omega's IP address is 192.168.23.99 so we will be whitelisting addresses in the 192.168.23.* range:
uci set transmission.@transmission[0].rpc_whitelist='127.0.0.1,192.168.1.*,192.168.8.*., 192.168.23.*' uci commit transmission
7-E) Restart the Transmission daemon for the changes to take effect./etc/init.d/transmission restart
-
8Step 8
Install Samba
8-A) First, we need to install the Samba Server on our Omega, to implement file sharing over our network:opkg update opkg install samba36-server
If this does not work, typeopkg list | grep samba
The output will be something like:samba36-client - 3.6.25-5 - ... samba36-server - 3.6.25-5 - ...
Then in your opkg install command, enter the listed sambaXY-server.8-B) Configuring our Shared Directories.
Use vi to modify the configuration file:
vi /etc/config/samba.
By default it will have the followingconfig samba option 'name' 'OpenWrt' option 'workgroup' 'WORKGROUP' option 'description' 'OpenWrt' option 'homes' '0'
To add a Read-Only Share, add the following lines to /etc/config/samba:
Notice the 'path' uses your mount point from step 1-Cconfig 'sambashare' option 'name' 'usb-share' option 'path' '/mnt/sda1' option 'guest_ok' 'yes' option 'create_mask' '0700' option 'dir_mask' '0700' option 'read_only' 'yes'
8-C) For the change to take effect, restart Samba/etc/init.d/samba restart
Voila, your usb storage is now shared. -
9Step 9
Connecting to a Samba Share (OSX)
9-A) Open a Finder window and hit Command+K to open the "Connect to Server" window
9-B) In the Server Address, type:
smb://omega-ABCD.local
where ABCD is the unique identifier of your Omega and click Connect.9-C) After a little while, it will connect and prompt you for credentials. Since we've setup our Samba shares with guest_ok enabled, select Guest and click Connect.
9-D) If you have multiple Samba shares configured, you will then be prompted to select the share that you would like to connect to. Select usb-share
After that, it will just be like another directory on your computer.
9-E) When you want to disconnect, find the shared directory under the Shared header in your sidebar, click the Eject icon to disconnect.
-
10Step 10
Connecting to a Samba Share (Windows)
9-A) Click the Start button and select Computer, then click Map a network drive on the top toolbar:
9-B) In the window that opens, in the Folder form you'll need to enter the path to the Samba share. This includes the Omega's IP and the share name.
The syntax is: \\<Omega's IP>\<Share Name>, so for example:
\\192.168.1.226\usb-share.
Deselect Reconnect at Login and select Connect using differentcredentials and then click Finish:
9-C) The next window will prompt you for a username and password. Since we've setup our Samba shares with guest_ok enabled, type Guest as the username and leave the password field blank.
After a little while, it will connect and the share will be another drive on your computer.
9-D) When you want to disconnect, find the mapped network drive on the sidebar, right-click it and select Disconnect.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.