title=
KMS,是 Key Management System 的缩写,也就是密钥管理系统。这里所说的 KMS,毋庸置疑就是用来激活 VOL 版本的 Windows 和 Office 的 KMS 啦。经常能在网上看到有人提供的 KMS 服务器地址,那么你有没有想过自己也来搞一个这样的服务呢?而这样的服务在 Github 上已经有开源代码实现了。
本文就是在这个开源代码的基础上,开发了适用于三大 Linux 发行版的一键安装 KMS 服务的脚本。

本脚本适用环境

系统支持:CentOS 6+,Debian 7+,Ubuntu 12+
虚拟技术:任意
内存要求:≥128M
日期  :2018 年 10 月 25 日

关于本脚本

1、本脚本适用于三大 Linux 发行版,其他版本则不支持。
2、KMS 服务安装完成后会加入开机自启动。
3、默认记录日志,其日志位于 /var/log/vlmcsd.log。

使用方法

使用root用户登录,运行以下命令:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/kms.sh && chmod +x kms.sh && ./kms.sh

安装完成后,输入以下命令查看端口号 1688 的监听情况

netstat -nxtlp | grep 1688

返回值类似于如下这样就表示 OK 了:

tcp        0      0 0.0.0.0:1688                0.0.0.0:*                   LISTEN      3200/vlmcsd         
tcp        0      0 :::1688                     :::*                        LISTEN      3200/vlmcsd 

本脚本安装完成后,会将 KMS 服务加入开机自启动。

使用命令:
启动:/etc/init.d/kms start
停止:/etc/init.d/kms stop
重启:/etc/init.d/kms restart
状态:/etc/init.d/kms status

卸载方法:

使用 root 用户登录,运行以下命令:

./kms.sh uninstall

如何使用 KMS 服务
KMS 服务,用于在线激活 VOL 版本的 Windows 和 Office。
激活的前提是你的系统是批量授权版本,即 VL 版,一般企业版都是 VL 版。而 VL 版本的镜像一般内置 GVLK key,用于 KMS 激活。
下面列表里面含有的产品的 VL 版本或者能使用 key 进入 KMS 通道的产品,都支持使用 KMS 激活。

Office 2019 & Office 2016:https://docs.microsoft.com/en-us/DeployOffice/vlactivation/gvlks
Office 2013:https://technet.microsoft.com/zh-cn/library/dn385360.aspx
Office 2010:https://technet.microsoft.com/zh-cn/library/ee624355(v=office.14).aspx
Windows:https://docs.microsoft.com/zh-cn/windows-server/get-started/kmsclientkeys

使用管理员权限运行 cmd 查看系统版本,命令如下:

wmic os get caption

使用管理员权限运行 cmd 安装从上面列表得到的 key,命令如下:

slmgr /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

使用管理员权限运行 cmd 将 KMS 服务器地址设置为你自己的 IP 或 域名,后面最好再加上端口号(:1688),命令如下:

slmgr /skms Your IP or Domain:1688

注意:本脚本所做的工作就是此步骤。当你的 KMS 服务出于启动状态,那么此处就可以设置为你自己的 KMS 服务器地址。
使用管理员权限运行 cmd 手动激活系统,命令如下:

slmgr /ato

关于 Office 的激活,要求必须是 VOL 版本,否则无法激活。
找到你的 Office 安装目录,32 位默认一般为 C:\Program Files (x86)\Microsoft Office\Office16
64 位默认一般为 C:\Program Files\Microsoft Office\Office16
Office16 是 Office 2016,Office15 就是 Office 2013,Office14 就是 Office 2010。
打开以上所说的目录,应该有个 OSPP.VBS 文件。
使用管理员权限运行 cmd 进入 Office 目录,命令如下:

cd "C:\Program Files (x86)\Microsoft Office\Office16"

使用管理员权限运行 cmd 注册 KMS 服务器地址:

cscript ospp.vbs /sethst:Your IP or Domain

使用管理员权限运行 cmd 手动激活 Office,命令如下:

cscript ospp.vbs /act

注意: KMS 方式激活,其有效期只有 180 天。
每隔一段时间系统会自动向 KMS 服务器请求续期,请确保你自己的 KMS 服务正常运行。

常见错误的对策
如果遇到在执行过程报错,请按以下步骤检查:
1,你的 KMS 服务器是否挂了?
2,你的 KMS 服务是否正常开启?
3,你的系统或 Office 是否为批量 VL 版本?
4,你的系统或 Office 是否修改过 Key 或未安装 GVLK Key?
5,你是否以管理员权限运行 cmd?
6,你的网络连接是否正常?
7,你的本地 DNS 解析是否正常?
8,如果你排除了以上的对策,那请根据错误提示代码自行搜索原因。

更新日志

