CentOS 一键搭建V2ray服务记录
VPS一键搭建V2ray服务记录
一. 首先一键安装
bash <(curl -s -L https://git.io/v2ray.sh)
如果提示 curl: command not found
,那是因为你的 VPS 没装 Curl
。
- Ubuntu/Debian 系统安装 Curl 方法:
apt-get update -y && apt-get install curl -y
- Centos 系统安装 Curl 方法:
yum update -y && yum install curl -y
安装好 curl 之后就能安装脚本了
二、关闭防火墙
-
Centos6关闭防火墙方法
CentOS6关闭防火墙使用以下命令: //临时关闭 service iptables stop //禁止开机启动 chkconfig iptables off
-
centos7关闭防火墙方法
CentOS7中若使用同样的命令会报错,
stop iptables.service Failed to stop iptables.service: Unit iptables.service not > loaded.
这是因为CentOS7版本后防火墙默认使用firewalld,因此在CentOS7中关闭防火墙使用以下命令:
//临时关闭
systemctl stop firewalld
//禁止开机启动
systemctl disable firewalld
Removed symlink /etc/systemd/system/multi- user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus- org.fedoraproject.FirewallD1.service.
当然,如果安装了iptables-service,也可以使用下面的命令,
yum install -y iptables-services
//关闭防火墙
service iptables stop
Redirecting to /bin/systemctl stop iptables.service
//检查防火墙状态
service iptables status
Redirecting to /bin/systemctl status iptables.service
三、定时重启服务
1. 编辑配置
vi /etc/crontab
2.设置重启时间
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
20 04 * * * root reboot #04:20 每天凌晨4点20分重启系统
*/10 * * * * root reboot #10分钟重启一次
* */4 * * * root reboot #隔4个小时重启一次
3.装载
crontab /etc/crontab
4.重启定时服务
systemctl enable crond.service #开启启动
systemctl restart crond.service #重启服务
5.查看定时配置
crontab -l
查看系统重启情况(常用方法):
last reboot
who -b
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
i·Space !
喜欢就支持一下吧
打赏
微信
支付宝