系统安装

换源

Centos

1
2
3
4
5
6
[root@gouzi-home-servier ~]# yum install -y wget
[root@gouzi-home-servier ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bk
[root@gouzi-home-servier ~]# cd /etc/yum.repos.d
[root@gouzi-home-servier ~]# wget -nc http://mirrors.aliyun.com/repo/Centos-7.repo
[root@gouzi-home-servier ~]# mv Centos-7.repo CentOS-Base.repo
[root@gouzi-home-servier ~]# yum clean all && yum makecache

安装环境

1
2
3
4
5
6
7
8
9
10
11
[root@gouzi-home-servier ~]# yum install -y unzip zip vim nfs-utils rpcbind
[root@gouzi-home-servier ~]# ls
anaconda-ks.cfg docker-backup.zip
[root@gouzi-home-servier ~]# unzip -d / docker-backup.zip
[root@gouzi-home-servier ~]# cd /docker/
[root@gouzi-home-servier docker]# ls
aliyun emby gitlab grafana hexo hexo-build Jackett jellyfin nginx photoprism prometheus qbittorrent radarr sonarr

# 挂载网盘用
[root@gouzi-home-servier ~]# yum install fuse
[root@gouzi-home-servier ~]# curl https://rclone.org/install.sh | sudo bash

挂载网盘 (阿里云)

⬇️点击展开 rclone 挂载
 
[root@gouzi-home-servier aliyun]# rclone config
2022/06/12 10:24:26 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> aliyundrive
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 4 / Amazon Drive
   \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Digital Ocean, Dreamhost, IBM COS, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi
   \ (s3)
 6 / Backblaze B2
   \ (b2)
 7 / Better checksums for other remotes
   \ (hasher)
 8 / Box
   \ (box)
 9 / Cache a remote
   \ (cache)
10 / Citrix Sharefile
   \ (sharefile)
11 / Compress a remote
   \ (compress)
12 / Dropbox
   \ (dropbox)
13 / Encrypt/Decrypt a remote
   \ (crypt)
14 / Enterprise File Fabric
   \ (filefabric)
15 / FTP Connection
   \ (ftp)
16 / Google Cloud Storage (this is not Google Drive)
   \ (google cloud storage)
17 / Google Drive
   \ (drive)
18 / Google Photos
   \ (google photos)
19 / Hadoop distributed file system
   \ (hdfs)
20 / Hubic
   \ (hubic)
21 / In memory object storage system.
   \ (memory)
22 / Jottacloud
   \ (jottacloud)
23 / Koofr, Digi Storage and other Koofr-compatible storage providers
   \ (koofr)
24 / Local Disk
   \ (local)
25 / Mail.ru Cloud
   \ (mailru)
26 / Mega
   \ (mega)
27 / Microsoft Azure Blob Storage
   \ (azureblob)
28 / Microsoft OneDrive
   \ (onedrive)
29 / OpenDrive
   \ (opendrive)
30 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ (swift)
31 / Pcloud
   \ (pcloud)
32 / Put.io
   \ (putio)
33 / QingCloud Object Storage
   \ (qingstor)
34 / SSH/SFTP Connection
   \ (sftp)
35 / Sia Decentralized Cloud
   \ (sia)
36 / Storj Decentralized Cloud Storage
   \ (storj)
37 / Sugarsync
   \ (sugarsync)
38 / Transparently chunk/split large files
   \ (chunker)
39 / Union merges the contents of several upstream fs
   \ (union)
40 / Uptobox
   \ (uptobox)
41 / Webdav
   \ (webdav)
42 / Yandex Disk
   \ (yandex)
43 / Zoho
   \ (zoho)
44 / http Connection
   \ (http)
45 / premiumize.me
   \ (premiumizeme)
46 / seafile
   \ (seafile)
Storage> 41
Option url.
URL of http host to connect to.
E.g. https://example.com.
Enter a value.
url> http://192.168.0.123:1180 
Option vendor.
Name of the Webdav site/service/software you are using.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
 1 / Nextcloud
   \ (nextcloud)
 2 / Owncloud
   \ (owncloud)
 3 / Sharepoint Online, authenticated by Microsoft account
   \ (sharepoint)
 4 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
   \ (sharepoint-ntlm)
 5 / Other site/service or software
   \ (other)
vendor> 5
Option user.
User name.
In case NTLM authentication is used, the username should be in the format 'Domain\User'.
Enter a value. Press Enter to leave empty.
user> admin
Option pass.
Password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Option bearer_token.
Bearer token instead of user/pass (e.g. a Macaroon).
Enter a value. Press Enter to leave empty.
bearer_token> 
Edit advanced config?
y) Yes
n) No (default)
y/n> n
--------------------
[aliyundrive]
type = webdav
url = http://192.168.0.123:1180
vendor = other
user = admin
pass = *** ENCRYPTED ***
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name Type
==== ====
aliyundrive webdav

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

设置挂载脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
[root@gouzi-home-servier aliyun]# wget https://wp.gxnas.com/wp-content/uploads/2021/08/rcloned
[root@gouzi-home-servier aliyun]# cat rcloned
#!/bin/bash
### BEGIN INIT INFO
# Provides: rclone
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start rclone at boot time
# Description: Enable rclone by daemon.
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

REMOTE='aliyundrive:/'
LOCAL='/aliyunpan'
CONFIG='/root/.config/rclone/rclone.conf'
DEMO='rclone'

[ -n "$REMOTE" ] || exit 1;
[ -x "$(which fusermount)" ] || exit 1;
[ -x "$(which $DEMO)" ] || exit 1;

case "$1" in
start)
ps -ef |grep -v grep |grep -q "$REMOTE"
[ $? -eq '0' ] && {
DEMOPID="$(ps -C $DEMO -o pid= |head -n1 |grep -o '[0-9]\{1,\}')"
[ -n "$DEMOPID" ] && echo "$DEMO already in running.[$DEMOPID]";
exit 1;
}
fusermount -zuq $LOCAL >/dev/null 2>&1
mkdir -p $LOCAL
rclone mount $REMOTE $LOCAL --config $CONFIG --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 >/dev/null 2>&1 &
sleep 3;
DEMOPID="$(ps -C $DEMO -o pid=|head -n1 |grep -o '[0-9]\{1,\}')"
[ -n "$DEMOPID" ] && {
echo -ne "$DEMO start running.[$DEMOPID]\n$REMOTE --> $LOCAL\n\n"
echo 'ok' >/root/ok
exit 0;
} || {
echo "$DEMO start fail! "
exit 1;
}
;;
stop)
DEMOPID="$(ps -C $DEMO -o pid= |head -n1 |grep -o '[0-9]\{1,\}')"
[ -z "$DEMOPID" ] && echo "$DEMO not running."
[ -n "$DEMOPID" ] && kill -9 $DEMOPID >/dev/null 2>&1
[ -n "$DEMOPID" ] && echo "$DEMO is stopped.[$DEMOPID]"
fusermount -zuq $LOCAL >/dev/null 2>&1
;;
init)
fusermount -zuq $LOCAL
rm -rf $LOCAL;
mkdir -p $LOCAL;
chmod a+x $0;
update-rc.d -f $(basename $0) remove;
update-rc.d -f $(basename $0) defaults;
rclone config;
;;
esac

exit 0

[root@gouzi-home-servier aliyun]# sh rcloned start
rclone start running.[17372]
aliyundrive:/ --> /aliyunpan
设置自启
1
[root@gouzi-home-servier aliyun]# echo 'sh /docker/aliyun/rcloned start' >> /etc/rc.local 
#### 挂载网盘 (群辉nfs)
1
2
3
4
5
6
yum install -y nfs-utils rpcbind
mkdir -p /ds120j/docker
mkdir -p /ds120j/photoprism

mount -t nfs 192.168.0.156:/volume1/docker /ds120j/docker
mount -t nfs 192.168.0.156:/volume1/photoprism /ds120j/photoprism

gitlab 备份和还原

旧机子进行备份

1
2
3
4
5
6
7
8
9
10
# 查看gitlab版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
14.5.2

# 备份
gitlab-rake gitlab:backup:create

# 查看备份文件
ls /var/opt/gitlab/backups
1655005523_2022_06_12_14.5.2_gitlab_backup.tar

在新机器启动一个gitlab

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
docker stop gitlab
docker rm gitlab

docker run -d -p 443:443 \
-p 8001:80 \
-p 26:22 \
--name gitlab \
--privileged=true \
--restart always \
-v /docker/gitlab/config:/etc/gitlab \
-v /docker/gitlab/logs:/var/log/gitlab \
-v /docker/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:14.5.2-ce.0

拷贝到相同路径
拷贝/etc/gitlab文件夹下所有文件到新机器
拷贝/var/opt/gitlab/backups文件夹下文件到新机器

进入新的gitlab命令行中

1
2
3
4
5
6
7
8
9
gitlab-ctl stop unicorn		#停止相关数据连接服务
gitlab-ctl stop sidekiq #停止相关数据连接服务

# 给权限
chmod 777 /var/opt/gitlab/backups/1655005523_2022_06_12_14.5.2_gitlab_backup.tar

# 恢复 (也可以不填BACKUP参数)
gitlab-rake gitlab:backup:restore BACKUP=1655005523_2022_06_12_14.5.2
# 一路yes

