V2RY

BT面板:
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh ed8484bec
安装SSL强制HTTPS
网站配置加入:
location /2012 {
proxy_redirect off;
proxy_pass http://127.0.0.1:2012;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
# Show real IP in v2ray access.log
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

开始安装:
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
然后解决报错
systemctl start v2ray
systemctl enable v2ray
sed -i "s/v2ray -config/v2ray run -config/g" /etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf
systemctl daemon-reload
systemctl restart v2ray
systemctl status v2ray

编辑配置:
vi /usr/local/etc/v2ray/config.json

{
"log": {
"loglevel": "info",
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log"
},
"inbounds": [
{
"port": 2012,
"listen":"127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "a32c5638-0be9-42b7-8ce6-09ae6c32dd49",
"alterId": 32
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/2012"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

安装BBR
原文地址:
https://www.vultr.com/zh/docs/how-to-deploy-google-bbr-on-centos-7/
代码:
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
sudo yum --enablerepo=elrepo-kernel install kernel-ml -y
rpm -qa | grep kernel
如果成果能看到5.19版本核心
查看排序:sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'

# 若出现 “grep: /etc/grub2.cfg: No such file or directory” 的错误, # 运行以下命令解决:

grub2-mkconfig -o /boot/grub2/grub.cfg # 再次运行刚才的命令

如果排第一 设置5.19启动顺序是0还是1,重启:
sudo grub2-set-default 0
sudo shutdown -r now
重启后查看是否成功
uname -r
配置BBR
echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
确认是否成功
lsmod | grep bbr

防火墙
firewall-cmd --zone=public --add-port=2012/tcp --permanent
firewall-cmd --reload

升级
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh)
移除
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --remove

vultr的debian9下安装windows

1、将VPS重装至Debian 9

2、安装依赖

apt-get update -y
apt-get install -y gawk sed grep
3、执行安装脚本

Windows 2008

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://odrive.aptx.xin/System/newS2008R2DATA.vhd.gz'
Windows 2012

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://odrive.aptx.xin/System/S2012R2DATA2018410.vhd.gz'
Windows 2016

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://odrive.aptx.xin/System/S2016DATA2018415.vhd.gz'
这里提供的DD包需要VNC设置密码,如需已设置好密码的DD包自行百度

DD包来源:http://arv.asuhu.com/dd/

Windows Server 2016离线安装.NET Framework 3.5

windows server 2016默认是不安装.netframework3.5的,可以在添加删除程序中单独添加。但是有时候系统安装文件不在的时候,找不到安装程序就不能安装成功。

这时候单独下载dotnetfx35直接安装是安装不上的,需要用一下方法进行单独安装:

通过 NetFx3.cab 文件安装

NetFx3.cab下载链接:https://pan.baidu.com/s/1O24nLgXhehHveae25p9SLg 密码:amgu

安装方法:下载NetFx3.cab后将其放于C盘WINDOWS文件夹下(C:\Windows)

点击“开始”找到“Windows PowerShell”右击“以管理员身份运行”,输入如下命令:

dism.exe /online /add-package /packagepath:C:\WINDOWS\netfx3.caB

server2016完美添加virtio驱动

server2016
1,查看:
dism /get-wiminfo /wimfile:C:\install.wim
dism /get-wiminfo /wimfile:C:/boot.wim
2,
挂载install.wim映像第2个索引标准版带GUI,添加驱动
dism /mount-wim /wimfile:C:\install.wim /index:2 /mountdir:C:\mnt
安装进度条约2分钟
dism /image:C:\mnt /add-driver /driver:C:\virtio\NetKVM\2k16\amd64\netkvm.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioscsi\2k16\amd64\vioscsi.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\viostor\2k16\amd64\viostor.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\viorng\2k16\amd64\viorng.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioserial\2k16\amd64\vioser.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\Balloon\2k16\amd64\balloon.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qxldod\2k16\amd64\qxldod.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\pvpanic\2k16\amd64\pvpanic.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qemupciserial\2k16\amd64\qemupciserial.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qemufwcfg\2k16\amd64\qemufwcfg.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioinput\2k16\amd64\vioinput.inf /forceunsigned
获取已经添加好的驱动
dism /image:C:\mnt /get-drivers
成功后卸载并保存
dism /unmount-wim /mountdir:C:\mnt /commit
进度条约2分钟
查看boot.wim
dism /get-wiminfo /wimfile:C:/boot.wim
挂载1
dism /mount-wim /wimfile:c:\boot.wim /index:1 /mountdir:C:\mnt
dism /image:C:\mnt /add-driver /driver:C:\virtio\NetKVM\2k16\amd64\netkvm.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioscsi\2k16\amd64\vioscsi.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\viostor\2k16\amd64\viostor.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\viorng\2k16\amd64\viorng.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioserial\2k16\amd64\vioser.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\Balloon\2k16\amd64\balloon.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qxldod\2k16\amd64\qxldod.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\pvpanic\2k16\amd64\pvpanic.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qemupciserial\2k16\amd64\qemupciserial.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qemufwcfg\2k16\amd64\qemufwcfg.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioinput\2k16\amd64\vioinput.inf /forceunsigned
卸载和保存1
dism /image:C:\mnt /get-drivers
dism /unmount-wim /mountdir:C:\mnt /commit
挂载1
dism /mount-wim /wimfile::\boot.wim /index:2 /mountdir:C:\mnt
dism /image:C:\mnt /add-driver /driver:C:\virtio\NetKVM\2k16\amd64\netkvm.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioscsi\2k16\amd64\vioscsi.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\viostor\2k16\amd64\viostor.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\viorng\2k16\amd64\viorng.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioserial\2k16\amd64\vioser.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\Balloon\2k16\amd64\balloon.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qxldod\2k16\amd64\qxldod.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\pvpanic\2k16\amd64\pvpanic.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qemupciserial\2k16\amd64\qemupciserial.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\qemufwcfg\2k16\amd64\qemufwcfg.inf /forceunsigned
dism /image:C:\mnt /add-driver /driver:C:\virtio\vioinput\2k16\amd64\vioinput.inf /forceunsigned
卸载和保存2
dism /image:C:\mnt /get-drivers #获取添加的驱动信息
dism /unmount-wim /mountdir:C:\mnt /commit #卸载

封装新的 ISO 镜像
  1. 使用 UltraISO 打开原 Windows ISO 安装盘镜像。
   注意,这里可就不能使用压缩软件了,否则会丢失 ISO 的引导数据。
  2. 在 sources 文件夹下,删除boot.wim与install.wim。
  3. 将添加好驱动的boot.wim与install.wim拖到 sources 下。
  4. 点击【文件】→【另存为】,保存出一个新 ISO 镜像即可。

服务器自动挂载第二块硬盘

Centos系统请使用以下命令:

  1. yum install wget -y && wget -O auto_disk.sh http://download.bt.cn/tools/auto_disk.sh && bash auto_disk.sh

复制代码

Ubuntu系统请使用以下命令:

  1. wget -O auto_disk.sh http://download.bt.cn/tools/auto_disk.sh && sudo bash auto_disk.sh

复制代码

Debian系统请使用以下命令:

  1. wget -O auto_disk.sh http://download.bt.cn/tools/auto_disk.sh && bash auto_disk.sh

复制代码

19版centos8安装nvdia驱动时的报错的解决办法

错误日志里面提示安装

please install libelf-dev, libelf-devel or elfutils-libelf-devel

这个提示有错误!!请执行下面的命令!!!

yum install elfutils-libelf-devel

再次安装显卡驱动,完美解决

mysql语句字段自增

UPDATE `bbs_thread` SET last_date = last_date + 50000000

用shell命令操作数据库

有时候, 要批量执行sql语句, 怎么搞起呢? 在不会shell之前, 我这么搞: 先写一大堆命令, 一起复制到mysq中l执行, 呵呵哒, 虽能笑掉大牙, 但偶尔会有用。 很低级。下面, 我们一起来看看比较好的姿势。

姿势一: shell脚本中写sql语句, 这是我们最容易想到的

来看看, db.sh文件内容如下:

#! /bin/bash
host="xxx"
port="xxx"
userName="xxx"
password="xxx"
dbname="xxx"
dbset="--default-character-set=utf8 -A"

cmd="show tables"

mysql -h${host} -u${userName} -p${password} ${dbname} -P${port} -e "${cmd}"
执行./db.sh, 获取到了正确的结果。 注意: cmd中可以包含多条命令

#! /bin/bash
host="xxx"
port="xxx"
userName="xxx"
password="xxx"
dbname="xxx"
dbset="--default-character-set=utf8 -A"

cmd="show tables;
show table;
show table;"

mysql -h${host} -u${userName} -p${password} ${dbname} -P${port} -e "${cmd}"

当然, 你也可以这么搞:

#! /bin/bash
host="xxx"
port="xxx"
userName="xxx"
password="xxx"
dbname="xxx"
dbset="--default-character-set=utf8 -A"

mysql -h${host} -u${userName} -p${password} ${dbname} -P${port} << EOF

show tables;
show tables;
show tables;

EOF
为了保险起见, 根据经验, 经常需要在上述sql语句后加上 exit;语句, 确保mysql退出。

姿势二: 写sql文件, 然后在shell中执行, test.sql文件内容为:

show tables;
执行:
mysql -hDbIP -uUserName -pPassword DbName -PDbPort --default-character-set=utf8 -A < "test.sql"
请注意替换该替换的, 如DbIP, UserName, Password, DbName, DbPort
试了一下, OK的, 结果符合预期。

上述执行语句也可以改为:

mysql -hDbIP -uUserName -pPassword DbName -PDbPort --default-character-set=utf8 -A -e "source test.sql"
亦可。

锐速换内核和安装

下载更换内核
CentOS6 内核更换为: 2.6.32-504.3.3.el6.x86_64

rpm -ivh http://soft.91yun.pw/ISO/Linux/CentOS/kernel/kernel-firmware-2.6.32-504.3.3.el6.noarch.rpm
rpm -ivh http://soft.91yun.pw/ISO/Linux/CentOS/kernel/kernel-2.6.32-504.3.3.el6.x86_64.rpm --force
CentOS7 内核更换为: 3.10.0-229.1.2.el7.x86_64
rpm -ivh http://soft.91yun.pw/ISO/Linux/CentOS/kernel/kernel-3.10.0-229.1.2.el7.x86_64.rpm --force
查看内核是否安装成功
rpm -qa | grep kernel
如果显示里面有这个内核就对了。

重启,查看内核是否更换成功
reboot
uname -r

锐速破解版安装方法:
1
wget -N --no-check-certificate https://github.com/91yun/serverspeeder/raw/master/serverspeeder.sh && bash serverspeeder.sh

锐速破解版卸载方法:
1
chattr -i /serverspeeder/etc/apx* && /serverspeeder/bin/serverSpeeder.sh uninstall -f