Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
openwrt:manual:zsun [2017/10/04 01:40] theexpertnoob [3. Set-up Piratebox, Imageboard & MiniDLNA] |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Piratebox on the Zsun ===== | ||
| - | Like many of us have read the [[https://hardware.slashdot.org/story/16/01/26/1430201/openwrt-turns-a-14-card-reader-into-the-smallest-wireless-ap|article]] on slashdot about the Openwrt capabilities of the Zsun Wifi card Reader. | ||
| - | The idea of having PirateBox running on the smallest device yet made me order one from China. | ||
| - | After many hours of installing, troubleshooting, resetting e.d. I now have a complete working Piratebox installation. | ||
| - | I would like to share my installation scripts in order to let you install your own. | ||
| - | <WRAP center centeralign alert 75%>This tutorial is for the technical minded but should be simple to follow until we get a full install package/script working. | ||
| - | NOBODY will take responsibility or be liable for anything you do to your zsun. | ||
| - | If you brick it trying these procedures, **YOU** are solely responsible for your actions. | ||
| - | **YOU HAVE BEEN WARNED**. However, we can try and help in the forums. | ||
| - | This has been recently tested on Jan 28, 2017 and working with PirateBox v1.1.2</WRAP> | ||
| - | |||
| - | ==== 0. PreSetup ==== | ||
| - | * Having a Zsun running OpenWrt. I've used the [[https://wiki.hackerspace.pl/projects:zsun-wifi-card-reader:factory-update|hackerspace.pl]] method. | ||
| - | * microSD card (current data will be destroyed) | ||
| - | * Root password [[https://wiki.openwrt.org/doc/howto/firstlogin|set]]. | ||
| - | |||
| - | * Connect to **OpenWRT** SSID and then connect via SSH to 192.168.1.1 as root | ||
| - | * Bunch of uci commands. Copy and paste each into the command line of the shell prompt. | ||
| - | <code> | ||
| - | uci set uhttpd.main.listen_http=9080 | ||
| - | uci set uhttpd.main.listen_https=9443 | ||
| - | uci commit | ||
| - | uci set wireless.radio0.channel=auto | ||
| - | uci set wireless.radio0.txpower=18 | ||
| - | uci set wireless.radio0.country=00 | ||
| - | uci set wireless.radio0.disabled=0 | ||
| - | uci add wireless wifi-iface | ||
| - | uci set wireless.@wifi-iface[-1].device=radio0 | ||
| - | uci set wireless.@wifi-iface[-1].ssid='yourWifiName' | ||
| - | </code> | ||
| - | * Change "yourWifiName" before pressing enter | ||
| - | <code> | ||
| - | uci set wireless.@wifi-iface[-1].mode=sta | ||
| - | uci set wireless.@wifi-iface[-1].network=wwan | ||
| - | uci set wireless.@wifi-iface[-1].encryption=psk2 | ||
| - | uci set wireless.@wifi-iface[-1].key='yourSuperSecurePass' | ||
| - | </code> | ||
| - | * Change "yourSuperSecurePass" before pressing enter | ||
| - | <code> | ||
| - | uci set wireless.@wifi-iface[-1].disabled=0 | ||
| - | uci commit | ||
| - | uci set wireless.@wifi-iface[0].ssid='Piratebox - Share Freely' | ||
| - | uci commit | ||
| - | uci set network.wwan=interface | ||
| - | uci set network.wwan.proto=dhcp | ||
| - | uci commit | ||
| - | uci set firewall.@zone[1].network='wan wan6 wwan' | ||
| - | uci commit | ||
| - | /etc/init.d/network reload && /etc/init.d/firewall reload && wifi | ||
| - | </code> | ||
| - | * Press Enter (you will be disconnected) | ||
| - | * Reconnect to 'Piratebox - Share Freely' SSID and back to 192.168.1.1 | ||
| - | <WRAP center round info 75%> | ||
| - | An additional wireless connection with your own WiFi is made in 'sta' mode. Because OpenWrt (and PirateBox) are using the IP 192.168.1.1 (sub-netmask /24) the network (WiFi) you are connecting to can't use the same sub-net mask. | ||
| - | </WRAP> | ||
| - | * Verify your internet connection using | ||
| - | <code> | ||
| - | ping google.com | ||
| - | opkg update | ||
| - | </code> | ||
| - | ==== 1. Setup Mounts ==== | ||
| - | === Format SD card === | ||
| - | * Copy and paste one line at a time | ||
| - | <code> | ||
| - | cd /tmp | ||
| - | export LD_LIBRARY_PATH='/lib:/usr/lib:/tmp/lib:/tmp/usr/lib' | ||
| - | opkg update && opkg install -d ram e2fsprogs mkdosfs fdisk | ||
| - | wget http://raw.githubusercontent.com/TheExpertNoob/scripts/parts/parts | ||
| - | chmod +x /tmp/parts | ||
| - | ./parts | ||
| - | /tmp/usr/sbin/mkfs.vfat /dev/sda1 | ||
| - | /tmp/usr/sbin/mkfs.ext4 /dev/sda2 | ||
| - | </code> | ||
| - | |||
| - | * copy and paste into command shell | ||
| - | <code> | ||
| - | mkdir -p /opt/piratebox/share | ||
| - | uci add fstab mount | ||
| - | uci set fstab.@mount[-1].target=/opt/piratebox/share | ||
| - | uci set fstab.@mount[-1].device=/dev/sda1 | ||
| - | uci set fstab.@mount[-1].fstype=vfat | ||
| - | uci set fstab.@mount[-1].options=rw,sync | ||
| - | uci set fstab.@mount[-1].enabled=1 | ||
| - | uci set fstab.@mount[-1].enabled_fsck=0 | ||
| - | uci commit | ||
| - | mkdir /mnt/sda2 | ||
| - | mount /dev/sda2 /mnt/sda2 | ||
| - | tar -C /overlay -cvf - . | tar -C /mnt/sda2 -xf - | ||
| - | uci add fstab mount | ||
| - | uci set fstab.@mount[-1].target=/overlay | ||
| - | uci set fstab.@mount[-1].device=/dev/sda2 | ||
| - | uci set fstab.@mount[-1].fstype=ext4 | ||
| - | uci set fstab.@mount[-1].options=rw,sync | ||
| - | uci set fstab.@mount[-1].enabled=1 | ||
| - | uci set fstab.@mount[-1].enabled_fsck=0 | ||
| - | uci commit | ||
| - | reboot | ||
| - | </code> | ||
| - | * Reconnect to PirateBox - Share Freely | ||
| - | ==== 2. Install Packages ==== | ||
| - | * Copy and paste | ||
| - | <code> | ||
| - | opkg update && opkg install python lighttpd lighttpd-mod-cgi lighttpd-mod-redirect lighttpd-mod-alias lighttpd-mod-setenv lighttpd-mod-fastcgi perl perlbase-base perlbase-cgi perlbase-essential perlbase-file perlbase-bytes perlbase-config perlbase-data perlbase-db-file perlbase-digest perlbase-encode perlbase-encoding perlbase-fcntl perlbase-gdbm-file perlbase-integer perlbase-socket perlbase-time perlbase-unicode perlbase-unicore perlbase-utf8 perlbase-xsloader php5-cgi php5-fastcgi unzip minidlna | ||
| - | </code> | ||
| - | * Press Enter | ||
| - | * Wait....Tea break? | ||
| - | ==== 3. Set-up Piratebox, Imageboard & MiniDLNA ==== | ||
| - | * Copy and paste each line separately. | ||
| - | <code> | ||
| - | cd /tmp | ||
| - | wget http://downloads.piratebox.de/piratebox-ws_current.tar.gz | ||
| - | tar xzf piratebox-ws_current.tar.gz | ||
| - | cd piratebox | ||
| - | mkdir -p /opt | ||
| - | cp -rv piratebox /opt | ||
| - | cp /opt/piratebox/src/openwrt.example.minidlna /etc/config/minidlna | ||
| - | sed -i 's|DO_IFCONFIG="yes"|DO_IFCONFIG="no"|g' /opt/piratebox/conf/piratebox.conf | ||
| - | sed -i 's|USE_APN="yes"|USE_APN="no"|g' /opt/piratebox/conf/piratebox.conf | ||
| - | sed -i 's|NET=192.168.77|NET=192.168.1|g' /opt/piratebox/conf/piratebox.conf | ||
| - | sed -i 's|DNSMASQ_INTERFACE="wlan0"|DNSMASQ_INTERFACE="br-lan"|g' /opt/piratebox/conf/piratebox.conf | ||
| - | sed -i 's|DROOPY_CHMOD|#DROOPY_CHMOD|g' /opt/piratebox/conf/piratebox.conf | ||
| - | sed -i 's|getenv = CDLL("libc.so.6").getenv|getenv = CDLL("libc.so.0").getenv|g' /opt/piratebox/bin/droopy | ||
| - | /etc/init.d/lighttpd stop | ||
| - | /etc/init.d/lighttpd disable | ||
| - | /opt/piratebox/init.d/piratebox_alt start | ||
| - | /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard | ||
| - | /opt/piratebox/bin/board-autoconf.sh | ||
| - | </code> | ||
| - | * Enter in a code for your imageboard. | ||
| - | <code> | ||
| - | /opt/piratebox/init.d/piratebox_alt stop | ||
| - | uci set wireless.@wifi-iface[1].disabled=1 | ||
| - | uci commit | ||
| - | /etc/init.d/network reload && wifi | ||
| - | </code> | ||
| - | * Press Enter (you will be disconnected) | ||
| - | * Reconnect to 'Piratebox - Share Freely' SSID and back to 192.168.1.1 | ||
| - | ==== 4. Create piratebox start ==== | ||
| - | <code>vi /etc/init.d/piratebox</code> | ||
| - | * Copy the below code. In your shell window, press I to insert text then right-click or paste to insert. Be sure **ALL** of it has been pasted. Press ESC, SHIFT+Z, Shift+Z to save. (editor will auto close) | ||
| - | <code> | ||
| - | #!/bin/sh /etc/rc.common | ||
| - | |||
| - | NAME=piratebox | ||
| - | START=55 | ||
| - | STOP=20 | ||
| - | |||
| - | start() { | ||
| - | /opt/piratebox/init.d/piratebox_alt start | ||
| - | } | ||
| - | |||
| - | stop() { | ||
| - | /opt/piratebox/init.d/piratebox_alt stop | ||
| - | } | ||
| - | </code> | ||
| - | ==== 5. Finalization ==== | ||
| - | * Copy and paste each line separately. | ||
| - | <code> | ||
| - | chmod +x /etc/init.d/piratebox | ||
| - | /etc/init.d/piratebox start | ||
| - | /etc/init.d/piratebox enable | ||
| - | reboot | ||
| - | </code> | ||
| - | ==== 6. Options are optional ==== | ||
| - | ~Sarge, RvB | ||
| - | === 6.1 Enable PHP === | ||
| - | <code> | ||
| - | sed -i 's|#include "/opt/piratebox/conf/lighttpd/fastcgi-php.conf"|include "/opt/piratebox/conf/lighttpd/fastcgi-php.conf"|g' /opt/piratebox/conf/lighttpd/lighttpd.conf | ||
| - | |||
| - | sed -i 's|doc_root =|;doc_root =|g' /etc/php.ini | ||
| - | |||
| - | echo "<?php phpinfo() ?>" > /opt/piratebox/share/content/phpinfo.php | ||
| - | |||
| - | /etc/init.d/piratebox reload | ||
| - | </code> | ||
| - | * test | ||
| - | http://piratebox.lan/content/phpinfo.php you should get a long php info page of stuff. | ||
| - | If it works, you can delete the phpinfo page with this command. | ||
| - | <code> | ||
| - | rm /opt/piratebox/share/content/phpinfo.php | ||
| - | </code> | ||
| - | === 6.2 Enable IRC === | ||
| - | * Copy and past each line | ||
| - | <code> | ||
| - | sed -i 's|ENABLE_IRC_SERVER="no"|ENABLE_IRC_SERVER="yes"|g' /opt/piratebox/conf/piratebox.conf | ||
| - | /etc/init.d/piratebox restart | ||
| - | </code> | ||
| - | === 6.3 Change Upload Folder === | ||
| - | <code> | ||
| - | mkdir -p /opt/piratebox/share/Shared/Uploaded | ||
| - | sed -i 's|UPLOADFOLDER="$SHARE_FOLDER/Shared"|UPLOADFOLDER="$SHARE_FOLDER/Shared/Uploaded"|g' /opt/piratebox/conf/piratebox.conf | ||
| - | /etc/init.d/piratebox restart | ||
| - | </code> | ||
| - | |||
| - | ==== 7. Fixes ==== | ||
| - | * MiniDLNA | ||
| - | Minidlna config points to the wrong path. So we need to fix it | ||
| - | <code> | ||
| - | vi /etc/config/minidlna | ||
| - | </code> | ||
| - | Press **I** on the keyboard to get into edit mode\\ | ||
| - | change the line that reads **list media_dir '/mnt/usb/PirateBox/Shared/'**\\ | ||
| - | to **list media_dir '/opt/piratebox/share/Shared/'**\\ | ||
| - | Press SHIFT+Z, SHIFT+Z on the keyboard to save. | ||
| - | <code> | ||
| - | /etc/init.d/minidlna reload | ||
| - | </code> | ||
| - | to save changes | ||
| - | ==== Credits ==== | ||
| - | * Matthias - for the Piratebox Project and updated code. | ||
| - | * meduza - for the majority of the scripting for the Zsun. | ||
| - | * stylesuxx - for the wifi configuration and troubleshooting. | ||
| - | * TheExpertNoob - for troubleshooting and this wiki guide. | ||
| - | |||
| - | If I forgot anyone else, PM me. | ||