重启gitlab
结束

jackett

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@gouzi-home-servier Jackett]# ls
config up.sh
[root@gouzi-home-servier Jackett]# cat up.sh
#!/bin/bash
docker stop jackett
docker rm jackett

docker run -d \
--name=jackett \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-p 9117:9117 \
-v /docker/Jackett/config:/config \
-v /downloads:/downloads \
--restart unless-stopped \
linuxserver/jackett

jellyfin

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@gouzi-home-servier jellyfin]# ls
config up.sh
[root@gouzi-home-servier jellyfin]# cat up.sh
#!/bin/bash

docker stop jellyfin
docker rm jellyfin

docker run -d \
--name jellyfin \
-p 8096:8096 \
--restart=unless-stopped \
-v /docker/jellyfin/config:/config \
-v /aliyunpan/TV:/data/TV \
-v /aliyunpan/movies:/data/movies \
nyanmisaka/jellyfin

nginx (tengine)

改用了速度更快的tengine

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[root@gouzi-home-servier nginx]# ls
conf.d up.sh
[root@gouzi-home-servier nginx]# cat up.sh
#!/bin/bash

docker stop nginx
docker rm nginx

docker run -d --name nginx \
-p 8081:8081 \
-v /docker/nginx/conf.d:/etc/nginx/conf.d \
-v /docker/hexo-build/data/www/public:/www/hexo \
axizdkr/tengine:latest
#nginx:latest
[root@gouzi-home-servier nginx]# cd conf.d/
[root@gouzi-home-servier conf.d]# ls
gitlab.conf hexo.conf
[root@gouzi-home-servier nginx]# cat conf.d/hexo.conf
server {
listen 80;
server_name gouzi.com www.gouzi.com;
# root /www/hexo/;
# index index.html index.html;

# charset koi8-r;
# source_charset gbk;
charset utf-8;

location / {
root /www/hexo/;
index index.html;
}
}

[root@gouzi-home-servier nginx]# cat conf.d/gitlab.conf
server {
listen 80;
server_name gitlab.gouzi.com;
location / {
proxy_pass http://172.17.0.1:8001;
tcp_nodelay on;
}
}

photoprism

1
2
3
4
[root@gouzi-home-servier docker]# cd photoprism/
[root@gouzi-home-servier photoprism]# ls
data docker-compose.yml
[root@gouzi-home-servier photoprism]# docker-compose up -d

qbittorrent

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@gouzi-home-servier qbittorrent]# ls
config up.sh
[root@gouzi-home-servier qbittorrent]# cat up.sh
#!/bin/bash
docker stop qbittorrent
docker rm qbittorrent

docker run -d \
--name=qbittorrent \
--restart always \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-e WEBUI_PORT=8999 \
-p 52000:52000 \
-p 52000:52000/udp \
-p 8999:8999 \
-v /docker/qbittorrent/config:/config \
-v /downloads:/downloads \
--restart unless-stopped \
lscr.io/linuxserver/qbittorrent
[root@gouzi-home-servier qbittorrent]# sh up.sh

radarr

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@gouzi-home-servier radarr]# ls
config up.sh
[root@gouzi-home-servier radarr]# cat up.sh
#!/bin/bash
docker stop radarr
docker rm radarr

docker run -d \
--name=radarr \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-p 7878:7878 \
-v /docker/radarr/config:/config \
-v /aliyunpan/movies:/movies \
-v /downloads:/downloads \
--restart=always \
linuxserver/radarr

sonarr

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@gouzi-home-servier sonarr]# ls
config up.sh
[root@gouzi-home-servier sonarr]# cat up.sh
#!/bin/bash
docker stop sonarr
docker rm sonarr

docker run -d \
--name=sonarr \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-p 8989:8989 \
-v /docker/sonarr/config:/config \
-v /aliyunpan/TV:/TV \
-v /aliyunpan/movies:/movies \
-v /downloads:/downloads \
--restart unless-stopped \
linuxserver/sonarr:latest

frp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[root@gouzi-home-servier frpc]# ls
config up.sh
[root@gouzi-home-servier frpc]# cat up.sh
#/bin/bash
docker stop frpc
docker rm frpc

docker run \
--restart=always \
--network host \
-d \
-v /docker/frpc/config/frpc.ini:/etc/frp/frpc.ini \
--name frpc \
snowdreamtech/frpc
[root@gouzi-home-servier frpc]# cat config/frpc.ini
[common]
server_addr = *.*.*.*
server_port = *

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = *

[range:tcp_port]
type = tcp
local_ip = 127.0.0.1
local_port = 80
remote_port = 80