首页
统计
壁纸
关于
Search
1
记录一下脚本命令
2,039 阅读
2
Scaleway Stardust(星尘)实例使用netboot.xyz重装系统
258 阅读
3
记录一下 Rclone 常用命令参数
243 阅读
4
简记一下Arch Linux安装部署
220 阅读
5
记录下LNMP环境下使用CDN后获取访客真实IP的方法
220 阅读
默认分类
登录
Search
标签搜索
Linux
Centos
Arch
Debian
Scaleway
Ubuntu
Manjaro
安卓
Docker
Hexo
Oneui
Oracle
三星
甲骨文
Tony
累计撰写
13
篇文章
累计收到
0
条评论
首页
栏目
默认分类
页面
统计
壁纸
关于
搜索到
3
篇与
的结果
2023-06-12
使用Cloudflare WARP给VPS添加IPv4/IPv6 双栈网络出口
安装wireguard等依赖Debianapt update -y && apt install wireguard sudo curl vim openresolv -yArch Linuxyay -S wireguard-tools openresolv wgcf vim dnsutils linux-headers --needed安装wgcfDebiancurl -fsSL git.io/wgcf.sh | sudo bash注册账户wgcf register生成配置文件wgcf generate编辑配置文件vim wgcf-profile.conf配置文件样式[Interface] PrivateKey = 这里会自动生成 Address = 172.16.0.2/32 Address = 这里会自动生成 DNS = 8.8.8.8,8.8.4.4,2001:4860:4860::8888,2001:4860:4860::8844 MTU = 1280 [Peer] PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo= AllowedIPs = 0.0.0.0/0 AllowedIPs = ::/0 Endpoint = engage.cloudflareclient.com:2408更改engage.cloudflareclient.com为IPV4/6地址(如双栈网络接入忽略)[root@archlinux ~]# nslookup engage.cloudflareclient.com Server: 1.1.1.1 Address: 1.1.1.1#53 Non-authoritative answer: Name: engage.cloudflareclient.com Address: 162.159.192.1 Name: engage.cloudflareclient.com Address: 2606:4700:d0::a29f:c001接入WARP IPV4删除配置文件中的AllowedIPs = ::/0接入WARP IPV6删除配置文件中的AllowedIPs = 0.0.0.0/0启动wireguard复制配置文件到wireguard文件夹cp wgcf-profile.conf /etc/wireguard/wgcf.conf启动 wireguardwg-quick up wgcf检查网络连通# IPv4 Only VPS curl -6 ip.p3terx.com # IPv6 Only VPS curl -4 ip.p3terx.com关闭wgcf接口wg-quick down wgcf将wireguard启用守护进程systemctl start wg-quick@wgcf systemctl enable wg-quick@wgcf参考P3terx企鹅大大
2023年06月12日
124 阅读
0 评论
0 点赞
2023-01-29
记录下LNMP环境下使用CDN后获取访客真实IP的方法
在lnmp安装目录/root/lnmp下找到lnmp.conf并编辑Nginx_Modules_OptionsNginx_Modules_Options='--with-http_realip_module'保存后执行./upgrade.sh nginx升级下Nginx。找到网站配置文件,即/usr/local/nginx/conf/vhost/xx.com.conf并编辑。在任意一个location里加入以下参数: set_real_ip_from 0.0.0.0/0; real_ip_header X-Forwarded-For;题外proxy_pass代理配置 location / { proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_cache_bypass $http_upgrade; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; }关闭防跨站sed -i 's/^fastcgi_param PHP_ADMIN_VALUE/#fastcgi_param PHP_ADMIN_VALUE/g' /usr/local/nginx/conf/fastcgi.conf启用被禁用的函数sed -i 's/,system//g' /usr/local/php/etc/php.ini sed -i 's/,proc_open//g' /usr/local/php/etc/php.ini sed -i 's/,proc_get_status//g' /usr/local/php/etc/php.ini
2023年01月29日
220 阅读
0 评论
0 点赞
2022-02-07
记录一下脚本命令
一键开启BBR(适用于较新的Debian、Ubuntu)echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf sysctl -p sysctl net.ipv4.tcp_available_congestion_control lsmod | grep bbr安装BBR-OpenVZ版本wget https://github.com/tcp-nanqinlang/lkl-rinetd/releases/download/1.1.0-nocheckvirt/tcp_nanqinlang-rinetd-debianorubuntu-nocheckvirt-multiNIC.sh bash tcp_nanqinlang-rinetd-debianorubuntu-nocheckvirt-multiNIC.shLinux一键更换内核wget -N --no-check-certificate "https://git.io/kernel.sh" chmod +x kernel.sh ./kernel.shLinux一键安装常见/最新内核脚本 锐速/BBRPLUS/BBR2wget -O tcp.sh "https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh 安装QBittorrent 4.3.9wget https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.9_v1.2.15/x86_64-qbittorrent-nox chmod +x x86_64-qbittorrent-nox ./x86_64-qbittorrent-nox ARM64wget https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.9_v1.2.15/aarch64-qbittorrent-nox chmod +x aarch64-qbittorrent-nox ./aarch64-qbittorrent-noxnano /etc/systemd/system/qbittorrent.service[Unit] Description=qBittorrent Daemon Service After=network.target [Service] LimitNOFILE=512000 User=root ExecStart=/root/x86_64-qbittorrent-nox [Install] WantedBy=multi-user.targetsystemctl daemon-reload systemctl start qbittorrent systemctl status qbittorrent重启关闭程序ps -aux | grep qbittorrentkill -9 xxxxx开启 vnstat 支持vnstat 是Linux下一个流量统计工具,开启 vnstat 后,server 完全依赖客户机的 vnstat 数据来显示月流量和总流量,优点是重启不丢流量数据。# 在client端安装 vnstat ## Centos yum install epel-release -y yum install -y vnstat ## Ubuntu/Debian apt install -y vnstat # 修改 /etc/vnstat.conf # BandwidthDetection 0 # MaxBandwidth 0 # 默认不是 eth0 网口的需要置空 Interface 来自动选择网口 # 没报错一般不需要改 # Interface "" systemctl restart vnstat # 确保 version >= 2.6 vnstat --version # 测试查看月流量 (刚安装可能需等一小段时间来采集数据) vnstat -m vnstat --json m安装Rcloneapt-get install -y fuse3安装命令curl https://rclone.org/install.sh | bash安装完成后使用rclone config命令进入配置安装Dockercurl -sSL https://get.docker.com/ | sh systemctl start docker systemctl enable docker安装Docker-Composecurl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose && docker-compose --version卸载Dockerapt-get remove docker docker-engine docker-ce docker-ce-cli containerd.io rm -fr /var/lib/docker/限制日志大小nano /etc/docker/daemon.json{ "log-driver":"json-file", "log-opts":{ "max-size" :"50m", "max-file":"1" } }删除未使用的资源docker system prune --alldocker设置容器开机自启动启动时加入--restart always如果已经启动的项目.则使用update更新docker update --restart=always 容器名或iddocker关闭容器开机自启动docker update --restart=no 容器名或id网络桥接--network=host获取镜像docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签]列出镜像docker image ls获取镜像体积docker system df删除本地镜像docker image rm [选项] <镜像1> [<镜像2> ...]进入容器docker exec -it 69d1 bashDocker容器固定IP地址每次主机重启时,如果容器没有固定 IP ,容器的 IP 将由启动顺序决定。这将导致类似无法远程访问数据库等等情况时,发送错误的请求,从而使得服务提供失败。首先创建自定义网络默认的docker0网络是不支持容器固定 IP 到该网段的,必须先创建一个自定义网络,才能固定容器 IP 到这个自定义网络中。docker network create --subnet=172.20.0.0/24 test格式docker network create --subnet=[自定义网络广播地址]/[子网掩码位数] [自定义网络名]查看更多参数docker network create --hlelp固定容器 IPdocker run -it --name network-test --net test --ip 172.20.0.2 ubuntu:latest /bin/bash格式docker run -it --name [容器名] --net [网络名] --ip [选定网络下固定 IP 地址] ubuntu:latest /bin/bashDocker安装QBittorrentdocker run -d \ --name=qBittorrent \ -e WEBUI_PORT=8080 \ -p 9821:6881 \ -p 9821:6881/udp \ -p 8080:8080 \ -v /date/downloads:/downloads \ -v /date/appdata/config:/config \ --restart unless-stopped \ linuxserver/qbittorrent:14.3.9Docker安装Transmissiondocker run --restart=always --name transmission -d \ -e TRANSMISSION_WEB_HOME=/transmission-web-control/ \ -e USER=moerats \ -e PASS=moerats \ -p 9091:9091 \ -p 51413:51413 \ -p 51413:51413/udp \ -v ~/transmission/config:/config \ -v ~/transmission/downloads:/downloads \ -v ~/transmission/watch:/watch \ linuxserver/transmission:version-3.00-r8Transmission跳过检验(跳检)sed -i 's/pausedi1e8/pausedi0e8/g' *.resume sed -i 's/blocks4:none12:/blocks3:all4:have3:all12:/g' *.resumeDocker安装Bitwarden(Vaultwarden)docker run --restart always -d --name vaultwarden \ -e ADMIN_TOKEN=xxxxxxxx \ -v /vw-data/:/data/ \ -p 88:80 \ -p 89:3012 \ vaultwarden/server:latest-e ADMIN_TOKEN=xxx \此行是启用管理面板,配置时可加入密码使用openssl rand -base64 48命令随机生成Nginx反向代理配置 location / { proxy_pass http://127.0.0.1:88; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } location /notifications/hub { proxy_pass http://127.0.0.1:89; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location /notifications/hub/negotiate { proxy_pass http://127.0.0.1:88; }Docker安装mynodequery创建文本/home/mynodequery/appsettings.json加入内容{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "MySql": { "ConnectionString": "" }, "AllowedHosts": "*", "Installed": "false", "ReadNodeIpHeaderKey": "X-Real-IP" }启动容器docker run -d --name=mynodequery -p 5000:5000 -v /home/mynodequery/appsettings.json:/app/appsettings.json jaydenlee2019/mynodequery:latestDocker启用IPV6编辑 /etc/docker/daemon.json 加上以下内容。{ "ipv6": true, "fixed-cidr-v6": "fd00::/80", "experimental": true, "ip6tables": true }重启Docker Enginesystemctl restart docker测试docker run --rm -it busybox ping -6 -c4 ipv6-test.com docker run --rm -it busybox ifconfigemby开心版docker run -d -e PUID=0 -e PGID=0 -v /home/gd:/data -v /home/emby:/config -p 8096:8096 -p 8920:8920 --name=emby --restart=always xinjiawei1/emby_unlockd:4.7.13 Aria2一键脚本为了确保能正常使用,请先安装基础组件wget curl ca-certificateswget -N git.io/aria2.sh && chmod +x aria2.sh综合工具箱 集成了很多脚本wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh测速脚本wget -qO- bench.sh | bashwget -qO- git.io/superbench.sh | bashbash <(curl -Lso- https://git.io/superspeed_uxh)bash <(curl -Lso- https://git.io/J1SEh)bash <(curl -Lso- https://bench.im/hyperspeed)bash <(wget -qO- https://down.vpsaff.net/linux/speedtest/superbench.sh) --no-geekbenchcurl -sL network-speed.xyz | bash纯IPV6curl -sL https://raw.githubusercontent.com/teddysun/across/master/bench.sh | bashSpeedtest CLICentoscurl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh | bash yum install speedtestUbuntu/Debianapt-get install curl curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash apt-get install speedtest回程测试wget -qO- git.io/besttrace | bashwget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.shbash <(curl -Ls https://raw.githubusercontent.com/sjlleo/nexttrace/main/nt_install.sh)wget -O jcnf.sh https://raw.githubusercontent.com/Netflixxp/jcnfbesttrace/main/jcnf.sh bash jcnf.shcurl https://raw.githubusercontent.com/zhucaidan/mtr_trace/main/mtr_trace.sh|bashYABS跑分curl -sL yabs.sh | bashGB5curl -sL yabs.sh | bash -s -- -fi5GB6curl -sL yabs.sh | bash -s -- -fi测试硬盘性能dd bs=64k count=4k if=/dev/zero of=test oflag=dsync测试IP质量bash <(wget -qO- --no-check-certificate https://gitlab.com/spiritysdx/za/-/raw/main/qzcheck.sh)流媒体解锁检测wget -O nf https://github.com/sjlleo/netflix-verify/releases/download/v3.1.0/nf_linux_amd64 && chmod +x nf && ./nf通过代理执行./nf -proxy socks5://127.0.0.1:30000bash <(curl -L -s check.unlock.media)端口转发iptables端口转发wget --no-check-certificate -qO natcfg.sh https://raw.githubusercontent.com/arloor/iptablesUtils/master/natcfg.sh && bash natcfg.shGost一键脚本wget --no-check-certificate -O gost.sh https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh && chmod +x gost.sh && ./gost.shReaim一键脚本wget -N --no-check-certificate https://git.io/realm.sh && chmod +x realm.sh && ./realm.shTermux高级终端一键安装Linux脚本. <(curl -L git.io/linux.sh)一键网络重装 DD脚本wget --no-check-certificate -O AutoReinstall.sh https://git.io/AutoReinstall.sh && bash AutoReinstall.shwget --no-check-certificate -O NewReinstall.sh https://git.io/newbetags && chmod a+x NewReinstall.sh && bash NewReinstall.sh新版DD脚本 支持保留IPV6配置wget --no-check-certificate -qO InstallNET.sh 'https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh bash InstallNET.sh -debian 11 -pwd password萌咖DD脚本bash <(wget --no-check-certificate -qO- 'https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh') -d 11 -v 64 -p "自定义root密码" -port "自定义ssh端口"默认root密码MoeClub.org星尘IPV6 DDbash <(wget --no-check-certificate -qO- 'https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh') -a -d 11 -v 64 -p "password" --ip-addr 2001:bcc:ccc:111::1/64 --ip-gate 2001:bcc:ccc:111:: --ip-mask 255.255.255.254 --ip-dns 2001:67c:2b0::4一键输出IP地址网关掩码MAINIP=$(ip route get 1 | awk -F 'src ' '{print $2}' | awk '{print $1}') GATEWAYIP=$(ip route | grep default | awk '{print $3}' | head -1) SUBNET=$(ip -o -f inet addr show | awk '/scope global/{sub(/[^.]+\//,"0/",$4);print $4}' | head -1 | awk -F '/' '{print $2}') value=$(( 0xffffffff ^ ((1 << (32 - $SUBNET)) - 1) )) NETMASK="$(( (value >> 24) & 0xff )).$(( (value >> 16) & 0xff )).$(( (value >> 8) & 0xff )).$(( value & 0xff ))" echo "--ip-addr $MAINIP --ip-gate $GATEWAYIP --ip-mask $NETMASK"一键修改默认SSH端口sed -i 's/#Port\ 22/Port\ 2222/' /etc/ssh/sshd_config && systemctl reload sshSSH禁用密钥使用密码登录#!/bin/bash sed -i 's/^.*PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config sed -i 's/^.*PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config echo root:yourRootPasswd | chpasswd service ssh restartSSH使用密钥登录并禁止密码登录创建公私钥ssh-keygen -t rsased -i "s/^.*PasswordAuthentication.*/PasswordAuthentication no/g" /etc/ssh/sshd_config sed -i "s/^.*RSAAuthentication.*/RSAAuthentication yes/g" /etc/ssh/sshd_config sed -i "s/^.*PubkeyAuthentication.*/PubkeyAuthentication yes/g" /etc/ssh/sshd_config sed -i "s/^.*AuthorizedKeysFile.*/AuthorizedKeysFile .ssh\/authorized_keys/g" /etc/ssh/sshd_config service ssh restart保持SSH服务连接不断开修改~/.ssh/configServerAliveInterval 10 ServerAliveCountMax 5设置IPV4优先或者IPV6优先/etc/gai.conf中取消这一行配置的注释是IPV4优先,否则是IPV6优先(默认)precedence ::ffff:0:0\/96 100/precedence ::ffff:0:0\/96 100一键清理 /var/log/目录下的过期日志find /var/log/ -name "*.1" -exec rm -rf {} \; && find /var/log/ -name "*.log.1" -exec rm -rf {} \; && find /var/log/ -name "*.gz" -exec rm -rf {} \;列出已安装的包,按大小排序dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n'|grep -v deinstall|sort -n|awk '{print $1" "$2}'一键开启Swap脚本wget --no-check-certificate https://dl.233.mba/d/sh/swap.sh && bash swap.sh设置时区/时间方法一:timedatectl set-timezone Asia/Shanghai date -s "2022-12-11 16:34:50"修改时间为24小时编辑/etc/default/locale添加一行LC_TIME=en_DK.UTF-8方法二:tzselect选择亚洲 Asia,确认之后选择中国(China),最后选择北京(Beijing),选择1复制文件到/etc目录下cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime方法三:apt install -y ntpdate timedatectl set-timezone Asia/Shanghai timedatectl set-ntp yes ntpdate time.windows.com同步硬件时间hwclock --systohc查看端口占用情况netstat -tunlp | grep 端口号查看当前所有tcp端口netstat -ntlp查看当前所有udp端口netstat -nulp-t (tcp) 仅显示tcp相关选项-u (udp)仅显示udp相关选项-n 拒绝显示别名,能显示数字的全部转化为数字-l 仅列出在Listen(监听)的服务状态-p 显示建立相关链接的程序名Debian/Ubuntu无netstat命令解决方案net-tools包含arp, ifconfig, netstat, rarp, nameif and route命令apt-get install net-toolsapt-get install iputils-ping调整系统分区检查分区信息e2fsck -f /dev/sdb1 调整分区大小resize2fs /dev/sdb1WARP功能最多最强大的WARP脚本wget -N https://gitlab.com/fscarmen/warp/-/raw/main/warp-go.sh && bash warp-go.shwget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh解决 screen 中文乱码找到screenrc文件首先输入whereis screenrc查看文件的路径编辑文件,加入以下内容defutf8 on defencoding utf8 encoding UTF-8 UTF-8更改主机名hostnamectl set-hostname xxx查看是否生效hostnamectl剑皇脚本wget https://github.com/maintell/webBenchmark/releases/download/0.6/webBenchmark_linux_x64 chmod +x webBenchmark_linux_x64 ./webBenchmark_linux_x64 -c 32 -s https://target.urlvps2archwget http://tinyurl.com/vps2arch chmod +x vps2arch ./vps2archwget https://felixc.at/vps2arch chmod +x vps2arch ./vps2archLinux下解压命令、压缩命令.tar 解包tar xvf FileName.tar打包tar cvf FileName.tar DirName.gz解压gunzip FileName.gzgzip -d FileName.gz压缩gzip FileNametar.gz 和 .tgz压缩tar zcvf FileName.tar.gz ./storetar zcvf FileName.tar.gz DirName解压tar zvxf name.tar.gz tar zvxf name.tar.gz -C 输出目录-c 压缩-x 解压-z 支持gzip解压文件-v 显示操作过程-f 使用档名.zip解压unzip FileName.zip压缩zip FileName.zip DirName文件解压到指定的目录下,需要用到-d参数。unzip -d /DirName FileName.zip解压的时候,有时候不想覆盖已经存在的文件,那么可以加上-n参数unzip -n -d /DirName FileName.zip只看一下zip压缩包中包含哪些文件,不进行解压缩unzip -l FileName.zip查看显示的文件列表还包含压缩比率unzip -v FileName.zip检查zip文件是否损坏unzip -t FileName.zip.rar解压rar x FileName.rar压缩rar a FileName.rar DirName
2022年02月07日
2,039 阅读
0 评论
0 点赞