Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle免费服务器 #54

Open
cndaqiang opened this issue Mar 8, 2022 · 10 comments
Open

Oracle免费服务器 #54

cndaqiang opened this issue Mar 8, 2022 · 10 comments
Labels
enhancement New feature or request

Comments

@cndaqiang
Copy link
Owner

No description provided.

@cndaqiang
Copy link
Owner Author

默认防火墙基本都没开,就算安装了apache2,也要自己打开iptables

@cndaqiang
Copy link
Owner Author

cndaqiang commented Mar 26, 2022

默认的ubuntu系统, 撞上很多服务后,在控制台打开端口也不行, 很不好用, 换系统

netboot.xyz 重装系统

VNC连接

创建本地连接=>复制vnc连接
image
image

找一台B服务器,粘贴下面的连接,蓝色线部分,换成B服务器的ip和端口

image

VNC连接
image

image

连接后显示guest disabled display,不用处理,已经成功了,就在那里等待安装完成,弹出设置界面

使用netboot重装

参考甲骨文(ARM/x86均可) oracle cloud使用netboot任意重装系统

下载: https://netboot.xyz/downloads/

image

把下载的netboot.xyz-arm64.efi上传到服务器的/boot/efi/EFI目录

重启服务器后, 在VNC界面出现启动画面时,不断按F2进入BIOS界面

下图来自上面的参考链接,就不再重新截图了
image
image
image

image

之后就是正常安装了,会自动配置好ip, 也能直接上网。
oracle可能是把公网ip完全映射到内网ip上, 在服务器上没法配置也查看不到公网ip的网卡

@cndaqiang
Copy link
Owner Author

cndaqiang commented Mar 26, 2022

qbittorent

