最近成功开通了甲骨文的免费vps,记录下安装配置过程,方便折腾。
系统选的是Ubuntu ARM ubuntu-26.04,常用VPS设置参考这里 。
一、使用ssh工具通过key登录
我用的是开源免费的 tabby ,甲骨文Ubuntu系统的用户名为ubuntu 。
安装docker环境
curl https://get.docker.com/ | sh
systemctl enable --now docker
二、修改防火墙
1、新建的甲骨文云帐号是关闭了所有的入站连接的,需要在防火墙处添加规则允许入站。
依次点击实例名称-网络-子网-安全,再点击默认的 安全列表名称。
点击安全规则,添加入站规则:入站规则 – 源CIDR 0.0.0.0/0 – 所有协议。
同样操作,添加出站规则。
2、后台登录系统,运行以下命令,开放所有端口
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
Ubuntu镜像默认设置了Iptable规则,关闭它
apt-get purge netfilter-persistent
重启系统
reboot
安装防火墙工具
apt install ufw
三、更换IP
目前甲骨文云Oracle Cloud支持手动免费更换IP地址。
点击实例名称-网络,点击 附加的VNIC名称–IP管理,点击IP地址右侧的 ... ,再点击编辑。
选择没有公共IP–更新. 这样就可以释放之前的IP地址。再次点击 ... ,点击编辑,然后选择临时公共IP–更新,系统会再次分配一个不同的IP地址到这个实例了。
四、删除实例
终止甲骨文云实例时,一定要勾选永久删除附加的引导卷。否则引导卷超出100GB的空间会扣费的! 点击实例名称右侧的 ... ,再点击 终止实例。
五、重装系统
甲骨文的重装系统功能叫 替换引导卷。
点击实例名称-操作-更多操作-替换引导卷
在弹出的页面中,选择【映像】、【输入OCID】,并在下方【输入映像OCID】处填入OCID。
说明:
保留引导卷:开启这个功能后,将保留当前引导卷,以后随后所需时使用;如果没有这个需求,就不要开启这个功能。
映像OCID:可以通过实例详情页,点击映像名称,就能查看到OCID,复制后粘贴到上方即可。
如untuntu-26.04-aarch64新加坡区的OCID为:
ocid1.image.oc1.ap-singapore-2.aaaaaaaayd33iap3rtymhtyvb6edcivps4sxp4y7dvjsx3vnykutlfxtny6q
引导卷大小:默认为47G,可以保持默认,后续根据需要再进行扩展。当然,也可以根据自己的使用情况在此处直接输入大小。
如果你还记得之前的秘钥,则直接【保存】即可。如果你忘记了之前的秘钥或是想更换新的秘钥或密码。在【替换引导卷】中点击页面下方的【高级选项】,点击【元数据】,在【名称】处输入user_data,【值】处输入新的 公钥
最后点击【保存】后,该实例的引导卷将经历一个 正在分离 – 已分离 – 正在附加 – 已附加 的过程,持续时间大概3-5分钟。
六、申请域名证书参考这里第5点。编译安装nginx参考这里第四点,但ubuntu 26.04系统与以前的版本稍有不同
1、安装编译工具及相关依赖库
apt install make gcc libpcre2-dev libssl-dev zlib1g-dev
2、下载最新nginx源代码,地址
wget --no-check-certificate https://nginx.org/download/nginx-1.31.8.tar.gz && tar -xvf nginx-1.31.8.tar.gz && cd nginx-1.31.8
3、设置编译参数并编译
./configure --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_v2_module --with-http_v3_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-pcre
make && sudo make install
七、安装sing-box,参考这里 ,安装TrustTunnel或mieru,参考这里
八、安装openwebui
工作目录下新建文件夹 openwebui ,切换到此文件夹下,nano docker-compose.yml 文件
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
ports:
- "3001:8080"
volumes:
- ./data:/app/backend/data
restart: unless-stoppeddocker compose up -d
nginx 配置文件新增一个 server 字段
server {
listen 443 ssl ;
http2 on;
server_name ai.mydomain.com; #改成自己的域名
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# CRITICAL: Disable buffering for SSE streaming
proxy_buffering off;
proxy_cache off;
}
}九、安装chromium
此博文 提供了一种免费阅读付费期刊的办法,但在手机上不是很方便。可以在VPS上部署chromium,并安装好Bypass Paywalls Clean插件。iphone手机上可设置快捷指令,分享发送到远程vps,在手机上就可看到付费内容了。
新建文件夹 chromium ,切换到此文件夹下,nano docker-compose.yml 文件
services:
chrome:
image: lscr.io/linuxserver/chromium:latest
shm_size: 2gb
environment:
- PUID=1000
- PGID=1000
# - CUSTOM_USER=user
# - PASSWORD=password
- CHROME_CLI=--remote-debugging-port=9222
volumes:
- ./config:/config
ports:
- "127.0.0.1:6000:3000"
- "127.0.0.1:8765:8765"
opener:
image: python:3-alpine
network_mode: service:chrome
depends_on:
chrome:
condition: service_started
restart: true
restart: unless-stopped
environment:
- TOKEN=svgqewifhnfwo8fh9uijfdmvhhgyturdf #自己设置
volumes:
- ./opener.py:/opener.py:ro
command: python /opener.py同时在 chromium 目录下 nano opener.py 文件
import os, urllib.parse, urllib.request
from http.server import BaseHTTPRequestHandler, HTTPServer
TOKEN = os.environ["TOKEN"]
class H(BaseHTTPRequestHandler):
def do_POST(self):
n = int(self.headers.get("Content-Length", 0))
url = self.rfile.read(n).decode().strip()
ok = (self.path == "/open"
and self.headers.get("X-Token") == TOKEN
and url.startswith(("http://", "https://")))
if not ok:
self.send_response(403); self.end_headers(); return
req = urllib.request.Request(
"http://localhost:9222/json/new?" + urllib.parse.quote(url, safe=""),
method="PUT")
urllib.request.urlopen(req, timeout=5)
self.send_response(200); self.end_headers(); self.wfile.write(b"ok")
HTTPServer(("0.0.0.0", 8765), H).serve_forever()
最后
docker compose up -d
插件安装目录在 /chromium/config/ 下。
nginx 配置文件新增一个 server 字段
server {
listen 443 ssl;
http2 on;
server_name reader.mydomain.com; #改成自己的域名
# 远程桌面(KasmVNC,需要 WebSocket)
location / {
proxy_pass http://127.0.0.1:6000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
# 分享即打开接口(对应快捷指令)
location = /open {
proxy_pass http://127.0.0.1:8765/open;
proxy_set_header Host $host;
client_max_body_size 8k;
}
} 在手机上设置快捷指令时,需要用到域名和TOKEN 。
十、安装calibre ,docker镜像在此
新建文件夹 calibre ,切换到此文件夹下,nano docker-compose.yml 文件
services:
calibre:
image: lscr.io/linuxserver/calibre:latest
container_name: calibre
security_opt:
- seccomp:unconfined
environment:
- TZ=Etc/UTC
- PASSWORD=yourpasswd
volumes:
- ~/calibre/config:/config
ports:
- 9080:8080
- 8181:8181
- 9081:8081
restart: unless-stopped默认用户名 abc 。
nginx 配置文件新增一个 server 字段
server {
listen 443 ssl;
http2 on;
server_name ebook.mydomain.com; #改成自己的域名
location / {
proxy_pass http://127.0.0.1:9080;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
评论
发表评论