centos7树莓派使用frp内网穿透,设置开机启动用于远程连接

发布于 2017-10-28  4.3k 次阅读


centos7树莓派使用frp内网穿透,设置开机启动用于远程连接

烧录安装系统,本地ssh连接

[系统安装参考此处](https://flyfish.im/studynotes/1311.html

扩容根分区

[root@centos-rpi3 ~]# cat README
== CentOS 7 userland ==

If you want to automatically resize your / partition, just type the following (as root user):
/usr/bin/rootfs-expand

[root@centos-rpi3 ~]# /usr/bin/rootfs-expand
Extending partition 3 to max size ….
CHANGED: partition=3 start=2074624 old: size=4194304 end=6268928 new: size=58562527,end=60637151
Resizing ext4 filesystem …
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mmcblk0p3 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/mmcblk0p3 is now 7320315 blocks long.

Done.
[root@centos-rpi3 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/root ext4 28G 897M 26G 4% /
devtmpfs devtmpfs 460M 0 460M 0% /dev
tmpfs tmpfs 464M 0 464M 0% /dev/shm
tmpfs tmpfs 464M 12M 452M 3% /run
tmpfs tmpfs 464M 0 464M 0% /sys/fs/cgroup
/dev/mmcblk0p1 vfat 500M 45M 455M 9% /boot
tmpfs tmpfs 93M 0 93M 0% /run/user/0
[root@centos-rpi3 ~]#

安装必备实用软件

[root@centos-rpi3 ~]# yum install -y vim wget screen

下载解压frp arm平台软件包

[root@centos-rpi3 ~]# wget https://soft.gt.gs/RaspberryPi/frp_0.12.0_linux_arm.tar.gz
[root@centos-rpi3 ~]# tar xvf frp_0.12.0_linux_arm.tar.gz

修改配置文件

[root@centos-rpi3 ~]# cd frp_0.12.0_linux_arm
[root@centos-rpi3 frp_0.12.0_linux_arm]# ls
LICENSE frpc frpc.ini frpc_full.ini frps frps.ini frps_full.ini
[root@centos-rpi3 frp_0.12.0_linux_arm]# cp frpc /usr/bin/
[root@centos-rpi3 frp_0.12.0_linux_arm]# mkdir /etc/frpc
[root@centos-rpi3 frp_0.12.0_linux_arm]# cp frpc.ini /etc/frpc/
[root@centos-rpi3 frp_0.12.0_linux_arm]# vim /etc/frpc/frpc.ini
填写server端IP地址,和远程ssh端口,其它需求的话按需配置

设置开机启动

[root@centos-rpi3 frp_0.12.0_linux_arm]# vim /etc/systemd/system/frpc.service

[Unit]
Description=frpc daemon

[Service]
Type=simple
ExecStart=/usr/bin/frpc -c /etc/frpc/frpc.ini
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

[root@centos-rpi3 frp_0.12.0_linux_arm]# systemctl start frpc
[root@centos-rpi3 frp_0.12.0_linux_arm]# systemctl enable frpc
Created symlink from /etc/systemd/system/multi-user.target.wants/frpc.service to /etc/systemd/system/frpc.service.


Flyfish's Blog - 飞鱼博客| 点滴记忆,记录成长---flyfish