分类 生活 下的文章

VPS

生成服务端公私钥
apt install wireguard
cd /etc/wireguard
wg genkey | tee privatekey | wg pubkey > publickey
编写配置文件
cd /etc/wireguard
vim wg0.conf

[Interface]
PrivateKey = 服务生成的私钥
Address = 10.100.0.1/24
PostUp = iptables -A FORWARD -i %i -j ACCEPT; 
PostUp = iptables -A FORWARD -o %i -j ACCEPT; 
PostUp = iptables -t nat -A POSTROUTING -o %i -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT;
PostDown = iptables -D FORWARD -o %i -j ACCEPT; 
PostDown = iptables -t nat -D POSTROUTING -o %i -j MASQUERADE
ListenPort = 51820

[Peer]
PublicKey = 客户端公钥
AllowedIPs = 10.100.0.2/32
PersistentKeepalive = 15
systemctl enable wg-quick@wg0.service
systemctl start wg-quick@wg0.service
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p

iptables转发端口

iptables -t nat -A PREROUTING -p tcp --dport 50022 -j DNAT --to-destination 10.100.0.2:22
iptables -t nat -A POSTROUTING -p tcp -d 10.100.0.2 --dport 22 -j SNAT --to-source 服务器自己公网IP
iptables-save > /etc/iptables/rules.v4

客户端

生成客户端公私钥
apt install wireguard
cd /etc/wireguard
wg genkey | tee privatekey | wg pubkey > publickey
编写配置文件
cd /etc/wireguard
vim wg0.conf
[Interface]
PrivateKey = 客户端生成的私钥
Address = 10.100.0.2/24

[Peer]
PublicKey = 服务端公钥
Endpoint = 服务器自己公网IP:51820
AllowedIPs = 10.100.0.0/24
PersistentKeepalive = 15
systemctl enable wg-quick@wg0.service
systemctl start wg-quick@wg0.service

1,安装内核模块支持

apt install linux-modules-extra-`uname -r`
modprobe binder_linux devices="binder,hwbinder,vndbinder" #进程通信模块
modprobe ashmem_linux #内存共享模块

echo "binder_linux" > /etc/modules-load.d/redroid.conf
echo "ashmem_linux" >> /etc/modules-load.d/redroid.conf
echo 'options binder_linux devices="binder,hwbinder,vndbinder"' >> /etc/modprobe.d/redroid.conf

2,安装docker

原始方法:
curl -fsSL https://get.docker.com | bash

替代方法:

export DOWNLOAD_URL=“https://mirrors.tuna.tsinghua.edu.cn/docker-ce”
复制https://get.docker.com/内容保存本地docker.sh
chmod +x ./docker.sh && ./docker.sh

3,拉取镜像

替代方法:

vi /etc/docker/daemon.json
{
    "registry-mirrors": ["https://docker.1panel.live", "https://hub.rat.dev/", "https://docker.chenby.cn", "https://docker.m.daocloud.io"]
}
systemctl stop docker
systemctl daemon-reload
systemctl start docker

4 安装redroid,scrcpy-web,nginx

git clone https://github.com/geziliu/android_docker
生成密码
1,openssl passwd -1 xxxx生成密码修改nginx/passwd_scrcpy_web
2,安装android-redroid容器参数可以加上-p 127.0.0.1:5555:5555  容器暴露容器给本地,这样就可以用ssh -L隧道本地scrcpy客户端去连接了。
3,scrcpy客户端启动时增加--audio-codec=raw有声音(必须安卓11或以上)
start.sh        #启动并创建容器,自动安装scrcpy-web/apk下的安装包(目前放了应用宝、豌豆荚、via浏览器,作为初始环境应该够用了,需要其它应用可以自己将apk放在这个目录里)
stop.sh         #关闭容器
restart.sh      #重启容器
stop_and_rm.sh  #关闭并删除容器

1,安装VA解码层

sudo pacman -S libva-nvidia-driver

2,配置系统默认解码器参数

NVD_BACKEND=direct
MOZ_DISABLE_RDD_SANDBOX=1
LIBVA_DRIVER_NAME=nvidia
_EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json

3,启动modeset支持

echo "options nvidia_drm modeset=1" >> /etc/modprobe.d/nv.conf
echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1" >> /etc/modprobe.d/nv.conf

再重启,检测是否开启

sudo cat /sys/module/nvidia_drm/parameters/modeset

结果为Y 上面第3步开启成功

(安装libva-utils使用vainfo可查看显卡支持哪些硬件解码格式)

4,配置firefox

about:config
media.ffmpeg.vaapi.enabled设置为true

about:support
查看<媒体>->硬件解码,有支持就已经成功了。

使用firefox播放支持硬件解码的格式视频,再使用nvidia-settings,查看GPU/Video Engnie Utilization应该有百分比说明解码成功。

wine安装IDA7.5后,安装了python3.8,一直启动提示如下:

from PyQt5 import QtCore, QtGui
ImportError: DLL load failed while importing sip: 找不到模块。

明明pip安装了pyqt5模块,试过3.8 3.9 3.10版本都相同

解决方法:

/home/key/.wine/drive_c/Program Files/Python3/Lib/site-packages/PyQt5/sip.cp310-win_amd64.pyd /opt/ida7.5/python/3/PyQt5/

安装

nvidia-open-dkms
(依赖会自动安装nvidia-utils, linux-headers 如果没有也要安装)

查询

glxinfo -B
nvidia-smi

X11/xorg

查看是否存在/etc/X11/xorg.conf
如果没有,使用nvidia-xconfig自动生成一份
记得里面需要xserver路径(没有手动修改):

Section "Files"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

wayland

查看是否加载nvidia_drm
没有的话方式有二:
1, 创建文件/etc/modprob.d/nv_wayland.conf
options nvidia_drm modeset=1
\#options nvidia NVreg_PreserveVideoMemoryAllocations=1

2, # /etc/default/grub
GRUB_CMDLINE_LINUX="nvidia-drm.modeset=1"

grub-mkconfig -o /boot/grub/grub.cfg

//?手动增加
mkinitcpio -p linux
(arch版本update-initramfs)

470-510版本还需要
ln -s /dev/null /etc/udev/rules.d/61-gdm.rules

判断是否设置成功:(必须为Y)
cat /sys/module/nvidia_drm/parameters/modeset