bianbian

新虚拟机里的eth1

2013.04.28

环境:Ubuntu 12.04.2 LTS

用virtual box新建虚拟机,使用之前创建的vdi文件。
不能联网。ifconfig查看,eth0不见了,有一个eth1。eth1没有网络连接。

原因是原虚拟机文件里面保存了网卡eth0信息,新虚拟机分配的网卡命名eth1。而/etc/network/interfaces只有eth0的配置信息,没有eth1。
删除网卡信息后重启,让os重新分配网卡编号,就能联网了。

sudo rm /etc/udev/rules.d/70-persistent-net.rules
sudo reboot

参考

run linux application from windows

2012.09.19

Environment:

debian 6  
windows xp

I have a linux without desktop installed (gnome, kde, etc.), but I need run GUI application on this linux machine, from my windows workstation! How to to that?

Most linux use X window system for GUI display, so does debian. X uses a client-server moduel through network. linux applications running on linux are client, your workstation(keyboard, mouse, screen) are the server - they provide service to applications.

So all we need are:

  • X server
  • client
  • connection between X server and client

X server

Most *nix shiped with X server, there are many X server implementations for windows too. Such as xming(oos) and x-win32(commerical).
I choose xming.
Download and install xming. start Xming by just click the Xming icon.

client

Applications I’d like to run are already installed on linux machine.

connection between X server and client

putty is a widely used ssh client on windows, it can be used to forward X Widnow System application over your ssh connection.

putty config X11

after login to your linux, check if X forward works fine.

bianbian@server:~$ echo $DISPLAY
localhost:10.0

If this works, just run the application from shell! :)

xterm running from windows

But if it doesn’t work…
check if X11Forwarding yes specified in /etc/ssh/sshd_config and if xauth application installed on linux.. fix problems and restart sshd if necessary, re-ssh to linux and make sure the DISPLAY variable is set properly.

Ref:

DIY树莓派外壳

2012.08.01

制作材料:

  • 得力7621名片盒
  • 电烙铁
  • 美工刀

本来打算只用美工刀的,结果发现太费力了!
后来改上电烙铁打洞+美工刀修整.耗时两个晚上.
虽然打磨地很挫,但是盖上盖还是很漂亮的,哈哈哈:)

正面照

树莓派led实验

2012.07.30

其实还搞不太了解pi的gpio的电气特性,只知道gpio是直接跟BCM芯片连接,目前有多种语言能控制GPIO.
GPIO电压是3V3,拿来做个LED实验应该木问题.

所需器材:

  • rpi一只(必须的啦~)
  • 面包板
  • 发光二极管一只
  • 220R电阻一只
  • 杜邦线若干

思路:控制GPIO电压高低(3V3或0),就能点亮LED啦,保险起见,加个电阻限流.
电路图:

电路图

搞起来~
下载最新的python gpio驱动
选择python-rpi.gpio_0.3.1a-1_armhf.deb安装:

dpkg -i python-rpi.gpio_0.3.1a-1_armhf.deb

python程序 testled.py:

import RPi.GPIO as GPIO
import time

#这一步是必须的哟,应该是从0.3版本添加的新特性
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)

while True :
  print 'set output low'
  GPIO.output(11, GPIO.LOW)
  time.sleep(1)
  print 'set output high'
  GPIO.output(11, GPIO.HIGH)
  time.sleep(1)

跑起来:

sudo python testled.py

效果:

rpi和面包板 面包板接线

« Previous Next »