-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFrps_CentOS7.sh
50 lines (47 loc) · 1.57 KB
/
Frps_CentOS7.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Install Frps for CentOS7
# Check if user is root
[ $(id -u) != "0" ] && { echo -e "\033[31mError: You must be root to run this script\033[0m"; exit 1; }
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
clear
printf "
#######################################################################
# Install frps for CentOS #
# More information http://www.iewb.net #
#######################################################################
"
cd /root
wget https://github.com/fatedier/frp/releases/download/v0.48.0/frp_0.48.0_linux_amd64.tar.gz && tar -zxvf frp_0.48.0_linux_amd64.tar.gz
cd frp_0.48.0_linux_amd64
cat > /root/frp_0.48.0_linux_amd64/frps.ini <<EOF
#通用设置
[common]
# frp 监听地址
bind_port = 7000
#frp 控制面板
dashboard_port = 7500
# dashboard 用户名密码可选,默认都为 admin
dashboard_user = admin
dashboard_pwd = Luhaiyang
token= [email protected]
EOF
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
echo "1" > /proc/sys/net/ipv4/ip_forward
if ! grep "net.ipv4.ip_forward = 1" /etc/sysctl.conf >>/dev/null
then
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
fi
sysctl -p /etc/sysctl.conf
firewall-cmd --add-port=7000/tcp --permanent
firewall-cmd --add-port=7500/tcp --permanent
firewall-cmd --reload
touch /home/frp.sh
cat > /home/frp.sh <<EOF
#!/bin/bash
/root/frp_0.48.0_linux_amd64/frps -c /root/frp_0.48.0_linux_amd64/frps.ini &
EOF
chmod +x /home/frp.sh
#crontab
echo "@reboot sleep 10; /home/frp.sh" >>/var/spool/cron/root
#reboot