LÄNKGUIDE: RPi Multifunktionell Webbserver (OpenVPN, ftpd, httpd, *)

Permalänk

LÄNKGUIDE: RPi Multifunktionell Webbserver (OpenVPN, ftpd, httpd, *)

HEJ!

Jag skriver en snabbguide till att börja med, speciellt anpassat för linux-n0bs som mig. Eftersom all information hittas på nätet så tänkte jag bara använda mig av länkar till guider och knep som fungerade för mig.

Länkar:
Raspbian Server Edition (strippad version) http://sirlagz.net/2013/02/14/raspbian-server-edition-version-2-3/ (lista på borttagna pkgs: http://sirlagz.net/RPi/RSE/pkgsv2.3.txt)

Du behöver antagligen:
Minst 4GB SD minneskort
Tålamod

BASIS:

  1. Välj linuxdistro till din pi (Raspbian/debian är trevligt):
    http://www.raspberrypi.org/downloads

  2. Ladda hem senaste Raspbian wheezy och formatera kortet med http://sourceforge.net/projects/win32diskimager/

  3. Boota upp din pi. Logga in med Login: pi pass: raspberry

  4. Uppdatera din pi. Skriv:
    sudo apt-get update
    sudo apt-get upgrade

OpenVPN och no-ip dns tjänst-installation: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=21566

Denna guide går även genom och konfiguerar en manuell enkel firewall.

Permalänk

Scripts och sånt.

sudo apt-get install screen

Citat:

tabbar till screen (kapat från )
Here's my .screenrc that i use everywhere to see my screen numbers as tabs at the bottom of the window and an informational line above the tabs. The part you really need is under "look and feel".

# skip the startup message
startup_message off

# go to home dir
chdir

# Automatically detach on hangup.
autodetach on

# Change default scrollback value for new windows
defscrollback 10000

# start with visual bell as default
vbell on
vbell_msg "bell on %t (%n)"

# look and feel
caption always "%{= bb}%{+b w}%n %t %h %=%l %H %c"
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"

activity "Activity in %t(%n)"

shelltitle "shell"
shell -$SHELL
#You could additionally add the following to automatically add two tabs when the screen is initially created:
screen ssh usr@IP1
screen ssh usr@IP2

Also, the status content can be updated using escape codes issued from shell commands and prompts. For example, i update the status with the current directory using by using this in my .bashrc:

if [ 'screen' == "${TERM}" ]; then
export PROMPT_COMMAND='printf "\e]2;%s %s\a" "${USER}" "${PWD}" '
fi

Jag ville att min pi ska skicka iväg ett meddelande (mail i detta fall) till mig så fort den kommer online. Detta script mailar ut det aktuella ip-numret som den blivit tilldelad, varje reboot.

ssh pi:
sudo apt-get install sendEmail

sudo nano /etc/rc.local

Citat:

# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
sendEmail -f pi@raspberrypi -t duu@gmail.com -u "Boot @ "$_IP"" -m "Test massage" -s smtp.gmail.com:587 -o tls=yes -xu login/gmail -xp lösenord
fi
exit 0

CTRL+X , y , ENTER
sudo reboot