Sie sind auf Seite 1von 7

ThisisGoogle'scacheofhttp://www.straightrunning.com/XmingNotes/pixming.php.

Itisasnapshotofthe
pageasitappearedonFeb27,201516:02:45GMT.Thecurrentpagecouldhavechangedinthemeantime.
Learnmore
Tip:Toquicklyfindyoursearchtermonthispage,pressCtrl+ForF(Mac)andusethefindbar.

Textonlyversion

XmingChangesFontsTrouble?ManualXmingrcportablePuTTY
XmingwithRaspberryPi

CrustlessPi
Thisisdetailedrecipe(withbadpuns!)forgettinga RaspberryPidisplaying,outofthebox,via
PuTTYandXmingonWindows.Themethoddescribedisheadless(AKAcrustless:thePineedsno
keyboard,mouseorTV/monitorconnectedtoperformit)butit'snotcompulsorytobeso .Thisisjust
aconvenientmethodtomakesomesimplefilechanges(thatIuse)withonlyanetworkcableandmicro
USBpowerconnectedtothePi.
ThemethodusesaLinuxcomputerforsettingtheRaspbianimageontheSDcard(Raspbianchanges
shownherecouldjustbedeferredonaheadedPi).YouneedthePi,notyetpoweredup,connectedto
yournetworkplusanSDcard+USBadaptorthelatterjustforinterfacingtheSDcardtotheLinux
computerifithasnoSDcardslot.
Note:forthisexamplemethodthenetwork(192.168.0.0)hasconnected:aWindowscomputer(with
PuTTYandXminginstalled),raspberrypi(willbesetto192.168.0.6)andaninternetgateway
machine/firewall/router(192.168.0.5).ALinuxcomputerisalsoneeded,butitdoesnothavetobeonthe
192.168.0.0network.Youwillhavetoadaptthingstosuityourconfiguration.
SomeofthewindowcapturesbelowmaynotexactlymatchwhatyounowseewiththelatestRaspbian
"wheezy"image.

Pi&bash
Download,copytoSDmemoryandcustomisetheRaspbian"wheezy"image.
Note:commandsshown($'command')inthissectionarefortheLinuxcomputer.
1. DownloadRaspbian"wheezy" 20150131raspbian.zipto,forexample,aLinuxcomputer
directory/scratch(thezipisa976MBdownloadandtheextractedimage,fortheSDcard,is
3.05GB).Note:theSDcardneedstobe4GBorlargerandnotpartitioned.
$cd/scratch
$sha1sum20150131raspbian.zip
0171e77f687c447dae32609fcc6aa700c750d6f520150131raspbian.zip
$unzip20150131raspbian.zip
Archive:20150131raspbian.zip
inflating:20150131raspbian.img

2. PlugyourSD/adaptorintotheLinuxcomputer(besttoreformattheSDcardfirst).Findthedevice
thatisyourSDcard
$fdiskl
...
DeviceBootStartEndBlocksIdSystem
/dev/sdc1819277445113868160bW95FAT32

showsa/dev/sdc1partition,forme,anda4GBSDcard(butcheckreallycarefullyyougetthe
rightdevice+theSDcardisabouttobeimagedandallitsoriginalcontentslost!)
$umount/dev/sdc1
umount:/dev/sdc1:notmounted

justincaseitismountedandcopytheimagetotheSDcard(takesawhile)
$ddbs=4Mif=20150131raspbian.imgof=/dev/sdc
781+1recordsin
781+1recordsout
3276800000bytes(3.3GB)copied,663.405s,4.9MB/s

Note:useofdevice:/dev/sdc,notthefirstpartitiononthedevice:/dev/sdc1.
$sync

toflushsystembuffersbeforeremovingtheSD/adaptor.
3. YoucanseetheRaspbianpartitionsontheSDcard
$partedl
...
Model:SanDiskSDDR113(scsi)
Disk/dev/sdc:3965MB
Sectorsize(logical/physical):512B/512B
PartitionTable:msdos
NumberStartEndSizeTypeFilesystemFlags
14194kB62.9MB58.7MBprimaryfat16lba
262.9MB3277MB3214MBprimaryext4

Note:younowhavetwopartitions,thefirst'/boot'andthesecond'/',fortheRaspbianfilesystem.
4. UnplugtheSD/adaptorandplugitbackinagain.Thenewpartitionwillnotmountifyoudon't
dothis.
5. Mountpartition/dev/sdc2andgotothelocationofthefirst,ofthree,filestobechanged
$mkdir/media/externalifthedirectory/media/externaldoesnotexist
$mounttext4/dev/sdc2/media/external
$cd/media/external/etc/network

