Loading... ## syncthing 手机上存着不少照片,自己又时常折腾手机,总有数据丢失的问题,又对市面上的云盘不怎么放心,所以打算在家里利用树莓派搭建一个私有云。一番查找之后,发现了 syncthing。Syncthing 是一个跨平台,开源且免费的基于 P2P 的文件同步解决方案,支持 Windows,Mac,Linux,Android,syncthing 官方暂不支持iOS平台,但在 AppStore 有可用的第三方客户端。 没提供官方arm版本的,自己编译吧。 我日,编译了半天出错。 ```sh docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"/bin/entrypoint.sh\": permission denied": unknown. ``` 不想提issue了,找个编译好的了吧。 ```sh docker pull linuxserver/syncthing # 设置好权限,同时使用本地网络 docker run -d \ --name=syncthing \ -e PUID=1000 \ -e PGID=1000 \ -e UMASK_SET=022 \ --network=host \ -v /pi/syncthing/:/config \ --restart unless-stopped \ linuxserver/syncthing ``` ## Pi-hole 我这里安装的是docker版本,直接下载GitHub上那个docker的脚本就行了。 ```sh #!/bin/bash # https://github.com/pi-hole/docker-pi-hole/blob/master/README.md docker run -d \ --name pihole \ --network=host \ -e TZ="Asia/Shanghai"\ -e ServerIP=192.168.123.7 \ -e ServerIPv6=240e:3a1:54e2:f120:7563:c815:26d:e93a \ -v "$(pwd)/etc-pihole/:/etc/pihole/" \ -v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" \ --dns=127.0.0.1 --dns=8.8.8.8 \ --restart=unless-stopped \ pihole/pihole:latest printf 'Starting up pihole container ' for i in $(seq 1 20); do if [ "$(docker inspect -f "{{.State.Health.Status}}" pihole)" == "healthy" ] ; then printf ' OK' echo -e "\n$(docker logs pihole 2> /dev/null | grep 'password:') for your pi-hole: https://${IP}/admin/" exit 0 else sleep 3 printf '.' fi if [ $i -eq 20 ] ; then echo -e "\nTimed out waiting for Pi-hole start, consult check your container logs for more info (\`docker logs pihole\`)" exit 1 fi done; ``` 然后登陆上修改密码。 ```sh docker exec -it 431c74886137 bash sudo pihole -a -p ``` 但是我实测的话,发现ipv6的问题还是有,而且wan和lan各有dns,没搞清楚,先不配置了。 给几个网站在这。 https://github.com/vokins/yhosts https://github.com/privacy-protection-tools/anti-AD https://github.com/pi-hole/docker-pi-hole https://shumeipai.nxez.com/2018/02/09/install-pi-hole-for-raspberry-pi-to-filter-advertisement.html ## VuePrsss 安装vuepress,感觉挺好的,我这里打算用docker安装,最终选择 node:9.2.1-alpine, 该镜像体积很小,已经内置npm(6.12.1), yarn(1.19.1) ```Dockerfile FROM node:alpine # Install base packages and set timezone ShangHai RUN apk update && apk add tree bash tzdata \ && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # init yarn RUN mkdir -p /vue WORKDIR /vue RUN yarn init -y \ && yarn add -D vuepress \ && mkdir -p /vue/docs EXPOSE 8080 #RUN echo '# Hello VuePress!' > docs/README.md #RUN npx vuepress dev docs #npx vuepress dev docs # Run node ``` 这样一个简易的Dockerfile就可以跑起来了,但是要进去手动部署。 ```sh docker run -d --name=vuepress \ -p 80:8080 \ -v /home/pi/node-alipine/Vue:/Vue \ -it vuepress bash docker run -d \ --name=vuepress \ -p 8080:8080 \ -v /home/pi/node-alipine/Vue:/Vue \ -it vuepress yarn docs:dev ``` https://juejin.im/post/5addb90af265da0b7f442935 https://www.lxx1.com/topics/web https://zhuanlan.zhihu.com/p/93030651 https://github.com/superj80820/vuepress-docker https://segmentfault.com/a/1190000012394654 https://segmentfault.com/a/1190000012279808 ## Aria2 改了官方的dockerfile ```Dockerfile FROM debian:stable AS aria2-builder # aria2 build RUN mkdir -p /builds && mkdir -p /builds/aria2c \ && apt-get update \ && export DEBIAN_FRONTEND=noninteractive \ && apt-get install -y curl git \ make g++ libssl-dev nettle-dev libgmp-dev libssh2-1-dev libc-ares-dev libxml2-dev zlib1g-dev libsqlite3-dev pkg-config libxml2-dev libcppunit-dev autoconf automake autotools-dev autopoint libtool openssl \ && ARIA2_VERSION="1.35.0" \ && mkdir aria_build && cd aria_build \ && curl -L https://github.com/aria2/aria2/releases/download/release-"$ARIA2_VERSION"/aria2-"$ARIA2_VERSION".tar.gz > aria2.tar.gz \ && tar -xzf aria2.tar.gz \ && cd aria2-$ARIA2_VERSION \ && autoreconf -i \ && ./configure --with-ca-bundle='/etc/ssl/certs/ca-certificates.crt' \ && make \ && mv src/aria2c /builds/aria2c \ && cd ../.. \ && rm -rf aria_build \ && rm -rf /var/lib/apt/lists/* FROM golang:1.14-buster AS go-builder # goreman build RUN mkdir -p /builds && mkdir -p /builds/goreman \ && export GOPATH=`pwd` \ && go get github.com/mattn/goreman \ && go build -o /builds/goreman/goreman github.com/mattn/goreman RUN mkdir -p /builds && mkdir -p /builds/gosu \ && apt-get update && apt-get install -y curl \ && GITHUB_REPO="https://github.com/tianon/gosu" \ && LATEST=`curl -s $GITHUB_REPO"/releases/latest" | grep -Eo "[0-9].[0-9]*"` \ && curl -L $GITHUB_REPO"/releases/download/"$LATEST"/gosu-armhf" > /builds/gosu/gosu \ && chmod +x /builds/gosu/gosu \ && unset GITHUB_REPO && unset LATEST \ && rm -rf /var/lib/apt/lists/* FROM httpd # download aria2 dependendies RUN apt-get update && apt-get install -y --no-install-recommends \ busybox \ ca-certificates \ libc-ares2 \ libssh2-1 \ libxml2 \ openssl \ libsqlite3-0 \ zlib1g \ && rm -rf /var/lib/apt/lists/* # Grab aria2c, goreman and gosu binaries COPY --from=aria2-builder /builds/aria2c/aria2c /usr/bin/ COPY --from=go-builder /builds/goreman/goreman /usr/local/bin/ COPY --from=go-builder /builds/gosu/gosu /usr/local/bin/ ADD ./docs /webui-aria2 RUN groupadd -r aria \ && useradd -m -r -g aria aria -u 1000 \ && echo "web: gosu aria /bin/busybox httpd -f -p 8080 -h /webui-aria2\nbackend: gosu aria bash -c 'shopt -s dotglob nullglob && /usr/bin/aria2c --dir=/data/downloads/ --conf-path=/home/aria/.aria2/aria2.conf /data/downloads/*.torrent'" > Procfile # aria2 downloads directory VOLUME /data/downloads # aria2 conf directory VOLUME /home/aria/.aria2 # webui static content web server and aria2 RPC port EXPOSE 8080 6800 CMD ["start"] ENTRYPOINT ["/usr/local/bin/goreman"] ``` 运行命令 ```sh docker run --restart=always \ -v /home/pi/aria2/downloads:/data/downloads \ -v /home/pi/aria2/.aria2:/home/aria/.aria2 \ --network=host \ --name="webui-aria2" \ -d aria2gui ``` 完整的conf参见 http://www.senra.me/aria2-conf-file-parameters-translation-and-explanation/ 下载权限有问题,需要修改download文件夹的权限。 https://www.lxx1.com/4469 https://shumeipai.nxez.com/2014/07/01/raspberry-pi-do-download-machine-aria2.html ## PrivateBin md裂开了,不能用,不知道为啥。 配了一下午nginx的https。 http://www.senra.me/deploy-your-private-online-clipboard-using-privatebin/ ```sh docker run -d \ --name privatebin \ --read-only \ -p 28405:8080 \ --restart=always \ -v /home/ubuntu/docker/privatebin:/srv/data \ privatebin/nginx-fpm-alpine ``` 还有他这个用户的权限不对,映射的时候注意777一下。 ## qBittorrent ```sh sudo apt-get install qbittorrent-nox ``` ```sh qbittorrent-nox -d #端口号默认是8080 #如果想要自定端口的话,请输入以下命令 qbittorrent-nox --webui-port=8081 -d ``` 设置自启动 ```sh sudo vim /etc/systemd/system/qbittorrent/service Description=qBittorrent Daemon Service After=network.target [Service] User=pi Group=pi TimeoutSec=0 ExecStart=/usr/local/bin/qbittorrent-nox ExecStop=/usr/bin/killall -w qbittorrent-nox [Install] WantedBy=multi-user.target sudo systemctl daemon-reload sudo systemctl status qbittorrent ``` ## bitwarden_rs https://10101.io/2019/11/24/self-hosted-bitwarden ```Dockerfile docker run -d \ --name bitwarden \ -e SIGNUPS_ALLOWED=false \ -e INVITATIONS_ALLOWED=false \ -e DOMAIN=https://zjgcjy.top:5000 \ -e ADMIN_TOKEN=LhWaXWGjmbhqVCSBDyvLIAZMyuwH+ppMsbNiu5sX6qIClnzB1Sd7QSS+vdTeJY4h \ --restart=always \ -v /home/ubuntu/docker/bitwarden:/data/ \ bitwardenrs/server:latest ``` 以上是我自己觉得需要的一些配置,更多参数可参考官方 Wiki。 ### 自动备份与ONEINSTACK 利用定时任务执行bitwarden备份,首先新建一个文件夹:mkdir /bw-data/db-backup,然后执行数据库备份任务。 代码如下(关于定时任务说明参考:Linux Crontab命令定时任务基本语法与操作教程): https://mashaji.cc/post/bitwarden_rs_docker/ https://wzfou.com/crontab/ ```sh sqlite3 /bw-data/db.sqlite3 ".backup '/bw-data/db-backup/backup.sqlite3'" ``` ## lets encrypt https://www.jianshu.com/p/3ae2f024c291 ## beancount 和fava ``` ``` Last modification:January 16th, 2021 at 01:05 pm © 允许规范转载 Support 确定不打赏一下支持博主吗 ×Close Appreciate the author Sweeping payments Pay by AliPay