分类 linux 下的文章

Debian / Ubuntu安装v2rayA

v2rayA 的功能依赖于 V2Ray 内核,因此需要安装内核。

安装 V2Ray 内核

V2Ray 的官方脚本

V2Ray 安装参考:https://github.com/v2fly/fhs-install-v2ray

v2rayA 提供的镜像脚本(推荐)

curl -Ls https://mirrors.v2raya.org/go.sh | sudo bash

安装后可以关掉服务,因为 v2rayA 不依赖于该 systemd 服务。

sudo systemctl disable v2ray --now

安装 v2rayA

添加公钥

wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/v2raya.asc

添加 V2RayA 软件源

echo "deb https://apt.v2raya.org/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list
sudo apt update

安装 V2RayA

sudo apt install v2raya

开放端口

需要安装 iptables、iptables-persistent

iptables -I INPUT -p tcp --dport 2017 -j ACCEPT
iptables-save
netfilter-persistent save
netfilter-persistent reload

通过ip:2017访问例如: http://localhost:2017

启动 v2rayA / 设置 v2rayA 自动启动

从 1.5 版开始将不再默认为用户启动 v2rayA 及设置开机自动。

  • 启动 v2rayA

    sudo systemctl start v2raya.service
    
  • 设置开机自动启动

    sudo systemctl enable v2raya.service
    

重置密码

v2raya --reset-password

手动搭建一个vless+tcp+tls节点

需要的原料:1. 节点一枚

  1. 申请ssl证书

    wget -N https://gitlab.com/rwkgyg/acme-script/raw/main/acme.sh && bash acme.sh
    

    (一键脚本)

  2. 给证书权限

     # Xray 默认以 nobody 用户运行,证书权限适配
      chown -R nobody.$cert_group /{证书的文件夹}/*
    
  3. 安装xray

    bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
    
  4. 获取uuid

    xray uuid
    
  5. 修改/usr/local/etc/xray/里的config文件

    {
        "log": {
            "loglevel": "warning"
        },
        "routing": {
            "domainStrategy": "AsIs",
            "rules": [
                {
                    "type": "field",
                    "ip": [
                        "geoip:private"
                    ],
                    "outboundTag": "block"
                }
            ]
        },
        "inbounds": [
            {
                "listen": "0.0.0.0",
                "port": {{端口}},
                "protocol": "vless",
                "settings": {
                	"decryption":"none",
                    "clients": [
                        {
                            "id": "uuid"
    
                        }
                    ]
                },
                "streamSettings": {
                    "network": "tcp",
    
                    "security": "tls",
            "tlsSettings": {
              "alpn": "http/1.1",
              "certificates": [
                {
                  "certificateFile": "xxx/cert.crt",//证书地址,下同
                  "keyFile": "xxx/private.key"
                }
              ]
            }
                }
            }
        ],
        "outbounds": [
            {
                "protocol": "freedom",
                "tag": "direct"
            },
            {
                "protocol": "blackhole",
                "tag": "block"
            }
        ]
    }
    
  6. 在v2rayN客户端添加节点,选择添加vless服务器

    image-20230714032519984

    别名:随便填

    地址:填域名

    端口:填端口

    id:填uuid

    tls:选择tls

    没有提到的不动,点击确定。

debian安装docker

首先,安装一些必要的软件包:

apt update
apt upgrade -y
apt install curl vim wget gnupg dpkg apt-transport-https lsb-release ca-certificates

然后加入 Docker 的 GPG 公钥和 apt 源:

curl -sSL https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://download.docker.com/linux/debian $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list

国内机器可以用清华 TUNA的国内源:

curl -sS https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list

然后更新系统后即可安装 Docker CE:

apt update
apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

此时可以使用 docker version 命令检查是否安装成功:

root@debian ~ # docker version
Client: Docker Engine - Community
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:52:17 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:52:17 2023
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Ubuntu下crontab的安装和使用

一、安装

安装:apt-get install cron
启动:service cron start
重启:service cron restart
停止:service cron stop
检查状态:service cron status
查询cron可用的命令:service cron
检查Cronta工具是否安装:crontab -l
  • crontab命令:

1.编辑/创建命令

[root@localhost]# crontab -e

当系统不存在crontab文件时,输入此命令即为创建,已存在文件即为编辑。

2.查看当前所有定时任务

[root@localhost]# crontab -l

3.删除当前所有定时任务

[root@localhost]# crontab -r

编辑/var/spool/cron/crontabs目录下面的root文件

image-20230623212224718

直接在下面加上时间规则和所要执行文件的地址

例如:

* * * * * /usr/local/xxxx/xxx

当执行定时任务出现错误时,默认将信息存储到相应用户下面的文件中/var/log/mail/${user}

玩客云刷机

需要用到的东西:玩客云一台,一条双usb线,一个u盘

第一步刷底包

把usb线的一端插到离hdmi接口近的那一个usb接口,另一个连电脑

然后用镊子短接图示的两个接口

20210703164557143

或者是用手摁住复位键,如果不想拆机的话就用取卡针捅着复位接口

然后接上电源,就可以看到下面这张图

20210703164317149

然后刷入底包 ,即 update.img

之后就是要先将旧的系统(armbian5.88.img)刷到u盘上,刷完之后将u盘插到离网口近的那个usb口。

等他闪灯,不闪了之后,就可以把u盘拔下来。

之后废物利用再给u盘刷上WKY-Armbian_20.12_5.9.0同样的操作再来一遍就可以了

之后就是ssh连接

用户名 root 密码 1234

刷入emmc(闪存):

cd /boot/install     #进入/boot/install目录
sudo ./install.sh    #运行install.sh

其他:

★内网穿透ssh远程登陆 cd /opt/ #进入/opt目录 mkdir cpolar #创建cpolar空文件夹 进入官网复制下载链接(要ARM的) wget 【复制的链接】 #下载内网穿透工具 unzip 【下载的.zip压缩包】 #解压压缩包 (也可以删掉解压完成的压缩包用 rm -rf 【压缩包】) ./cpolar authtoken 【您的token】 #绑定您的token ./cpolar service install #下载cpolar服务 ./systemctl start cpolar #启动cpolar服务 ./systemctl enable cpolar #开机自启cpolar服务 ./systemctl status cpolar #查看cpolar服务状态 官网查看地址和端口即可ssh远程登陆

★挂载硬盘(临时) lsblk 或lsblk -f查看挂载情况 fdisk /dev/sda1(这里填你的硬盘目录) #给硬盘分区 mkfs -t ext4 /dev/sda1 #格式化硬盘选择ext4文件系统 mount /dev/sda1 【要挂载的目录】 #分区挂载到指定目录

★永久挂载 vim /etc/fstab #用vim打开文件 在最后填入 /dev/sda1(你的硬盘目录) /mydisk(要挂载的目录) ext4 defaulta 0 0 *这一步不要填错了要仔细

用到的文件

链接:https://pan.baidu.com/s/1Pp-Z0tyMus5vd8i03HXBAg?pwd=2fhx 提取码:2fhx

写在后面:

这个教程我之前就一直想出,但是一直没有写,今天看到备忘录上有就草草写一下,算是和玩客云告别了,感谢它曾经带给我一段美好的