I'mgoingtosettheinterfaceonthePitobestaticaddress:192.168.0.6,andtheinternetgateway:
192.168.0.5.Firsteditfile'interfaces'(filechangesareshowinunifiedformat:'diffu')
$diffusave_interfacesinterfaces
save_interfaces2013121517:59:24.069999998+0000
+++interfaces2013121714:52:30.831407245+0000
@@1,7+1,10@@

autolo
ifaceloinetloopback
ifaceeth0inetdhcp
+ifaceeth0inetstatic
+address192.168.0.6
+netmask255.255.255.0
+gateway192.168.0.5
allowhotplugwlan0
ifacewlan0inetmanual

Addatleastonenameservertofile/media/external/etc/resolv.conf(mygatewayisalsoaDNS
server).YoucanjustaddyourISP'sDNSservers.
Changedirectory(i.e.upto/media/external/etc)andeditfile'resolv.conf'
$cd..
$diffusave_resolv.confresolv.conf
save_resolv.conf2013121517:40:46.659995278+0000
+++resolv.conf2013121714:54:03.913156182+0000
@@1+1@@
nameserver8.8.8.8
+nameserver192.168.0.5

Correctthehostaddressinfile'hosts'
diffusave_hostshosts
save_hosts2013020901:24:59.380002225+0000
+++hosts2013021222:38:28.731821935+0000
@@5,4+5,4@@
ff02::1ip6allnodes
ff02::2ip6allrouters
127.0.1.1raspberrypi
+192.168.0.6raspberrypi

