Raspberry Pi etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
Raspberry Pi etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
10 Eylül 2015 Perşembe
How to write Raspbian/image file to SD card on Ubuntu 12.04 (easy way)
I received my Raspberry Pi a few days ago but only today I'm able to play around with it. Since I purchased Raspberry Pi without the SD card, the first thing I need to do to make it running is writing the Operating System (OS) Image to my existing SD card . I'll be using my Verbatim 16Gb SD Card class 4 for this job . For complete list of Raspberry Pi compatible card, you can visit here.
In this post, I'm going to share how to write Raspbian OS to SD card. This post can be use as guideline to write any image file to SD or USB drive. Raspberry Pi only can work with 32 FAT file system .Make sure you reformat your card to 32 FAT filesystem. Please refer my previous post on how to do this.
The idea behind this post is using a software call 'imagewriter' . I choose to use this software because it is easier and safer especially to those who are new with Ubuntu.Other method that can be use is by using dd command. Extra precaution is needed if you use the command, if you wrongly type it in ,it can corrupt the whole usb/sd drive . For this reason some people call the dd command as 'Destroyer of disk' .I have experienced doing that and it took me sometime to get the drive back .
Steps
1. Download latest Raspbian zip file here
2.Go to the folder you download the file and check sha1sum message digest for the file . Confirm the file name similar with the one on Raspberry download page
![]() |
Sha1sum |
shark_attack@Positive-Space:~$ cd /home/shark_attack/Downloads
shark_attack@Positive-Space:~$ sha1sum 2013-09-25-wheezy-raspbian.zip | grep 99e6b5e6b8cfbf66e34437a74022fcf9744ccb1d
shark_attack@Positive-Space:~$ sha1sum 2013-09-25-wheezy-raspbian.zip | grep 99e6b5e6b8cfbf66e34437a74022fcf9744ccb1d
3.Unzip the file
shark_attack@Positive-Space:~$unzip 2013-09-25-wheezy-raspbian.zip
4. Download 'imagewriter ' software from Ubuntu software centre
![]() |
Install imagewriter program |
5. Make sure your SD card is connected. Run the 'imagewriter' program . Choose from location (Location where you store the file ) to location that you want to write the image (sdcard/usb drive)
Note : you can also do this on the terminal by typing
dd if=/home/shark_attack/Downloads/2013-09-25-wheezy-raspbian.img of=/dev/sdb
make sure you know which one is your sd/usb drive by running
df -h
6. Make sure it is successfully written.
![]() |
Successfully written |
7. Check the written file on your drive and safely remove it from your system .
8 .Run it with your Raspberry Pi. Enjoy!!.
Read Previous : How to format SD card or USB drive on Ubuntu
How to write VNC server (Raspberry Pi) startup and VNC client script
In this post, I'm going to share how to write a VNC server start up script and client script. Before you continue with this tutorial, please make sure that your VNC server and client is working.You can check how do I do it in my previous post here.
What will be accomplish by running this script on your VNC server (Raspberry Pi) is your Pi will automatically run at boot time.You can straight away log in to your Pi from your system (client) once it is booted up.Client side script is optional.I do it because I'm too lazy to remember the setting and need more space in my brain :-).
I used "case " statement for control structure on both server and client side. I use text editor on the client side and nano editor on server side to edit the script. You can download the full script at the end of this tutorial. Below are the steps I took to do this script .
1.Client
I save this script in a folder that I normally put my script in .Visit my previous post on how do I do it . I name this script as "pi" .
Pi script piece by piece
------------------------
1.1) The script start off like normal script header
#!/bin/bash
#Title : Client VNC viewer login
#Author :Nerverwreck
#Website :http://www.geckogeeky.blogspot.com
#Date :December 2013
#Rev :0.1
#Title : Client VNC viewer login
#Author :Nerverwreck
#Website :http://www.geckogeeky.blogspot.com
#Date :December 2013
#Rev :0.1
1.2)It continue to the main content of the script .This script will only have 3 case to be select from . Once the user choose to select the case, it will automatically execute the following bash command.To execute this script,you need to type on terminal " pi [-selection ] ".The "$1" sign will take the input directly from the teminal.
If the user enter command that is not in the case, the "*" sign will execute its command by stating how to use the script.
case "$1" in
-ping)
echo "Ping to Pi VNC Server"
ping 10.42.0.68 # 10.42.0.68 is my Pi IP replace with your server IP
;;
-ssh)
echo "SSH to Pi VNC Server"
ssh 10.42.0.68 -l pi
;;
-vnc)
echo "Remote login to Pi "
vncviewer 10.42.0.68:1 -geometry 1280x800 # use geometry to define your display
;;
*)
echo "`basename $0`:usage:[-ping][-ssh][-vnc]"
exit 1
;;
esac
exit 0
-ping)
echo "Ping to Pi VNC Server"
ping 10.42.0.68 # 10.42.0.68 is my Pi IP replace with your server IP
;;
-ssh)
echo "SSH to Pi VNC Server"
ssh 10.42.0.68 -l pi
;;
-vnc)
echo "Remote login to Pi "
vncviewer 10.42.0.68:1 -geometry 1280x800 # use geometry to define your display
;;
*)
echo "`basename $0`:usage:[-ping][-ssh][-vnc]"
exit 1
;;
esac
exit 0
2.Server
On server part, you need to store the script in "/etc/init.d" .This folder consist of file that will be execute during the boot time . I name this script as "autovnc"
pi@raspberrypi ~ $ cd /etc/init.d
Autovnc script piece by piece
---------------------------------
2.1) start off as a normal script header
#!/bin/bash
#/etc/init.d/autovnc
#Author :N3rv3wreck
#Website :htttp://geckogeeky.blogspot.com
#Date :December 2013
#Rev 0.1
2.2) For Debian base Linux distro, we must include in this header as a part of boot up script. If you miss this part on the script, It will pop up 'LSB missing 'warning when you want to configure it to run at boot up. For more information, you can visit here .
### BEGIN INIT INFO
# Provides: Auto VNC server startup at boot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC server daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
2.3)Changing the folder . to where you install the VNC server program . in my script i wrote as
VNCUSER='pi'
eval cd ~$VNCUSER
eval cd ~$VNCUSER
eval command will takes a string as its argument, and evaluates it as if you'd typed that string on a command line.
You can use other method in doing the same job as above. The idea of both line above is finding the location of ".vnc" file. I installed the program in my home folder .In this case, I set my Pi username as "pi" .You will have the same location as me if you follow my tutorial . You can use below command as a substitution of above two line.
cd /home/pi
2.4) Main content of the script. Basically the script idea is similar to what we have on client side. To execute the file we need to run as "./autovnc [selection] " . In autovnc, there is "start" and "stop" selection. By running "start" command, it will start the server and enabling it at display :1 with the screen size 1280x600 .
The server will be kill if we choose the "stop" case.
case "$1" in
start)
echo "Waddap..Im starting the VNC Servo!"
su $VNCUSER -c '/usr/bin/vncserver :1 -geometry 1280x800'
;;
stop)
echo "Hey..Im gonna stop the VNC Servo Yo!"
/usr/bin/vncserver -kill :1
;;
*)
echo "`basename $0`:usage:[start][stop]"
exit 1
;;
esac
exit 0
start)
echo "Waddap..Im starting the VNC Servo!"
su $VNCUSER -c '/usr/bin/vncserver :1 -geometry 1280x800'
;;
stop)
echo "Hey..Im gonna stop the VNC Servo Yo!"
/usr/bin/vncserver -kill :1
;;
*)
echo "`basename $0`:usage:[start][stop]"
exit 1
;;
esac
exit 0
If you use " cd/home/pi" in changing the folder, you can substitute
su $VNCUSER -c '/usr/bin/vncserver :1 -geometry 1280x800'
with
su pi -c '/usr/bin/vncserver :1 -geometry 1280x800'
3.Testing the script
After finish configuring, you can try and run the command by using"./autovnc start" or "./autovnc stop" command.
![]() |
Testing VNC server script |
4.Update the script to be include during the boot time .
pi@raspberrypi /etc/init.d $ sudo update-rc.d autovnc defaults
![]() |
success configuring init file |
reboot the server.
pi@raspberrypi /etc/init.d $ sudo reboot
5. You can now then try to log in to your pi from you client.
shark_attack@Positive-Space:~$ pi -vnc
![]() |
VNC to your server |
What do you think about this tutorial?To download the full script,please click here . Please subscribe this page and leave comment in the box below
Visit my other post on How to use voice to login your remote server and do other basic system control stuff. Click here .
.
How to run Raspberry pi without additional hardware only using ethernet cable on Ubuntu .
When I got my hand on Raspberry Pi, I think it's a bugger that I need an extra keyboard,hdmi cable and monitor to make it run. Since I connect my laptop to the internet using wireless usb , I can make use of my free ethernet port to connect directly to pi.
In this post, I'm going to share how we can run Raspberry pi without additional hdmi,keyboard,mouse . All you need is laptop, wireless internet connection ,an ethernet cable and a running Raspberry Pi . If you have an empty sd card without any OS in it, Please visit my previous post on how you can write to your SD card .
The idea behind this project is that, I can make my system run as an Access point to my Pi.I will use a lightweight DHCP,DNS,TFTP server function call Dnsmasq .I will share my internet connection with Pi and my system will assign a DHCP IP to it. Once we know the Pi IP, we can directly SSH to the Pi and install VNC server application. We should be able then to remotely log to Pi from our system. To cut everything short I summarize steps in points below.
What you need?
1. Laptop
2.Wireless internet connection
3.Ethernet cable
4. Raspberry Pi
Steps
-
1. Prepare setup as below photo. You can use your builtin wireless card for this project.
![]() |
Network setup |
.
2.Share Internet connection with the Pi
![]() |
Share internet with other computer |
3.Get the Raspberry Pi IP assign by our system . in my case, my Pi IP is 10.42.0.68
shark_attack@Positive-Space:~/Programming/bash$ cat /var/lib/misc/dnsmasq.leases
![]() |
Raspberry Pi IP address assign by System |
4.SSH to Raspberry Pi
shark_attack@Positive-Space:~/Programming/bash$ ssh 10.42.0.68 -l pi
![]() |
Connect to Pi via ssh command |
5.(Optional) If this is the first time you login to your Pi,you can choose what selection you want for your Raspberry Pi .For more information on this, you can visit here . We can always go back to config mode whenever we want later on by typing "sudo raspi-config" on terminal.
![]() |
Raspi config |
After finish, Choose to reboot system. Your new configuration will take effect after reboot
6. Install VNC server application to Pi .
pi@raspberrypi ~$ sudo apt-get install tightvncserver
![]() |
Installing Raspberry Pi VNC server |
7.Configure the password for remote access and enable the vncserver at display 1 .
pi@raspberrypi ~$ vncserver :1
8.Install VNC client application on your system
shark_attack@Positive-Space:~$ sudo apt-get install xtightvncviewer
![]() |
Installing xtightvncviewer on Ubuntu |
9.Remotely login Raspberry Pi.
shark_attack@Positive-Space:~$ sudo ssh 10.42.0.68 -1 pi
10.Enter your Pi IP ,display port "10.42.0.68:1" follow with "password ".
11.You should be able to remote login your Pi .
![]() |
Walla.. |
I found one website that connect their Mac computer to Pi using the same way as I did.Please visit the link Raspberry Pi Macgyver style
That's it for today. Drop some comment below and have a good day . :-)
![]() |
My Pi setting |
Read Previous : How to write Raspbian or image file on Ubuntu the easy way
How to remote SSH login Raspberry Pi without using password on Ubuntu
In this post, I'm going to share How to SSH login Remote Server (Raspberry Pi) without using password .
SSH is a secure cryptographic network protocol that can be use between two connected host for data communication, over an unsecured environment . SSH uses private key and public key in the encryption and decryption process
Private key is a read only key and only meant for your local host.This key is stored in your local machine.Public key is a key that is stored in the machine that you want to log in to. Public key is stored in ".ssh/authorized_keys" remote machine folder. If you have multiple machine that you want to log into ,you need to setup all the machine using the same public key .
Public key on the remote machine is use to encrypt the message that will transfer over the network while private key on your local machine is use to decrypt the message .As a security measure, SSH program store the private key in protected pass phrase. If your machine or stolen, you should able to change or disable your old public key. For more info on SSH and public key cryptography, please read here and here
In this post,I'm using my Raspberry Pi as a remote server . I will not setting the passphrase private and public key in this tutorial. You are free to do so if you want to .
Steps
1. Create public and private keys on your local host.
shark_attack@Positive-Space:~$ ssh-keygen
2.Copy the public keys from the local host to the remote server ".ssh/authorized_keys " .
shark_attack@Positive-Space:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub pi@10.42.0.68
In the example above, "pi" is my username and "10.42.0.68" is my Remote server (Raspberry Pi) IP .
3. Try to login from Local host to Remote host.
Read Previous : How to write VNC Server and VNC client startup Bash script
Read Next : How to convert video file type with robot feedback voice using bash script
shark_attack@Positive-Space:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub pi@10.42.0.68
In the example above, "pi" is my username and "10.42.0.68" is my Remote server (Raspberry Pi) IP .
3. Try to login from Local host to Remote host.
Read Previous : How to write VNC Server and VNC client startup Bash script
Read Next : How to convert video file type with robot feedback voice using bash script
Kaydol:
Kayıtlar (Atom)