• 闲置服务器废物利用_离线下载_私人影院_个人博客_私人云笔记_文件服务器


    背景

    • 家里有台旧windows笔记本,PentiumB940 2.00GHz的cpu 4G内存,512G硬盘
    • 放在家里吃灰很久,最近几个月折腾折腾,装了linux操作系统,换了一个2T的硬盘
    • 这里记录下折腾的过程,有需要的可以参考

    开通公网IP

    • 打电话给运营商一般都可以免费开通 但这个公网IP(ipv4)不是一成不变的,一般都是会变化的
    • 不过这里可以监控公网ip变化 直接修改dns解析就好 参考下方连接
      • https://becool.vip/posts/tech/golang%E7%9B%91%E6%8E%A7%E5%85%AC%E7%BD%91ip%E5%8F%98%E5%8C%96%E8%87%AA%E5%8A%A8%E5%90%8C%E6%AD%A5dns%E8%A7%A3%E6%9E%90/
    • 个人宽带网关上网方式用桥接,然后路由器选择拨号,个人服务器直接网线连接路由器,路由器开启DMZ功能,将流量打向家里的旧电脑

    搭建个人git服务器

    • 访问github总是很慢,暂时也没弄科学上网
    • 具体方法可参考下方连接
      • https://becool.vip/posts/tech/ubuntu%E5%AE%89%E8%A3%85git%E6%9C%8D%E5%8A%A1%E5%99%A8/

    hugo搭建个人博客

    • 目前个人有一台1核2G的腾讯云服务器 一个域名 最终静态页面是部署在腾讯云服务器

      • 平时会分享一些自己闲言碎语 包括技术、音乐、运动等等 有兴趣可关注

      • https://becool.vip/

    • hugo建站步骤

      • https://becool.vip/posts/tech/create_hugo_blog/
    • hugo网站增加评论

      • https://becool.vip/posts/tech/hugo%E5%8D%9A%E5%AE%A2%E6%B7%BB%E5%8A%A0tkikoo%E8%AF%84%E8%AE%BA/
    • 网站https证书申请 自动续期

      • https://becool.vip/posts/tech/certbot%E7%94%B3%E8%AF%B7ssl%E8%AF%81%E4%B9%A6%E5%B9%B6%E5%90%AF%E5%8A%A8%E7%BB%AD%E6%9C%9F/

    离线下载

    安装aria2

    • apt install ariac2
    • 配置
      • 可以参考一下git 建议配置rpc和token 这样加上域名+路由器NAT 可以随时随地添加下载任务
      • https://github.com/P3TERX/aria2.conf.git
    • 启动命令
      • sudo aria2c --conf-path=/xxpath/aria2.conf -D
    • 安装YAAW插件 实现浏览器直接离线下载 平时搜到磁力连接 点击插件就可以让家里的服务器直接下载了
      • https://chromewebstore.google.com/detail/yaaw-for-chrome/dennnbdlpgjgbcjfgaohdahloollfgoc?hl=zh-TW
    • 我是部署到家里的服务器,动态监控家里公网IP变化 然后修改dns解析

    IOS自定义通知

    • 自己定时发一些通知到手机 提醒喝水、休息、睡觉之类
    • 公网IP变化了 实时通知到手机 方法可参考下方连接
      • https://becool.vip/posts/tech/%E8%87%AA%E5%BB%BA%E8%8B%B9%E6%9E%9C%E6%B6%88%E6%81%AF%E9%80%9A%E7%9F%A5%E6%8E%A8%E9%80%81%E5%B7%A5%E5%85%B7/

    静态文件服务器

    • 安装nodejs
    • 安装httpserver npm install http-server -g
    • cd /sharefiles;nohup http-server -a 0.0.0.0 -p 6666 >~/log/httpServer.log 2>&1 &
    • 结合动态域名解析 可以随时随地访问家里的文件服务器 包括一些电影/歌曲/纪录片等等

    私人云笔记

    • 这里是无意间逛github看到的一个开源云笔记软件,目前个人一直还在使用 有兴趣的可以试试

    • 相关介绍网站

      • https://trilium.netlify.app/
      • https://github.com/zadam/trilium
    • docker安装部署

      • 拉取镜像docker pull zadam/trilium:0.61-latest

      • 选定数据目录 修改配置文件config.ini

        • docker内部端口可以修改 也可以用默认 可以复制直接使用
        [General]
        # Instance name can be used to distinguish between different instances using backend api.getInstanceName()
        instanceName=
        # set to true to allow using Trilium without authentication (makes sense for server build only, desktop build doesn't need password)
        noAuthentication=false
        # set to true to disable backups (e.g. because of limited space on server)
        noBackup=false
        # Disable automatically generating desktop icon
        # noDesktopIcon=true
        [Network]
        # host setting is relevant only for web deployments - set the host on which the server will listen
        # host=0.0.0.0
        # port setting is relevant only for web deployments, desktop builds run on a fixed port (changeable with TRILIUM_PORT environment variable)
        port=8080
        # true for TLS/SSL/HTTPS (secure), false for HTTP (unsecure).
        https=false
        # path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true
        certPath=
        keyPath=
        # setting to give trust to reverse proxies, a comma-separated list of trusted rev. proxy IPs can be specified (CIDR notation is permitted),
        # alternatively 'true' will make use of the leftmost IP in X-Forwarded-For, ultimately an integer can be used to tell about the number of hops between
        # Trilium (which is hop 0) and the first trusted rev. proxy.
        # once set, expressjs will use the X-Forwarded-For header set by the rev. proxy to determinate the real IPs of clients.
        # expressjs shortcuts are supported: loopback(127.0.0.1/8, ::1/128), linklocal(169.254.0.0/16, fe80::/10), uniquelocal(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7)
        trustedReverseProxy=false
      • docker启动

        • 将本机的8081端口映射到docker的8080端口 将本地/home/xxx/trilium_data挂载到docker内部的/home/node/trilium-data目录

        • sudo docker run -d -p 0.0.0.0:8081:8080 -v /home/xxx/trilium_data:/home/node/trilium-data zadam/trilium:0.61-latest
        • docker logs 实例ID 查看没有报错 docker ps实例一直存在就是没有问题

      • 浏览器打开http://xxip:8081 初始化登录密码后就可以享受私人云笔记了

    • 软件版本升级

      • docker stop 实例id 停掉原有实例
      • docker pull zadam/trilium:0.62-latest 拉取新版本
      • sudo docker run -d -p 0.0.0.0:8081:8080 -v /home/xx/trilium_data:/home/node/trilium-data zadam/trilium:0.62-latest
        • 镜像地址换掉 磁盘目录映射 端口映射都不变,数据会自动迁移

    开启smb文件共享,在小米电视看电影

    安装samba

    sudo apt-get install samba

    修改配置

    • sudo vi /etc/samba/smb.conf 在最后添加一下内容

      [share]
         comment = ubuntu_share
         path = /共享目录绝对路径
         public = yes
         writable = yes
         available = yes
         browseable = yes
    • 小米电视用的协议比较老 还需要做以下配置修改

      • 在global下面一行 加入 server min protocol = CORE

    添加用户

    sudo smbpasswd -a ftp

    重启samba服务

    sudo service smbd restart

    其它局域网电脑查看方法

    smb://ip

    小米电视访问samba共享文件 在电视上看电影

    • 应用里面有个**"高清播放器"** 打开,没有就搜索安装
    • 菜单左侧 "设备"
    • 添加设备 输入局域网ip 然后可能要输入账号或者密码
    • 接下来就可以愉快的看电影了
    • 目前离线下载了一些记录片 mv,英文动画片等等,小孩子看的比较多
    • 老婆大人偶尔也想看个高清电影,晚上离线,第二天电视看高清的体验确实不错.

    本文由 mdnice 多平台发布

  • 相关阅读:
    c文件如何编译为ko的MAKEFILE文件编写
    React之Jsx如何转换成真实DOM
    Django笔记三十二之session登录验证操作
    【JavaSE】多态
    Stable Diffusion7
    java计算机毕业设计潮流奢侈品购物网站源码+mysql数据库+系统+lw文档+部署
    Git详细介绍 -入门到实战万字篇(上)
    MySQL——单行函数和分组函数
    ubuntu黑屏(个人经验)
    【数字信号处理】离散傅里叶变换(DFT)的物理意义
  • 原文地址:https://blog.csdn.net/imheketong/article/details/140386563