6. Enablethesshserver(it'sdisabledbydefault).Stillfromdirectory/media/external/etc
$forfilesin`find.typelname\*ssh`;dols$files;done
./rc2.d/K01ssh
./rc4.d/K01ssh
./rc5.d/K01ssh
./rc3.d/K01ssh

thesesymboliclinksneedtobechanged.Usethisasascriptfile
#!/bin/sh
rm./rc2.d/K01ssh
rm./rc4.d/K01ssh
rm./rc5.d/K01ssh
rm./rc3.d/K01ssh
lns../init.d/ssh./rc2.d/S02ssh
lns../init.d/ssh./rc4.d/S02ssh
lns../init.d/ssh./rc5.d/S02ssh
lns../init.d/ssh./rc3.d/S02ssh

Getoutofthemountedpartitionanddismountit
$cd

$umount/media/external

YouarefinishedontheLinuxcomputer.RemovetheSD/adaptor.

Eureka
TransfertheSDcardtothePiandpoweritup.Itshouldbootandbeabletorespondtopingandservice
SSHrequests.
$ping192.168.0.6

PingshouldrespondonthePiitselfandelsewhereonthenetwork(andwherenamedto:raspberrypi).

Raspberryblown?
Ifyouhaveaproblem,orgetonelater,youcanmovetheSDcardbacktotheLinuxcomputer,mount
partition2againandexaminethelogsindirectory/media/external/var/log
IcleanSDcardswiththeofficial SDAssociationformatter,beforereusingthem,asitremovesany
partitionsautomatically.

PiSSH
UsePuTTYtologintothePiremotelyviaSSH,configureandupdatetheRaspbianOS,andpreparefor
usewithXDMCPandXForwarding.
Note:commandsshown($'command')inthissectionareforyourPiviaPuTTYonWindows.
1. RunPuTTY.exeonyourWindowscomputer.
Entertheaddressofraspberrypi(192.168.0.6inthiscase),settheremotecharactersettoUTF8
andclick'Open'.

Click'Yes'tothePuTTYSecurityAlert...wedotrustthishost!

2. AtthePuTTYterminalpromptrespondpito'loginas:'andraspberryto'pi@192.168.0.6's
password:'
Youshouldnowhaveacommandlineterminalforpi@raspberrypi:~
Enter:sudoraspiconfig

Youneedto'ExpandFilesystem'(ifyourSDcardisbiggerthan4GB),set'ConsoleTextconsole,
requiringlogin(default)'for'EnableBoottoDesktop/Scratch',check/set'Internationalisation
Options'and'Select''AdvancedOptions/Update'.Note:thatyoursshservershouldbeleftenabled,
andthedefaultlocaleisfortheUK.Rerunraspiconfigagainanytimeyouwanttochangethese

options.
3. Youshouldbeontheinternet(viayourgateway)sodoafullupgrade
$sudoaptgetupdate
$sudoaptgetupgrade

Gomakecoffee...upgrademaytakesometime!
Youdon'twantallthatloginspamagainandarebootisnowneeded
$touch.hushlogin
$sudoshutdownrnow

YourPuTTYterminalwilldisconnect,socloseit,waitawhileandreconnectwithPuTTYwhen
thePihasbooted(usepingtocheckit'sup).
4. LogbackintothePuTTYterminalforuserpi.
Giverootapasswordandrememberit(optional...it'syourPi...youcanrebuildtheimageyourselfif
youdestroyit...plusyoudon'twanttokeeptypingsudotodousefulwork!)
$sudopasswdroot

ButIsuggestyouadd(orenable)somealiasesin~/.bashrcforbothuserpiandroottoprotect
yourselfalittle.
save_.bashrc2013102822:09:34.740000001+0000
+++.bashrc2013112507:56:57.832897001+0000
@@86,6+86,10@@
#aliasla='lsA'
#aliasl='lsCF'
+aliasrm='rmi'
+aliascp='cpi'
+aliasmv='mvi'
+
#Aliasdefinitions.
#Youmaywanttoputallyouradditionsintoaseparatefilelike
#~/.bash_aliases,insteadofaddingthemheredirectly.

Note:roothasslightlydifferentcontents,in.bashrc,tothatabove.
5. Becomesuperuserroot
$su

loginandinstallpackagexdm
$aptgetinstallxdm

thisruns
dpkgreconfigurexdm

aspartoftheinstallanddisplays

choosexdmasthedefaultdisplaymanager.

6. In/etc/X11/xdmchangetwofilestoallowremoteaccess(sopleasebecarefulwhocan'sniff'
trafficonyournetwork)
save_xdmconfig2013042922:19:04.000000000+0100
+++xdmconfig2013120219:04:16.545476001+0000
@@33,4+33,4@@
!SECURITY:donotlistenforXDMCPorChooserrequests
!CommentoutthislineifyouwanttomanageXterminalswithxdm
DisplayManager.requestPort:0
+!DisplayManager.requestPort:0

and
save_Xaccess2013042922:19:04.000000000+0100
+++Xaccess2013120218:49:23.839205000+0000
@@43,7+43,7@@
#righthandsidescanmatch.
#
#*#anyhostcangetaloginwindow
+*#anyhostcangetaloginwindow
#
#Tohardwireaspecificterminaltoaspecifichost,youcan

7. Startxdmandinstallpackagesx11appsandmidori(bothinstallsoptional)
$servicexdmstart
$aptgetinstallx11apps
$aptgetinstallmidori

Createa~/.Xdefaultsfileforuserspiandroot,containingoneline(todisplayx11appsincolour)
*customization:color

MakesureXDMCPislisteningonport177/udp
$netstatulnp|grep177
udp000.0.0.0:1770.0.0.0:*2864/xdm

i.e.ifyouseeudp,177andxdmyou'regood.
Warning:XDMCPshouldonlybeexposedonaprivatenetworkwithinafirewall.

PiXming
XminginnowabletointeractwiththePiinanumberofways.
1. XDMCPmode
OnyourWindowscomputerrun
Xming:1query192.168.0.6

orwhynottryoutsomeofXming'soptions?
Xming:1queryraspberrypiclipboardwglonceresizescreen01280x720+100+100@1

LogginginviaDebianwheezy'sxdmgreater
this'Welcometoraspberrypi'loginalsoappearswhenheaded

ThedesktopdisplayingsomeoftheX11appsyouinstalledearlier.Havefun .
LogouttheLXDE(LightweightX11DesktopEnvironment)sessionproperlyfromtheTaskBar
(LXPanel)whenfinished.
2. XForwarding
StartanXmingmultiwindowmodeserver
Xmingmultiwindowclipboard

YouhaveusedPuTTYabove:timetoaddsettingsforSSHX11forwarding

NowclickOpenandloginaspi/raspberryasbefore.AtthePuTTYterminaltype
$midoriorthecommandtorunanothergraphicalapplication

TheMidoribrowserwilldisplay(ifitisinstalled),andinteractwiththeuser,ontheWindows
desktop

3. Finally:Irecommendyoudon'tusestartlxdeorlxsessionviaPuTTYasyoucan'tLogout
cleanlyandthePi'sresourcesmaybeleftinunknownstates(e.g.processesandfilesnotgracefully
flushed,stoppedorclosed).
Tableofcontents
1. CrustlessPi
2. Pi&bash
3. Eureka
4. Raspberryblown?
5. PiSSH
6. PiXming
The Xmingwebsite,documentationandimagesarelicensedundera
CreativeCommonsAttributionNonCommercialShareAlike2.0UK:England&WalesLicense.
Copyright20052015ColinHarrisonAllRightsReserved

Das könnte Ihnen auch gefallen