2018 年 10 月 25 日:修正 vlmcsd 的 git 链接,即每次全新安装皆为官方的最新版本。注意:如果你想升级版本,则需要先停止 kms 服务,再删除 /usr/bin/vlmcsd 文件,然后重新下载最新脚本安装即可。

参考链接
https://03k.org/kms.html

本文转自:https://teddysun.com/530.html,版权归原作者所有。

说明:对于图床程序的话,博主之前介绍过好几种,查看:Chevereto、ImgURL。貌似最火的还是国外的Chevereto,这里再分享个图床程序AUXPI,和ImgURL比较类似,都支持API上传,SMMS图床上传。不过该图床还处于发育初期阶段,貌似以后会越来越强,可以期待下。

截图

 title=

 title=

 title=

 title=

更新

【2019.3.29】
该程序变动较大,支持更多图床,新增后台,用户注册等功能,安装环境多了个Mysql,更新安装方法

功能

支持web上传图片    
支持API上传图片    
支持图床:
搜狗
新浪(私有+公共)
SMMS
奇虎(360)
百度
阿里
京东
Upload.cc
Flickr
网易
掘金
本地

安装

Github地址:https://github.com/aimerforreimu/AUXPI

所需环境:Mysql、Nginx/Caddy(非必需,但如果你要使用域名访问就需要安装了)。

1、安装Web环境
#CentOS系统
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
#Ubuntu系统
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
#Debian系统
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh

安装完成后,进入面板,点击左侧软件管理,然后安装Mysql、Nginx(如果你使用域名的话,就需要安装)。

然后点击左侧数据库-添加数据库,设置好数据库信息。

2、安装AUXPI

首先进入到Release→传送门,下载最新版的Linux系统AUXPI文件,目前为V2.0.1。

