在Oracle Linux 9 中使用 noVNC

[MD]
dnf group install "Server with GUI"

systemctl set-default graphical

reboot

sed '/^#WaylandEnable/s/^#//g' /etc/gdm/custom.conf

# VNCServer

dnf install -y tigervnc-server tigervnc-server-module

vncpasswd

restorecon -RFv $HOME/.vnc

echo ":1=$(whoami)"| sudo tee -a /etc/tigervnc/vncserver.users > /dev/null

systemctl daemon-reload

systemctl enable --now vncserver@:1.service

systemctl restart vncserver@:1.service

firewall-cmd --zone=public --add-service=vnc-server --permanent

firewall-cmd --reload

# noVNC

yum install git

wget https://github.com/novnc/noVNC/archive/refs/tags/v1.5.0.tar.gz

tar -zxvf v1.5.0.tar.gz

mv noVNC-1.5.0 noVNC

cd noVNC/utils

firewall-cmd --add-port=6080/tcp  --permanent

firewall-cmd --reload

vi /noVNC/utils/start.sh

# --start.sh 开始--
#!/bin/bash
/noVNC/utils/novnc_proxy --vnc localhost:5901 --listen 6080 &
# --start.sh 结束--

chmod u+x /noVNC/utils/start.sh

vi /etc/systemd/system/novnc.service

# --novnc.service 开始--
[Unit]
Description= noVNC  Service(noVNC)
After=tigervnc.target

[Service]
# backend running
Type=forking

ExecStart=/noVNC/utils/start.sh
ExecStop=/bin/kill -9 $(ps -e | grep 'receive' | awk '{print $1}')
Restart=on-failure

[Install]
WantedBy=multi-user.target
# --novnc.service 结束--

systemctl daemon-reload

systemctl enable novnc.service

systemctl restart novnc.service

# 输入法

yum install ibus-libpinyin

# 重启系统,在Applications>>Settings>>Keybord>>input Source中有个加号点添加

# 搜索chinese(Intelligent Pinyin) 点Add

在docker的centos里启用systemd

[MD]

1. 拉取镜像[1]

docker pull centos

2. 创建一个DockerFile文件

vi mydockerfile
# 以下是mydockerfile文件的内容
FROM centos:7
MAINTAINER "Yourname" <[email protected]>
ENV container docker
RUN yum -y update; yum clean all
RUN yum -y install systemd; yum clean all; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]
# mydockerfile内容结束

3. 将centos镜像打包为新的centos7-systemd镜像

docker build -t centos7-systemd - < mydockerfile

4. 创建并运行docker容器centos7[2]

docker run --name centos7 --net=host --privileged=true -d -e container=docker  -v /sys/fs/cgroup:/sys/fs/cgroup  centos7-systemd

  1. 参考资料:https://serverfault.com/questions/824975/failed-to-get-d-bus-connection-operation-not-permitted ↩︎

  2. 原文为docker run --rm --privileged -ti -e container=docker -v /sys/fs/cgroup:/sys/fs/cgroup centos7-systemd /usr/sbin/init ↩︎

摆脱kms激活Windows和Office

本文最后更新于(2024-3-5 10:53:05),链接可能失效,内容可能难以复现。请注意甄别。
使用Microsoft Activation Scripts 下载 [1] 用数字权利激活Windows [2] 用ohook激活Office 官方教程:https://massgrave.dev/index.html#Download__How_to_use_it

KMS最低要求:Windows8,Office2010
数字权利激活要求:Windows10/11
ohook激活最低要求:Office2013

《Office各个版本对Windows的最低安装要求》

arm宝塔面板安装Nginx防火墙后导致Nginx报错

本文最后更新于(2023-11-12 13:12:19),链接可能失效,内容可能难以复现。请注意甄别。
[MD]

错误场景

在甲骨文VPS(Oracle Cloud)中的arm服务器,安装宝塔面板的Nginx防火墙,会导致之前安装的nginx重启报错unknown directive "lua_shared_dict"

原因分析

这个功能应该是和面板上面的编译安装中出现的自定义模块有关,但是并不妨碍我们使用这个功能来实现自动编译和加载 LuaJIT。

解决方法

1.在 /www/server/panel/install 分别创建名字为nginx_prepare.shnginx_configure.pl的文件,然后将两个文件的权限设置为600并且将所有者设置为root

nginx_prepare.sh 的内容

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
  
wget -c -O LuaJIT-2.1.zip https://github.com/LuaJIT/LuaJIT/archive/refs/heads/v2.1.zip -T 10
unzip LuaJIT-2.1.zip
if [ -e LuaJIT-2.1 ]; then
    cd LuaJIT-2.1
    make linux
    make install
    export LUAJIT_LIB=/usr/local/lib
    export LUAJIT_INC=/usr/local/include/luajit-2.1/
    ln -sf /usr/local/lib/libluajit-5.1.so.2 /usr/local/lib64/libluajit-5.1.so.2
    if [ `grep -c /usr/local/lib /etc/ld.so.conf` -eq 0 ]; then
        echo "/usr/local/lib" >> /etc/ld.so.conf
    fi
    ldconfig
    cd ..
fi
rm -rf LuaJIT-2.1*

提醒:直接复制粘贴可能存在回车符,如果遇到编译失败请使用sed -i 's/\r//g' /www/server/panel/install/nginx_prepare.sh删除回车符。

nginx_configure.pl 的内容

--add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module

这里的LuaJIT源码来自GitHub
关于缺失的jemalloc,原作者经过测试需要 5.1.0 以上的版本才可以让Nginx 1.20.x正常编译,加载 jemalloc 之后单个 Nginx 的进程内存占用高达 2G(虽然这台 ARM 有 32G 的内存),所以放弃这个模块,如果你需要用到,就将下面代码追加到nginx_prepare.sh文件中。

if [ ! -f '/usr/local/lib/libjemalloc.so' ]; then
    wget -O jemalloc-5.2.1.tar.bz2 ${download_Url}/src/jemalloc-5.2.1.tar.bz2
    tar -xvf jemalloc-5.2.1.tar.bz2
    cd jemalloc-5.2.1
    ./configure
    make && make install
    ldconfig
    cd ..
    rm -rf jemalloc*
fi

同时在nginx_configure.pl追加一个空格后追加--with-ld-opt=-ljemalloc

2.最后在面板升级一下 Nginx,或者终端执行下面命令重新编译 Nginx,之后就可以愉快使用 LuaJIT 了。

cd /www/server/panel/install && bash install_soft.sh 0 update nginx 1.22

运行之前你需要稍作修改,将 1.22 修改成你需要升级或安装的版本,如果你需要升级则先看下自己的 Nginx 是什么版本,比如 1.18.1 则修改为 1.18,脚本运行完成后 Nginx 的版本也会升级到 1.18 的最新版本。另外,如果你的服务器未安装 Nginx,则需要将update修改为install

原作者使用的是Ubuntu,本人使用的是Oracle Linux。

参考链接:

让宝塔面板的 Nginx 在 ARM 下也能支持 LuaJIT