[Linux 服务器安装 qBittorrent](https://www.misterma.com/archives/902/)

做种保号

apt install -y qbittorrent-nox
#指定端口
qbittorrent-nox --webui-port=8080

随后在浏览器, 访问,修改完设置后,就用

qbittorrent-nox -d

后台运行就可以了

添加到系统服务

root@oracle:/home/cndaqiang# cat /etc/systemd/system/qbittorrent.service
[Unit]
[Service]
User=cndaqiang
Group=cndaqiang
ExecStart=/usr/bin/qbittorrent-nox -d
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
root@oracle:/home/cndaqiang# systemctl start qbittorrent
root@oracle:/home/cndaqiang# systemctl enable  qbittorrent

@cndaqiang
Copy link
Owner Author

添加zerotier子网
#44
#12 (comment)

@cndaqiang
Copy link
Owner Author

cndaqiang commented Mar 27, 2022

在线网页代理

创建

新建一个名为 jsproxy 用户(nobody 组),并切换:

groupadd nobody
useradd jsproxy -g nobody --create-home

su - jsproxy

安装 nginx

本项目使用 OpenResty。编译前需确保 make、gcc 等工具存在。

mktemp=~/source
mkdir -p $mktemp
cd $(mktemp -d)

curl -O https://www.openssl.org/source/openssl-1.1.1b.tar.gz
tar zxf openssl-*

#原文档pcre链接无法下载,替换为镜像
curl -O https://mirrors.gigenet.com/OSDN//sfnet/p/pc/pcre/pcre/8.43/pcre-8.43.tar.gz
tar zxf pcre-*

curl -O https://zlib.net/zlib-1.2.11.tar.gz
tar zxf zlib-*

curl -O https://openresty.org/download/openresty-1.15.8.1.tar.gz
tar zxf openresty-*
cd openresty-*

export PATH=$PATH:/sbin

./configure \
  --with-openssl=../openssl-1.1.1b \
  --with-pcre=../pcre-8.43 \
  --with-zlib=../zlib-1.2.11 \
  --with-http_v2_module \
  --with-http_ssl_module \
  --with-pcre-jit \
  --prefix=$HOME/openresty

#安装时提示使用gmake, 替换下面的命令的make为gmake
make
make install

其中 configure 的参数 --prefix 指定 nginx 安装路径,这里为方便设为用户主目录。

注意编译后的 nginx 程序不能改变位置,否则会启动失败

测试能否执行:

~/openresty/nginx/sbin/nginx -h

安装代理程序

下载本项目,其本质就是一堆 nginx 配置。推荐放在 jsproxy 用户的主目录:

cd ~
git clone --depth=1 https://github.com/EtherDream/jsproxy.git server

下载静态资源文件到 www 目录:

cd server
rm -rf www
git clone -b gh-pages --depth=1 https://github.com/EtherDream/jsproxy.git www

修改证书认证使用的端口

cd ~/server
vi nginx.conf

修改listen的8080为其他端口

http {
  include                 log.conf;
  server {
    listen                8080;
    include               cert/cert.conf;
    include               api.conf;
    include               www.conf;
  }

开启服务:

cd ~/server
./run.sh

启动成功后可以打开http://ip:8080/,(显示本程序需要 HTTPS 站点)
更新使用 git 即可。

申请域名和配置HTTPS证书

域名申请

类似的还有 nip.iosslip.io,自动安装脚本默认使用 xip.io

申请证书

安装acme

cd ~
wget https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh
./acme.sh --install

注册账户

~/.acme.sh/acme.sh --register-account -m  [email protected]

使用80端口进行服务器的验证比较容易, 将80端口转发到jsproxy的监听端口(nginx.conf中的listen端口,root权限)

成功后可以打开http://ip:80/

iptables -t nat -I PREROUTING 1 -p tcp --dport 80 -j REDIRECT --to-ports 8080

注册证书

# 服务器公网 IP
ip=$(curl -s https://api.ipify.org)
domain=$ip.xip.io
#CNQ: 这里填服务器ip对应的域名, 免费:$ip.xip.io, 其他能解析的域名都可以. 如报错 ip.xip.io:Timeout,域名解析失败,换ip.nip.io或者其他能成功解析的域名, 也可能是因为没有打开80端口转发或者没有启动jsproxy


dist=~/server/cert/$domain
mkdir -p $dist

~/.acme.sh/acme.sh \
  --issue \
  -d $domain \
  --keylength ec-256 \
  --webroot ~/server/acme

~/.acme.sh/acme.sh \
  --install-cert \
  -d $domain \
  --ecc \
  --key-file $dist/ecc.key \
  --fullchain-file $dist/ecc.cer

配置证书

#可修改8443为指定的端口
echo "
listen                8443 ssl http2;
ssl_certificate       cert/$domain/ecc.cer;
ssl_certificate_key   cert/$domain/ecc.key;
" > ~/server/cert/cert.conf

备注:

  • acme自动添加更新证书到计划任务crontab -e可以看到
  • 保存端口转发确保能自动更新成功
  • apt-get install iptables-persistent; netfilter-persistent save

重启程序

~/server/run.sh reload
#停止是 ~/server/run.sh stop

浏览器打开https://domain:8443即可

定期重启

0  1 * * * "/home/jsproxy/server/run.sh reload"  > /dev/null

youtube可以打开,跳转链接后就没法播放了,刷新一下页面就可以

其他

设置访问密码

Nginx配置密码访问-访问网页需输入用户名密码

htpasswd -c /home/jsproxy/openresty/nginx/password username
# htpasswd -D /usr/local/nginx/password username
# htpasswd -b /usr/local/nginx/password username pass
# -D 删除指定的用户
# -b htpassswd命令行中一并输入用户名和密码而不是根据提示输入密码
# -p htpassswd命令不对密码进行进行加密,即明文密码

修改配置

vi ~/server/nginx.conf

填入

  server {
    listen                8080;
    include               cert/cert.conf;
    include               api.conf;
    include               www.conf;
#添加下面两行
auth_basic "请输入账户密码";
auth_basic_user_file /home/jsproxy/openresty/nginx/password;

重启

~/server/run.sh reload

ipv6

$ cat  nginx.conf | grep resolver
  resolver                1.1.1.1 ipv6=on;

https访问端口

修改这两个文件的8443为希望的端口

cert/cert.conf:2:listen                8443 ssl http2;
www.conf:32:    local url = host .. ':8443' .. ngx.var.request_uri

当前域名不在服务器外链白名单

vi allowed-sites.conf
# 允许任何站点使用
 ~(.*)                             '$1';

image

@cndaqiang
Copy link
Owner Author

nginx的其他网页

基于上面的jsproxy,添加一个nginx配置

$ cat html_cnq/cnq.conf
server {
    listen    2180;
    root  /home/jsproxy/server/html_cnq/clash-dashboard/;
    index   index.html index.htm;
    include /home/jsproxy/openresty/nginx/conf/mime.types;
}

@cndaqiang
Copy link
Owner Author

cndaqiang commented Apr 25, 2022

安装filebrowser在线文件管理

https://github.com/filebrowser/filebrowser

curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash

使用

filebrowser -p 82 -a 0.0.0.0

访问ip:82

系统服务,指定好数据库的位置

root@oracle:/home/cndaqiang# cat /etc/systemd/system/filebrowser.service
[Unit]
Description=File browser
After=network.target
[Service]
User=cndaqiang
Group=cndaqiang
ExecStart=/usr/local/bin/filebrowser  -p 82 -a 0.0.0.0 -r / -d /home/cndaqiang/soft/filebrowser/filebrowser.db
[Install]
WantedBy=multi-user.target

在这里设置用户可以执行的命令
image

@cndaqiang
Copy link
Owner Author

cndaqiang commented Apr 27, 2022

jellyfin

sudo su
#Mint
apt-get install -y ca-certificates libgnutls30
wget -O- https://repo.jellyfin.org/jellyfin_team.gpg.key | sudo apt-key add -
#添加源,识系统而定
echo "deb  [arch=$( dpkg --print-architecture )]  https://repo.jellyfin.org/ubuntu bionic main" | sudo tee /etc/apt/sources.list.d/jellyfin.list
# 
apt update
apt install jellyfin
#https://www.linuxcapable.com/how-to-install-jellyfin-media-server-on-debian-11/
sudo wget -O- https://repo.jellyfin.org/jellyfin_team.gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/jellyfin.gpg
echo "deb [arch=$( dpkg --print-architecture ) signed-by=/usr/share/keyrings/jellyfin.gpg] https://repo.jellyfin.org/debian bullseye main" | sudo tee /etc/apt/sources.list.d/jellyfin.list
echo "deb [arch=$( dpkg --print-architecture ) signed-by=/usr/share/keyrings/jellyfin.gpg] https://repo.jellyfin.org/debian bullseye main unstable" | sudo tee /etc/apt/sources.list.d/jellyfin.list
sudo apt update
systemctl start jellyfin

网页ip:8096配置

配置好登陆后,在设置》高级〉联网可以指定端口号
高级里面还有插件

需要把相应目录的权限打开权限755,才能扫描路径

备注有些库缺少时

源填错了

@cndaqiang
Copy link
Owner Author

cndaqiang commented Aug 18, 2022

不支持arm平台

失败安装docker,搭建zerotier-planet 服务器

 apt-get remove docker docker-engine docker.io containerd runc
apt-get update
apt-get update
apt-get install     ca-certificates     curl     gnupg     lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
     $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
apt install docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
gpasswd -a root docker
service docker restart

安装

按照zerotier-planet操作即可

#修改配置文件docker-compose.yml
docker-compose up -d

如果报错ERROR: for ztncui a bytes-like object is required, not 'str',可能是端口不对
删除已经创建的容器docker stop ztncui;docker rm ztncui,修改docker-compose.yml中的端口即可

@cndaqiang
Copy link
Owner Author

Mytool公共存储空间

apt install nfs-common nfs-kernel-server
/home/cndaqiang/git/MyTools x.x.x.0/24(rw,no_subtree_check,all_squash,anonuid=0,anongid=0,insecure)
systemctl restart nfs-server.service 

@cndaqiang cndaqiang added the enhancement New feature or request label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant