Saturday, 16. December 2017 13:04
Search

Hardware

Virtualisation

Tools and scripts

Compiled things

Games and fun

freiesMagazin

Counter
Sponsored by

Use your Raspberry Pi 2 as x2go server

2015-04-01 11:32
Twitter article

There are currently no X2Go server packages for the Raspberry Pi 2. So I build and uploaded them for you :-)

To install the X2Go server, you need to add

	deb http://downloads.sourceforge.net/project/dodger-tools/x2go-raspi2 ./
to the /etc/apt/sources.list of you Raspberry Pi 2.

Then update the package information by apt-get update and install the X2Go server via apt-get install x2goserver .

Enjoy!


Use your Raspberry Pi as access point

2016-10-02 00:21
Twitter article

This script/tutorial is heavily based on the excellent article Setting up a Raspberry Pi as a WiFi access point from Adafruit. Other than Adafruit's howto, this guide shows an automatic way to convert your Raspberry Pi with Raspbian into an access point. All you need (in addition) is a supported USB WiFi stick.

To use the RaPi as access point it should be able to connect to the internet via the Ethernet cable.

Log in via SSH

Use an SSH client to log into your Raspberry Pi

ssh pi@[current IP of you Raspberry Pi]

Store the script on the Raspberry Pi

#Become root
sudo bash

#Create a new file (e.g.)
nano /tmp/ap-config.sh

#Paste the script into it
#Press Ctrl + X and confirm

#Make the script executable
chmod +x /tmp/ap-config.sh

#Run it
/tmp/ap-config.sh

The script (to paste)

You should change the WPA password "Raspberry" to a complicated one of your choice.
#!/bin/bash

#Get the device name of the WiFi device
wifiDev=$(iwconfig 2> /dev/null | grep '^[a-z]' | cut -d' ' -f1)
#Set the WPA encryption password
wpaPassword='Raspberry'

#Check if a WiFi device was found
if [ -z wifiDev ]
then
	echo "ERROR: No WiFi adapter found"
	exit 1
fi

if [ $(lsmod | grep mac80211 -c) -eq 0 ]
then
	echo "ERROR: WiFi adapter does not use mac80211 and cannot be used as access point"
	exit 2
fi

#Install the access point and DHCP server software
apt-get -y install hostapd isc-dhcp-server

#Configure the DHCP server
sed -i -e 's/^option domain-name/#option domain-name/g' -e 's/#authoritative;/authoritative;/'\
/etc/dhcp/dhcpd.conf
#Set the IP range to distribute IPs in cat >> /etc/dhcp/dhcpd.conf << "EOF" subnet 192.168.42.0 netmask 255.255.255.0 { range 192.168.42.10 192.168.42.50; option broadcast-address 192.168.42.255; option routers 192.168.42.1; default-lease-time 600; max-lease-time 7200; option domain-name "local"; option domain-name-servers 8.8.8.8, 8.8.4.4; } EOF #Make it listen to the WiFi device sed -i "s/INTERFACE.*/INTERFACE=\"$wifiDev\"/" /etc/default/isc-dhcp-server /etc/init.d/isc-dhcp-server restart #Give the WiFi device a static IP sed -i -e 's/^iface wlan0/#iface wlan0/' -e 's/^wpa-roam/#wpa-roam/' -e 's/^iface default/#iface default/'\
/etc/network/interfaces
echo "iface $wifiDev inet static address 192.168.42.1 netmask 255.255.255.0 sleep2; pre-up ifconfig $wifiDev 192.168.42.1; iptables-restore /etc/iptables.ipv4.nat" >>\
/etc/network/interfaces
#Set the IP at once ifconfig $wifiDev 192.168.42.1 #Configure the access point software echo "interface=$wifiDev driver=nl80211 ssid=Pi_AP hw_mode=g channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=$wpaPassword wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP" > /etc/hostapd/hostapd.conf sed -i 's#DAEMON_CONF.*DAEMON_CONF="/etc/hostapd/hostapd.conf"' /etc/default/hostapd #Add IP forwarding echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf echo 1 > /proc/sys/net/ipv4/ip_forward #Enable NAT iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -A FORWARD -i eth0 -o $wifiDev -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i $wifiDev -o eth0 -j ACCEPT iptables-save > /etc/iptables.ipv4.nat echo " iptables-restore < /etc/iptables.ipv4.nat" >> /etc/network/interfaces #Activate the access point and the DHCP server daemons at startup update-rc.d hostapd enable update-rc.d isc-dhcp-server enable #Move the WPASupplicant file out of the way mv /usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service ~/ #Reboot to see, if all works well reboot

Connect to your new access point

After the Pi is booted you should see a new access point in the access point list of your computer's operating system. When connecting to it with the password you picked, you will get assigned the network settings via DHCP.

Build modules for Raspbian

2013-11-28 22:00
Twitter article

This howto is about to build modules on the Debian-based Raspbian distribution for Raspberry Pi. This howto is similar to Build modules for Raspbmc and some of the information given there may be usefull for you too.

Again the module for the TP-LINK TL-WN727N USB WLAN stick should be compiled and installed.

I had build the module on my own and the following articles gave me good hints on this way: D-Link DWA-140 B3 (2001:3c15) wird nicht erkannt komme nicht weiter and Installing TP-LINK WN725N V2 driver (Kernel 3.10.13/September Update).

You may find the following howto useful even if you don't own a TL-WN727N, because you can adopt the basic building steps for your hardware.

Log in via SSH

Use an SSH client to log into your Raspberry Pi

ssh pi@[current IP of you Raspberry Pi]

Do this in the shell

#Become root
sudo bash

#Update Rasbian to get the current kernel installed
rpi-update

#Reboot the system to boot from the (new) kernel
reboot

#Become root again
sudo bash


#Install basic packages for building
apt-get -y install build-essential bc gcc make wireless-tools
ln -s /bin/true /bin/dkms

#Get the matching kernel headers package
cd /usr/src
headerPkg=$(wget http://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/ -qq -O - | grep deb | sed 's/"/\n/g' | grep deb$ | grep $(uname -r))
wget http://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/$headerPkg

#Install the package
dpkg -i linux-headers-*.deb

#Install missing dependencies
apt-get install -f -y

#Get WiFi source
wget media.cdn.ubuntu-de.org/forum/attachments/44/19/4365112-2011_0719_RT3070_RT3370_RT5370_RT5372_V2.5.0.3_prepared.tar.gz

#Extract it
tar xfz 4365112-2011_0719_RT3070_RT3370_RT5370_RT5372_V2.5.0.3_prepared.tar.gz

#Build and install the module
cd 2011_0719_RT3070_RT3370_RT5370_RT5372_V2.5.0.3_prepared
make
make install

#Remove old Kernel modules
rm -r /lib/modules/$(uname -r)/kernel/drivers/net/wireless/rt2x00

#Reboot to make the system use the new WiFi module
reboot

Build modules for Raspbmc

2013-11-24 17:46
Twitter article

If you want to use your Raspberry Pi as media player, you may find out that Raspbmc fits your needs. Most things work right "out of the box", but when you want to use some kind of "exotic" hardware, it may become complicated.

In my case it took me two days to get started the TP-LINK TL-WN727N USB WLAN stick. You will find no kernel headers package in the repository of Raspbmc and the package that can be installed via the TV interface (or via finding out the correct URL and installing it with dpkg) is not suitable for building the TL-WN727N module. You may notice that there is shipping a module that seems to work with the WLAN stick, but with it you will never connect to an access point.

I had build the module on my own and the following articles gave me good hints on this way: D-Link DWA-140 B3 (2001:3c15) wird nicht erkannt komme nicht weiter and Installing TP-LINK WN725N V2 driver (Kernel 3.10.13/September Update).

You may find the following howto useful even if you don't own a TL-WN727N, because you can adopt the basic building steps for your hardware.

Log in via SSH

Use an SSH client to log into your Raspberry Pi

ssh pi@[current IP of you Raspberry Pi]

Do this in the shell

#Become root
sudo bash

#Stop graphical interface (reduce CPU load and save RAM)
initctl stop xbmc

#Install basic packages for building
apt-get -y install build-essential bc gcc make wireless-tools

#Get Module.symvers from the Kernel headers
cd /tmp
wget http://www.mirrorservice.org/sites/raspbmc.com/downloads/bin/kernel/linux-headers-latest.deb.gz
mkdir x
dpkg-deb -x linux-headers-latest.deb.gz x
mv -v x/usr/src/linux-headers-$(uname -r)/Module.symvers /usr/src

#Fetch and prepare the Kernel source
cd /usr/src
gKernel=$(uname -r | sed 's/[0-9]*$/y/')
wget --no-check-certificate https://github.com/raspberrypi/linux/archive/rpi-$gKernel.tar.gz
tar xzf rpi-*.tar.gz
mv linux-rpi-*y rpi-linux

#Get the module source and extract it
wget media.cdn.ubuntu-de.org/forum/attachments/44/19/4365112-2011_0719_RT3070_RT3370_RT5370_RT5372_V2.5.0.3_prepared.tar.gz
tar xzf 4365112-2011_0719_RT3070_RT3370_RT5370_RT5372_V2.5.0.3_prepared.tar.gz

#Configure the Kernel
cd /usr/src/rpi-linux
make mrproper
zcat /proc/config.gz > .config
sed -i 's/CONFIG_CROSS_COMPILE.*/CONFIG_CROSS_COMPILE=""/' .config
make modules_prepare
cp /usr/src/Module.symvers .

#Make symlinks to make the module source find the kernel sources
rm -r /lib/modules/$(uname -r)/build
rm -r /lib/modules/$(uname -r)/source
rm -r /usr/src/linux
ln -s /usr/src/rpi-linux /lib/modules/$(uname -r)/build
ln -s /usr/src/rpi-linux /lib/modules/$(uname -r)/source
ln -s /usr/src/rpi-linux /usr/src/linux

#Compile and install the module
cd /usr/src/2011_0719_RT3070_RT3370_RT5370_RT5372_V2.5.0.3_prepared
make
make install

#Remove old Kernel modules
rm -r /lib/modules/$(uname -r)/kernel/drivers/net/wireless/rt2x00

#Reboot the Raspberry pi
reboot

#Check, if there is a WLAN device after logging in and becoming root again
iwconfig

Finish line

Configure the WLAN connection via Raspbmc's TV interface.

Alternatively: Create your own WiFi config file

Adjust "[myConfigName]":
nano /etc/NetworkManager/system-connections/[myConfigName]

Static IP for WiFi

Then paste in the following lines and adjust "[myConfigName]", "[SSID name of your access point]", "[WiFi IP]" and "[Router IP]".
[connection]
id=[myConfigName]
uuid=12345678-abcd-1234-abcd-1234567890ab
type=802-11-wireless
timestamp=1367940962

[802-11-wireless]
ssid=[SSID name of your access point]
mode=infrastructure
security=802-11-wireless-security

[802-11-wireless-security]
key-mgmt=wpa-psk
psk=geheim

[ipv4]
method=manual
dns=8.8.8.8;
addresses1=[WiFi IP];24;[Router IP];

[ipv6]
method=auto
ip6-privacy=2

Dynamic IP for WiFi

Then paste in the following lines and adjust "[myConfigName]" and "[SSID name of your access point]".
[connection]
id=[myConfigName]
uuid=12345678-abcd-1234-abcd-1234567890ab
type=802-11-wireless
timestamp=1367940962

[802-11-wireless]
ssid=[SSID name of your access point]
mode=infrastructure
security=802-11-wireless-security

[802-11-wireless-security]
key-mgmt=wpa-psk
psk=geheim

[ipv4]
method=auto
ignore-auto-routes=false
ignore-auto-dns=false
never-default=false

[ipv6]
method=auto
ip6-privacy=2

<< Previous articles

My other projects

m23 software distribution

m23 is a software distribution and management system for Debian, Ubuntu and Kubuntu. With m23 you can install and administrate hundreds of clients in an easy way!

Visit the m23 project at SourceForge: m23.sf.net.

Grass Roots Democracy Machine (GRDM)

The GRDM, the Grass Roots Democracy Machine is a software development project designed to create a voting system. The aim is to implement the basic goals of anonymous and comprehensible votings into software.

Visit the GRDM project at SourceForge: grassrootsdemoc.sf.net.

khtml2png

khtml2png is a command line program to create screenshots of webpages.

Visit the khtml2png project at SourceForge: khtml2png.sf.net.

based on devalcms
devalcms