Giter Club home page Giter Club logo

openwrt-apu's Introduction

WIP: My OpenWRT Setup for the PC-Engines APU2

Download latest Image nightly build from OpenWRT Master:

OpenWRT-Master Last Build

Download latest build

What's this?

This is my personal Setup/Image for a OpenWRT installation on the APU2 with docker. Why? Because the apu has more than enough power to also run traefik and pihole along with OpenWRT and function as ingress node for my small home cluster. The image has all the APU2 + WLE600VX specific packages installed. It's also compiled with the following settings:

CONFIG_DOCKER_KERNEL_OPTIONS=y
CONFIG_DOCKER_NET_ENCRYPT=y
CONFIG_DOCKER_NET_MACVLAN=y
CONFIG_DOCKER_NET_OVERLAY=y
CONFIG_DOCKER_NET_TFTP=y
CONFIG_DOCKER_RES_SHAPE=y
CONFIG_DOCKER_SECCOMP=y
CONFIG_DOCKER_STO_BTRFS=y
CONFIG_DOCKER_STO_EXT4=y
CONFIG_KERNEL_DEVMEM=y
CONFIG_TARGET_OPTIMIZATION=”-Os -pipe -march=btver2“

Hardware

  • PC Engines APU 2
  • WLE600VX Wifi card
  • OS: 16 GB mSATA SSD (Don't use a SD card, the mSATA SSD is way faster)
  • Persistent data: USB / SD-Card / S-ATA
  • Serial to USB adapter (Setup)
  • USB stick >= 4 GB (Setup)

How to Install and Setup

Install OpenWRT

This is only a very brief instruction on how to setup the apu for a more detailed description see the official install guide.

Get a serial to USB adapter and a USB stick, install TinyCore to it and copy the image on the stick. (You may also want to update your BIOS, if so follow this guide ) Plug the stick into the apu and connect it via the USB to serial adapter with your PC, but don't power the apu on yet. Open a Terminal and type:

screen /dev/$(dmesg | grep -o -e "ttyUSB[[:digit:]]$") 115200,cs8

Now power on the apu, on the Terminal you should now see the apu booting TinyCore. Once booted enter the following in TinyCore

gzip -dc /openwrt-x86-64-combined-squashfs.img.gz | sudo dd status=progress bs=8M of=/dev/sda

When finished reboot and unplug the TinyCore Stick, OpenWRT is now reachable via SSH on 192.168.1.1 on the LAN interface (eth1), for convenience you may now switch to SSH.

Setup OpenWRT

This is mainly a documentation for myself on how I set everything up.

Set your root password

Enter passwd you'll be prompted for a new password

Partition the rest of your volume

Type fdisk /dev/sda Press p to print your partition table, it should look like this:

Disk /dev/sda: 14.94 GiB, 16013942784 bytes, 31277232 sectors
Disk model: SATA SSD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x423b062f
Device     Boot  Start      End  Sectors  Size Id Type
/dev/sda1  *       512    41471    40960   20M 83 Linux
/dev/sda2        41984   513023   471040  230M 83 Linux

Now press n to create a new partition press Retrun 4 times to use the default value, this will create a partition filling up all unassinged space. Press p again to print your partition table, it should now look like this:


Disk /dev/sda: 14.94 GiB, 16013942784 bytes, 31277232 sectors
Disk model: SATA SSD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x423b062f

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sda1  *       512    41471    40960   20M 83 Linux
/dev/sda2        41984   513023   471040  230M 83 Linux
/dev/sda3       514048 31277231 30763184 14.7G 83 Linux

Press w to safe the changes

mkfs.ext4 /dev/sda3

vi /etc/config/fstab

config 'global'
	option	anon_swap	'0'
	option	anon_mount	'0'
	option	auto_swap	'1'
	option	auto_mount	'0'
	option	delay_root	'5'
	option	check_fs	'1'

config 'mount'
	option	target	'/boot'
	option	device	'/dev/sda1'
	option	enabled	'1'

config 'mount'
	option	target	'/rom'
	option	device	'/dev/sda2'
	option	enabled	'1'

config 'mount'
	option	target	'/'
	option	device	'/dev/sda3'
	option	enabled	'1'

mkdir -p /tmp/introot
mkdir -p /tmp/extroot
mount --bind / /tmp/introot
mount /dev/sda3 /tmp/extroot
tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf -
umount /tmp/introot
umount /tmp/extroot

reboot

Create a swap partition

dd if=/dev/zero of=/swap bs=1M count=512

mkswap /swap

vi /etc/config/fstab

config swap 'swap'
        option device '/swap'
        option enabled '1'

/etc/init.d/fstab boot

swapon -s

Filename				Type		Size	Used	Priority
/swap                           file		1023996	0	-2

Create a persistent data partition

Partition the rest of your volume

mkdir /data Type fdisk /dev/sdb / fdisk /dev/mmcblk0 Now press d to delete the old and n to create a new partition press Retrun 4 times to use the default value, this will create a partition filling up all space. Press p again to print your partition table, it should now look like this:

Press w to safe the changes

mkfs.ext4 /dev/sdb1 / mkfs.ext4 /dev/mmcblk0p1

vi /etc/config/fstab

config 'mount'
	option	target	'/data'
	option	device	'/dev/<DEVICE>'
	option	enabled	'1'

reboot

Make login secure

add key to /root/.shh/authorized_keys

test login (!!!)

config dropbear
        option PasswordAuth 'off'
        option RootPasswordAuth 'off'
        option RootLogin 'off'
        option Port         '22'
        option Interface    'lan'
        option BannerFile   '/etc/banner'

Install Packages

opkg update
opkg install collectd-mod-disk collectd-mod-iptables collectd-mod-ping collectd-mod-uptime collectd-mod-users collectd-mod-wireless \
	curl docker-compose git-http htop luci-app-ddns luci-app-dockerman luci-app-p910nd luci-app-shadowsocks-libev luci-app-statistics \
	luci-app-vpn-policy-routing luci-app-wireguard nano shadowsocks-libev-ss-local shadowsocks-libev-ss-rules shadowsocks-libev-ss-server \
	shadowsocks-libev-ss-tunnel wireguard zsh

reboot

Change default shell to zsh

nano /etc/passwd

root:x:0:0:root:/root:/usr/bin/zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Setup VPN-Client

Setup VPN-Server

Setup DDNS

Setup Containers

Setup Swarm

Setup PiHole

Setup traefik

Setup Nextcloud

Setup Portainer

Setup Git-Tea

Setup Jenkins

openwrt-apu's People

Contributors

actions-user avatar mietzen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.