#新建文件夹用来存放auxpi文件
mkdir auxpi && cd auxpi
wget https://github.com/aimerforreimu/auxpi/releases/download/2.0.1/auxpi-2.0.1-linux.tar.gz
#解压并移动文件
tar zxvf auxpi*.tar.gz && rm -rf auxpi*.tar.gz
mv build/linux/* ./
rm -rf build
#初始化
chmod -u+x auxpi
./auxpi init
#编辑配置文件
nano auxpi/app.conf

大致参数如下:

#一般只建议修改下面2个参数,程序默认运行端口和运行模式,端口可以默认2333,运行模式必须修改为pro
httpport = 2333
runmode = pro

再编辑站点配置文件:

nano conf/siteConfig.json

大致如下:

{
  "site_name": "AuXpI API 图床",  #站点名称    
  "site_footer": "",  #footer输出的内容
  "site_url": "http://yoursite.com/",  #站点url
  "logo":"/static/app/images/logo.jpg",  #站点logo
  "site_upload_max_number": 10,  #一次性最多可以上传多少张图片
  "site_up_load_max_size": 5,  #最大允许上传的图片大小,单位MB
  "allow_tourists":false,  #访客上传,false为关闭,ture为开启
  "allow_register":false,  #用户注册,false为关闭,ture为开启
  "db_option": {
      "use_db": true,     
      "db_type": "mysql",       
      "db_host": "127.0.0.1:3306",  #数据库地址,正常不需要修改
      "db_name": "auxpi",  #数据库名称
      "db_user": "root",  #数据库用户名
      "db_pass": "moerats",  #数据库密码
      "table_prefix": "auxpi_"  #数据表前缀,可不修改
    },

其实这里你只需要配置好数据库信息就行了,其他设置都可以在后台面板设置。

然后开始创建数据表:

./auxpi migrate

创建管理员账户:

#以下命令会给你创建一个用户名RATS,邮箱admin@moerats.com,密码moerats的管理员账户,请自行修改
./auxpi -mod=admin -name=RATS -email=admin@moerats.com -pass=moerats 

开始运行程序:

#CentOS系统
yum install screen -y
#Debian/Ubuntu系统
apt install screen -y

#后台运行
screen -dmS auxpi ./auxpi run

运行成功后使用IP:2333进行访问,如果站点打不开,可能需要开启防火墙,点击面板左侧-安全,放行2333端口即可。

3、域名反代

点击左侧网站-添加站点,然后再点击添加好了的域名名称,这时候就进入了站点配置,点击反向代理-添加反向代理,目标URL填入http://127.0.0.1:2333,再提交即可。如果要启用https访问的,点击SSL,申请Let's Encrypt,强制https访问即可。

本文转自:https://www.moerats.com/archives/789/
版权归原作者所有,转载请注明出处!

在使用报表的时候,有很多需要主从表一起显示,从表不需要另外弹窗显示明细,反而直接显示在主表下方。如图所示:

 title=

第一次做这个功能,主从表显示,从表列隐藏,从表单元格点击事件这三个功能点花费了很多时间,在网上参考了很多热心分享,热爱记录的小伙伴的资料,总算大功告成,真的非常感恩!

首先贴第一个功能,主从表显示。这个显示从表是看不到的,主要是代码里面用DataRelation来实现。当时写后台SQL的时候,为了把主表与子表关联起来也是花费了不少脑筋。因为这些数据是关联而成,并没有主外键之间的关联。但因为有主从表的关系,关联还是有的。就是用ROW_NUMBER()函数添加序号列,用相关联的字段更新这个序号列,主从表就能通过序号列关联到一起。

主从表显示的关键代码如下:
//主表
//调用存储过程获取数据源,sp是存储过程参数
DataSet mainDS = Common.SqlHelper.ExecuteDataset(Common.SqlHelper.connString, CommandType.StoredProcedure, "BalanceInformation", sp);
DataTable mainDT = mainDS.Tables[0];//第一个表格,显示主表信息
mainDT.TableName = "Main";
DataSet detailDS = new DataSet();
if(mainDT.Rows.Count > 0)
{
//子表
DataTable detailDT = mainDS.Tables[1];//第二个表格,显示子表信息
detailDT.TableName = "Detail";
mainDS.Tables.Remove(detailDT);
mainDS.Tables.Add(detailDT);
}
//设定关系,ds.a(表).MainId(字段)=ds.b(表).MainId
DataRelation dr = new DataRelation("明细", mainDS.Tables["Main"].Columns["MainId"], mainDS.Tables["Detail"].Columns["MainId"]);

mainDS.Relations.Add(dr);

//绑定数据源
dt = mainDS.Tables["Main"];
gridControl1.DataSource = dt;

该功能的参考链接是:
https://blog.csdn.net/david_520042/article/details/78549978
https://blog.csdn.net/qq_33459369/article/details/80006845

从表列隐藏
//隐藏子表(即从表)的列,获取主表的行展开事件
private void gridView3_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e)
{

    //获取所点击行的从表对象    
    DevExpress.XtraGrid.Views.Grid.GridView childView= gridView3.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView;
    if (childView != null)
    {
        childView.Columns["MainId"].Visible = false;  //隐藏子表列

    }
}

该功能的参考链接是:
https://www.cnblogs.com/super-cj/archive/2012/06/27/2565874.html

从表单元格点击事件

从表点击的时候,是在主表的MasterRowExpanded事件里操作,由于从表是看不到的,所以在属性窗口里面是找不到的。只能通过代码来实现。
代码如下:

//隐藏子表(即从表)的列,获取主表的行展开事件
private void gridView3_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e)
{

   //由于从表的委托事件里面需要再次获取从表对象,所以e.RowHandle,e.RelationIndex需要有全局变量存储传递。
    rowHandle = e.RowHandle;
    relationIndex = e.RelationIndex;
   
    //获取所点击行的从表对象    
    DevExpress.XtraGrid.Views.Grid.GridView childView= gridView3.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView;
    if (childView != null)
    {
        childView.Columns["MainId"].Visible = false;  //隐藏子表列
        //设置从表单元格点击的事件,当从表展开时,点击单元格时发生
        childView.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(this.ChildView_Click);  
        
    }
}

  //委托事件
   private void ChildView_Click(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
{
     //获取主表,根据全局变量获取到从表当前所属的主表
     DevExpress.XtraGrid.Views.Grid.GridView childView = gridView3.GetDetailView(rowHandle, relationIndex) as DevExpress.XtraGrid.Views.Grid.GridView;
     if (childView != null)
     {
        //获取从表的行
         DataRow dr = childView.GetDataRow(e.RowHandle);
        //获取该行[发生日期]列的值
         string startHappenDate = dr["发生日期"].ToString();
         //获取当前点击的单元格的值
         string count = e.CellValue.ToString();
         // 获取该列的字段名e.Column.FieldName

    }
    
}

完毕!逐一击破后发现也不是很难,折磨了我几天的需求总算落下帷幕了。

 title=

安装

教程在CentOS7下操作,其它系统需要稍作修改。

安装EPEL源:

yum -y install epel-release

安装一些基本组件和依赖:

yum -y install wget unzip screen fuse fuse-devel

下载Rclone-解压-重命名文件夹-进入文件夹

wget https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
mv rclone-vxxx-linux-amd64 rclone #目前是v1.45,此处根据具体解压出来的版本号修改,可用ll命令查看目录名
cd rclone

配置

运行Rclone开始配置:

./rclone config

第一步选择n(新建),然后回车输入一个name(名字),如图所示:

 title=

然后选择我们要挂载的类型,不同的版本这里的序号可能不同,请自行修改,这里我们选择11:

 title=

在看到Use auto config?之前一直回车就行
在看到Use auto config?后选择n

 title=

之后会返回一个GoogleDrive授权地址,把它复制到浏览器打开
按提示登陆,复制获取到的代码,然后返回终端粘贴后回车

 title=

最后分别输入n,y,q回车退出配置

 title=

挂载

全部完成后,现在新建一个你要挂载的目录,例如我要挂载到/home/drive

mkdir -p /home/drive

用screen创建一个新的会话:

screen -S rclone

执行如下命令:

./rclone mount anlan: /home/drive --allow-other --allow-non-empty --vfs-cache-mode writes

挂载其实只要几秒钟,但终端不会返回成功信息,直接重连。
重连后查看是否成功

df -h

开机自启

先把rclone的可执行文件复制到/usr/bin:

cp /root/rclone/rclone /usr/bin/rclone

新建一个rclone.service文件:
确定你会使用vi编辑器,否则请使用WinSCP,Xftp之类软件来新建

vi /usr/lib/systemd/system/rclone.service

写入:

[Unit]
Description=rclone

[Service]
User=root
ExecStart=/usr/bin/rclone mount anlan: /home/drive --allow-other --allow-non-empty --vfs-cache-mode writes
Restart=on-abort

[Install]
WantedBy=multi-user.target

anlna=你创建第一步中的name,/home/drive=你设置挂载的路径,修改成自己的

重载daemon,让新的服务文件生效:

systemctl daemon-reload

现在就可以用systemctl来启动rclone了:

systemctl start rclone

设置开机启动:

systemctl enable rclone

停止、查看状态可以用:

systemctl stop rclone
systemctl status rclone

重启你的VPS:

reboot

重启后查看一下rclone的服务起来没,接着查看一下盘子挂上去没:

systemctl status rclone
df -h

挂载成功:

 title=

本文转自:https://anlan.ga/19,版权归作者所有。

前期准备

\#客户端授权

在本地Windows电脑上下载rclone,下载地址:https://rclone.org/downloads/ 。然后解压出来,进入cmd,输入以下命令:

rclone authorize "onedrive"

之后会弹出窗口认证,然后复制token

Paste the following into your remote machine --->
{"access_token":"xxxx"}  #请复制{xx}整个内容(包括花括号),后面需要用到
<---End paste

\#安装fuse

在服务器上安装fuse,在挂载时会用到

yum install fuse

安装rclone

\#安装

curl https://rclone.org/install.sh | sudo bash

\#初始化配置

rclone config
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> Spirit #随便填
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / A stackable unification remote, which can appear to merge the contents of several remotes
   \ "union"
 2 / Alias for a existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Dropbox
   \ "dropbox"
 9 / Encrypt/Decrypt a remote
   \ "crypt"
10 / FTP Connection
   \ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
12 / Google Drive
   \ "drive"
13 / Hubic
   \ "hubic"
14 / JottaCloud
   \ "jottacloud"
15 / Local Disk
   \ "local"
16 / Mega
   \ "mega"
17 / Microsoft Azure Blob Storage
   \ "azureblob"
18 / Microsoft OneDrive
   \ "onedrive"
19 / OpenDrive
   \ "opendrive"
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
21 / Pcloud
   \ "pcloud"
22 / QingCloud Object Storage
   \ "qingstor"
23 / SSH/SFTP Connection
   \ "sftp"
24 / Webdav
   \ "webdav"
25 / Yandex Disk
   \ "yandex"
26 / http Connection
   \ "http"
Storage> 18 #选择18,Microsoft OneDrive
** See help for onedrive backend at: https://rclone.org/onedrive/ **
 
Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> #留空
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> #留空
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n  #选择n
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
    rclone authorize "onedrive"
Then paste the result below:
result> {"access_token":""}  #输入之前在客户端授权的内容
--------------------
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 1 #选择1
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y  #选择y
Current remotes:
 
Name                 Type
====                 ====
Spirit                 onedrive
 
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q  #选择q退出

\#挂载

rclone mount Spirit:Wallpapers /mnt/3/ --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

Spirit为初始化配置填的name,Wallpapers为OneDrive里的文件夹,/mnt/3/为VPS上的本地文件夹

\#卸载

fusermount -qzu /mnt/3/

设置开机自启

下载脚本

wget -N --no-check-certificate https://raw.githubusercontent.com/x91270/Centos/master/rcloned

\#修改一下内容

vim rcloned
NAME=""  #rclone name名,及配置时输入的Name
REMOTE=''  #远程文件夹,OneDrive 网盘里的挂载的一个文件夹
LOCAL=''  #挂载地址,VPS本地挂载目录

\#设置自启

mv rcloned /etc/init.d/rcloned
chmod +x /etc/init.d/rcloned
chkconfig rcloned on
bash /etc/init.d/rcloned start

原文出处:https://spiritx.xyz/503.html,版权归原作者所有。