In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to visit your raspberry pie anytime and anywhere with frp. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Preface
What is a "raspberry pie" on Zhihu and how do ordinary people play it? The high ticket answer, 11 / 11, decisively bought a raspberry pie 3. The goods arrived on Monday (11.13). I just want to implement a simple function at the moment-I want to access my raspberry pie from anywhere. Like a Pandora's box, the first step must be to get the key!
Assembly
Assembling actually refers to putting raspberry pie in a red and white shell. The basic idea is to go to the seller's store to see the assembly instructions. Among them, the installation of the small fan is a little special, which needs to be connected to 4 racks and 6 feet. It is the second and third from the right of the outermost layer. If it is not connected correctly, the small fan will not turn. I took a special screenshot in order to forget:
Debug
As I said earlier, I bought a suit with a small monitor. Mainly because the intranet ip often changes, it is not easy for me to determine the ip of raspberry pie. And when I start for the first time, I need to enter the password manually.
Although I listened a lot, I really saw that small box, coupled with such a low-cost display, actually worked together to show the desktop of the system, which was a little touching. NB ~
PS: this small display can also be used as an external display for mac. The first time you use a mac monitor, remember that the trick is to move the mouse out of the screen, and the cursor will automatically appear on another screen.
Change the default ssh password
Raspberry pie ssh login password, the default user name is: pi, the default password is: * * raspberry** to change the first time.
Passwd sets ssh automatic login
Raspberry pie does not have a directory by default. Ssh, you need to create it first. After you need ssh to log in to the raspberry pie, execute it in the pie:
Mkdir / .ssh/
On any computer that wants to access raspberry pie, execute it directly (not after logging in to raspberry pie):
# set automatic login .cat ~ / .ssh/id_rsa.pub | ssh pi@ raspberry pie intranet ip "cat > > ~ / .ssh/authorized_keys"
Raspberry pie intranet ip will be replaced by raspberry pie intranet ip. Of course, the computer you use to access raspberry pie is on the same LAN as raspberry pie.
Modify root password
Raspberry pie does not have a root password by default, just set it.
# set root password sudo passwd root# unlock root account sudo passwd-unlock root# switch to root account su root to solve the problem of incomplete utilization of raspberry pie capacity
I have 64 gigabytes of memory card, but look at the container, the total is only 7.2 gigabytes. The first reaction is to meet a black-hearted businessman, but searched on the Internet, simply set up and restart. For details, see: http://cedar-renjun.github.io/2015/10/11/resize-raspberry-sd-volume/
Key steps are recorded here for reference:
Operation step 1. Revisit the raspberry pie and go to the command line page 2. Log in to raspberry pie with the user name pi and password raspberry
Sudo su switches to superuser
Df-h shows the status and usage of the current partition
Enter fdisk / dev/mmcblk0 to load the SD card
P print the current partition you should see three partitions (mmcblk0, mmcblk0p1, mmcblk0p2). Now write down the information about partition 2 (/ dev/mmcblk0p2). I mainly recorded the values of the start sector (122880) and the end sector (8447999). Press d to start deleting the partition
You are prompted for the delete partition number and enter 2
Press n to create a new partition, and then enter p, 2
Next, enter the original 2-sector start number (122880) and remember to replace it with your own number.
Press w to keep the configuration
Enter reboot to restart raspberry pie
Enter sudo resize2fs / dev/mmcblk0p2 to update the system
Type df-h to see if the remaining space has been fully used.
Note: after step 10, the system prompts you to enter at the end of the sector, just keep the default enter.
Configure frp to prepare public network ip and public network server
Public network ip and public network server, similar to a bridge. Through it we will be able to access the raspberry pie we put on the intranet. Server, I bought the lowest configuration of the cloud server. Of course, you can also use your existing ip and server.
Optional: prepare a domain name
Top-level domain name or second-level domain name, as long as you can do ip type DNS resolution. This step is simply to resolve the domain name to the public network ip in the previous step. In this way, it will be easier to visit in the future, and you don't have to remember ip. Of course, it is also possible to access it directly with ip.
Configure frp server-frps
The server side of frp, the general name is frps, and the configuration file is frps.ini. These two files should be put on your public network server. In general, you should go to the publishing page to find the latest download version of the corresponding operating system of frp. Here, take frp_0.13.0_linux_amd64.tar.gz as an example.
# download. Download address can be downloaded from the github release page right-click a download-> copy link address. Wget https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_linux_amd64.tar.gz# decompress .tar-zxvf frp_0.13.0_linux_amd64.tar.gz# cd to the frp directory .cd frp_0.13.0_linux_amd64# editor .Debian. The command to open vim is vi. Not vim.vi frps.ini.
In frps.ini, enter:
[common] bind_port = 7000vhost_http_port = 80dashboard_port = dashboard_port_numberdashboard_user = dashboard_user_namedashboard_pwd = dashboard_pwd_valueprivilege_token = privilege_token_value
Then, open frps:
. / frps-c. / frps.ini
Once the server side is configured, you should be able to open the frp console page in browsing:
Note:
Dashboard_port_number is changed to a specific port number, such as 8000, so that the frps console page can be accessed through http://yourip:8000.
Dashboard_user_name and dashboard_pwd_value, change to a custom user name and password to enter when accessing the frps console page.
Change privilege_token_value to a custom value. As long as the client and the server privilege_token match, the client can connect to the frp server.
Configure frp client-raspberry pie
Frp client, the general name is frpc, the configuration file is frpc.ini. These two files should be put on your intranet server, raspberry pie. In general, you should go to the publishing page to find the latest download version of the corresponding operating system of frp. Here, take frp_0.13.0_linux_arm.tar.gz as an example.
# download. Download address can be downloaded on the github release page right-click a download-> copy link address. Wget https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_linux_arm.tar.gz# decompress .tar-zxvf frp_0.13.0_linux_arm.tar.gz# cd to the frp directory .cd frp_0.13.0_linux_arm.tar.gz# to edit. On debian, the command to open vim is vi, not vim.vi frpc.ini
In frpc.ini, enter:
[common] server_addr = your_server_ipserver_port = 7000privilege_token = privilege_token_valuelogin_fail_exit = false [ssh] type = tcplocal_ip = 127.0.0.1local_port = 22remote_port = remote_port_number
Then, open frpc:
. / frpc-c. / frpc.ini
Once you've configured the server, you should use ssh to access your raspberry pie on any computer that can connect to the Internet:
# Port and ip should be replaced with your own .ssh-oPort=remote_port_number pi@your_server_ip
Note:
Your_server_ip is to be replaced with the public network ip bound on the public network server.
The frps server and client do not have to have the same operating system, but the frp version is best matched.
Raspberry pie 3 debian system, requires the arm version of the program installation package.
The privilege_token should correspond to the frps.ini on the server side
Login_fail_exit is very important, otherwise it will not be possible to automatically start frpc when the system is restarted.
Remote_port_number, which is used to specify which port of the remote server to ssh access to raspberry pie.
Using Systemd to automatically start frp
Systemd ensures that frp-related services will be started automatically when raspberry pie restarts unexpectedly. In this way, we don't have to worry about all kinds of accidents all day.
Install Systemd
Most Linux systems have built-in Systemd. If not, you can install it manually.
To install systemd, run:
Apt-get updateapt-get install systemdapt-get install systemd-sysv
After installing systemd, in order for the system to be used as systemd, it is best to specify the following parameters on the kernel command line in the grub configuration file:
Vi / etc/default/grubGRUB_CMDLINE_LINUX_DEFAULT= "quiet splash init=/lib/systemd/systemd"
To boot the system with the newly installed systemd, restart the system:
# reboot uses Systemd to manage frps# on the server side, you need to cd to the frp directory first. # copy the file cp frps / usr/local/bin/frpsmkdir / etc/frpcp frps.ini / etc/frp/frps.ini# and write the frp service file Take centos7 as an example, it is suitable for debianvim / usr/lib/systemd/system/frps.service# content such as [Unit] Description=frpsAfter= network.target [Service] TimeoutStartSec=30ExecStart=/usr/local/bin/frps-c / etc/frp/frps.iniExecStop=/bin/kill $MAINP ID [install] WantedBy=multi-user.target# launch frp and set boot systemctl enable frpssystemctl start frpssystemctl status frps# part of the server. You may need to add a .service suffix to operate. That is, systemctl enable frps.servicesystemctl start frps.servicesystemctl status frps.service uses Systemd to manage frpc# in the raspberry pie client, which requires cd frp to extract the directory first. # copy the file cp frpc / usr/local/bin/frpcmkdir / etc/frpcp frpc.ini / etc/frp/frpc.ini# and write the frp service file Take centos7 as an example, it is applicable to the following debianvim / usr/lib/systemd/system/frpc.service# content: [Unit] Description=frpcAfter= network.target [service] TimeoutStartSec=30ExecStart=/usr/local/bin/frpc-c / etc/frp/frpc.iniExecStop=/bin/kill $MAINP ID [install] WantedBy=multi-user.target# launch frp and set boot systemctl enable frpcsystemctl start frpcsystemctl status frpc# part of the server, you can add a .service suffix to operate, that is: systemctl enable frpc.servicesystemctl start frpc.servicesystemctl status frpc.service
Note:
If the frps or frpc startup is invalid, you can try to stop the service first, such as:
Systemctl stop frpc above is how to use frp to visit your raspberry pie anytime and anywhere. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.