Objective
The Raspberry Pi has been in contact for more than a year, mainly for Linux servers. Some time ago, Raspberry Pi 2 was on sale, and the Raspberry Pi was on fire again. Now I would like to introduce my experience and hope that it will be helpful to your readers.
Get ready
- Raspberry Pi
- Router
- Cable
- Power
- Sd
- Computer
You can also refer to this article without a router. However, it is recommended to use it, can save a lot of work.
Burn image
- Download like image here, I choose Raspbian,debian dafa good!
- Download Win32diskimager
- Insert the SD card and burn
Assemble and start
I don't think I need to talk about this one, but seeing the Raspberry Pi two green light indicates that the boot was successful.
SSH connection
If you don't know what SSH is, click here
The Raspberry Pi has started the SSH service by default
Get the Raspberry Pi IP address, if you use a router, this is easy to access the management interface can be found. Like mine is.192.168.1.104
Binding static IP for easy administration later. There are many ways to bind static addresses, and I choose the most lazy one, such as by modifying interface. It is recommended to allocate some more biased IPs to avoid collisions with DHCP allocations.
The default user name is PI and the default password is raspberry
ssh [email protected]
If everything in front is normal, you can seepi@raspberrypi ~ $
Quick Setup
sudo raspi-config
If your SD card is larger than 4G, it is recommended to choose the first expand Filesystem, other depending on the situation.
In order to avoid garbled trouble, recommend the use of English system.
Install the AppSearch for the fastest source
It is encouraging that many universities in China have already opened the image source of Raspberry Pi, according to my incomplete statistics:
- Zhejiang University
- Chongqing University
- Hust
- Zhongshan university
Use our gadgets below to automatically find the fastest source:
sudo apt-get install apt-spysudo apt-get updatesudo apt-spy -d wheezy -a Asia
You can also manually add the above addresses to the/etc/apt/sources.list
Installing Tasksel
sudo apt-get install taskselsudo tasksel
Easy to install common services and applications
Using VNC to display the graphical interface
This part is not recommended unless you are particularly interested in looking at the Raspberry Pi's desktop, because this is not only a card that doesn't make any sense.
//安装sudo apt-get install tightvncserver//运行vncserver :1 //第一次运行VNC会让你输入密码,记住它
With clients such as Remmia, you can connect directly to the Raspberry Pi, and the remote Desktop that comes with Windows can be connected directly.
Log in with SSH key
Start with this section for advanced content
It is cumbersome and unsafe to enter a password each time you log in, using SSH key instead of a password to log in.
Generate key
ssh-keygen -t rsa
Then it will appear that you are strongly advised to use the default, that is, just enter.
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
A message similar to the following is created
Your identification has been saved in /Users/you/.ssh/id_rsa.# Your public key has been saved in /Users/you/.ssh/id_rsa.pub.# The key fingerprint is:# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db
Add key to Ssh-agent
Make sure the ssh-agent is available
$ eval "$(ssh-agent -s)"Agent pid 12190
The PID information is printed to indicate normal
ssh-add ~/.ssh/id_rsa
To add a public key to a remote server
The remote server here refers to Pi.
First check the local key
ls -al ~/.ssh
You can see the previously created Id_rsa,id_rsa.pub
出现如下信息:total 24drwx------ 2 reeco reeco 4096 3月 9 18:59 .drwxr-xr-x 55 reeco reeco 4096 3月 9 18:59 ..-rw-rw-r-- 1 reeco reeco 47 3月 9 18:59 config-rw------- 1 reeco reeco 1679 3月 4 16:10 id_rsa-rw-r--r-- 1 reeco reeco 399 3月 4 16:10 id_rsa.pub-rw-r--r-- 1 reeco reeco 2876 3月 9 16:28 known_hosts
All we have to do is copy the id_rsa.pub to the Raspberry Pi, and the recommended practice is:
ssh-copy-id remote_host
If you lonely, you can also challenge Hard mode:
//树莓派下:sudo mkdir ~/.ssh//修改权限,不然无法写入sudo chmod 777 ~/.ssh//计算机下:cat ~/.ssh/id_rsa.pub | ssh [email protected] ‘cat - >> ~/.ssh/authorized_keys‘//将权限修改回来chmod 600 ~/.ssh/authorized_keys && chmod 700 ~/.ssh/
Test connection
ssh [email protected][email protected]aspberrypi ~ $
Awesome! has succeeded!
Modify SSH config to simplify SSH connection again
I don't need a password. Still think every time input a lot of trouble, sometimes don't remember IP address, there is more simple method? Of course, look down:
touch ~/.ssh/config vim ~/.ssh/config //INSERT 以下内容: Host pi HostName host_ip User pi Port 22
Then
ssh pi
can also successfully connect on, is not very cool!
See more
Raspberry Pi Raspberry to get started report
Do not underestimate! Raspberry Pi 16 Cool gameplay
Raspberry Pi beginers
Raspberry on GitHub
Raspberry Pi Quick Start Guide