iT邦幫忙

2022 iThome 鐵人賽

DAY 12
1
自我挑戰組

地圖物聯系列 第 12

好一個 nextcloud 安裝筆記

  • 分享至 

  • xImage
  •  

說明:
有 nextcloud 雲端,便可不用再花費其它雲端硬碟了,她不但免費且開源,目前大部份安裝文章都採用 docker compose方式,但有時出現錯誤不太好 debug,對我這種新手來說,例如1.port 2.ip 3.container name 4.volume ...等衝突,個人認為手動一方面比較能逐一了解,將來比較好debug

優點:
1.容易上手
2.界面優
3.雲端連線與 google drive 差不多
4.擴充容易
5.可以在雲端使用office,大家可協同作業,與 office356概念同
6.顯示繁中

缺點:
1.新手安裝不易
2.設定有些困難需在 /var/www/hrml/config/config.php 設定
3.設定錯誤容易當機
4.onlyoffice 支援多國及簡體目前所知尚未支援繁體

安裝步驟:
步驟1:
安裝 mariadb(密碼要改自已習慣)如下:
先下載 image:docker pull mariadb:latest
docker run --name mariadb1 -e MYSQL_ROOT_PASSWORD=xxxx -p 3306:3306 -h mariadb1 -d --restart=always mariadb:latest

步驟2:
安裝 phpmyadmin1 如下:
先下載 image:docker pull phpmyadmin:latest
docker run --name phpmyadmin1 -e PMA_HOST=mariadb1 -p 8081:80 -h phpmyadmin1 -d --restart=always --link mariadb1 phpmyadmin/phpmyadmin:latest

**步驟3: **
安裝nextcloud 如下:
先下載 image:docker pull nextcloud:latest
docker run -d -p 80:80 nextcloud

**步驟4: **
安裝onlyoffice 如下:
因比較複雜用 docker-compose
將以下檔案存成 docker-compose.yml

version: '3'
services:

  onlyoffice-document-server:
    container_name: onlyoffice-document-server
    image: onlyoffice/documentserver:latest
    restart: always
    environment:
      - JWT_ENABLED=false
    expose:
      - '80'
      - '443'
    volumes:
      - document_data:/var/www/onlyoffice/Data
      - document_log:/var/log/onlyoffice
      - ./default.json:/etc/onlyoffice/documentserver/default.json
volumes:
  document_data:
  document_log:
  app_data:
  mysql_data:

以下是 default.json 請下載至 docker-compose.yml 同目錄

{
	"statsd": {
		"useMetrics": false,
		"host": "localhost",
		"port": "8125",
		"prefix": "ds."
	},
	"log": {
		"filePath": "",
		"options": {
			"replaceConsole": true
		}
	},
	"queue": {
		"type": "rabbitmq",
		"visibilityTimeout": 300,
		"retentionPeriod": 900
	},
	"storage": {
		"name": "storage-fs",
		"fs": {
			"folderPath": "",
			"urlExpires": 900,
			"secretString": "verysecretstring"
		},
		"region": "",
		"endpoint": "http://localhost/s3",
		"bucketName": "cache",
		"storageFolderName": "files",
		"urlExpires": 604800,
		"accessKeyId": "AKID",
		"secretAccessKey": "SECRET",
		"sslEnabled": false,
		"s3ForcePathStyle": true,
		"externalHost": ""
	},
	"rabbitmq": {
		"url": "amqp://guest:guest@localhost:5672",
		"socketOptions": {},
		"exchangepubsub": "ds.pubsub",
		"queueconverttask": "ds.converttask",
		"queueconvertresponse": "ds.convertresponse",
		"exchangeconvertdead": "ds.exchangeconvertdead",
		"queueconvertdead": "ds.convertdead",
		"queuedelayed": "ds.delayed"
	},
	"activemq": {
		"connectOptions": {
			"port": 5672,
			"host": "localhost",
			"name": "admin",
			"reconnect": false
		},
		"queueconverttask": "ds.converttask",
		"queueconvertresponse": "ds.convertresponse",
		"queueconvertdead": "ActiveMQ.DLQ",
		"queuedelayed": "ds.delayed",
		"topicpubsub": "ds.pubsub"
	},
	"dnscache": {
		"enable" : true,
		"ttl" : 300,
		"cachesize" : 1000
	},
	"openpgpjs": {
		"config": {
		},
		"encrypt": {
			"passwords": ["verysecretstring"]
		},
		"decrypt": {
			"passwords": ["verysecretstring"]
		}
	},
	"wopi": {
		"enable": false,
		"host" : "",
		"htmlTemplate" : "../../web-apps/apps/api/wopi",
		"wopiZone" : "external-http",
		"favIconUrlWord" : "/web-apps/apps/documenteditor/main/resources/img/favicon.ico",
		"favIconUrlCell" : "/web-apps/apps/spreadsheeteditor/main/resources/img/favicon.ico",
		"favIconUrlSlide" : "/web-apps/apps/presentationeditor/main/resources/img/favicon.ico",
		"fileInfoBlockList" : ["FileUrl"],
		"wordView": ["pdf", "djvu", "xps", "oxps", "doc", "dotx", "dotm", "dot", "fodt", "ott", "rtf", "mht", "html", "htm", "xml", "epub", "fb2"],
		"wordEdit": ["docx", "docm", "docxf", "oform", "odt", "txt"],
		"cellView": ["xls", "xlsb", "xltx", "xltm", "xlt", "fods", "ots"],
		"cellEdit": ["xlsx", "xlsm", "ods", "csv"],
		"slideView": ["ppt", "ppsx", "ppsm", "pps", "potx", "potm", "pot", "fodp", "otp"],
		"slideEdit": ["pptx", "pptm", "odp"],
		"publicKey": "要用自已的key",
		"modulus": "要用自已的key",
		"exponent": "AQAB",
		"privateKey": "要用自已的key",
		"exponentOld": "AQAB",
		"privateKeyOld": "要用自已的key",
		"refreshLockInterval": "10m"
	},
	"services": {
		"CoAuthoring": {
			"server": {
				"port": 8000,
				"workerpercpu": 1,
				"mode": "development",
				"limits_tempfile_upload": 104857600,
				"limits_image_size": 26214400,
				"limits_image_download_timeout": {
					"connectionAndInactivity": "2m",
					"wholeCycle": "2m"
				},
				"callbackRequestTimeout": {
					"connectionAndInactivity": "10m",
					"wholeCycle": "10m"
				},
				"healthcheckfilepath": "../public/healthcheck.docx",
				"savetimeoutdelay": 5000,
				"edit_singleton": false,
				"forgottenfiles": "forgotten",
				"forgottenfilesname": "output",
				"maxRequestChanges": 20000,
				"openProtectedFile": true,
				"editorDataStorage": "editorDataMemory",
				"assemblyFormatAsOrigin": true,
				"newFileTemplate" : "../../document-templates/new",
				"downloadFileAllowExt": ["pdf"],
				"tokenRequiredParams": true
			},
			"requestDefaults": {
				"headers": {
					"User-Agent": "Node.js/6.13",
					"Connection": "Keep-Alive"
				},
				"gzip": true,
				"rejectUnauthorized": true
			},
			"autoAssembly": {
				"enable": false,
				"interval": "5m",
				"step": "1m"
			},
			"utils": {
				"utils_common_fontdir": "null",
				"utils_fonts_search_patterns": "*.ttf;*.ttc;*.otf",
				"limits_image_types_upload": "jpg;jpeg;jpe;png;gif;bmp"
			},
			"sql": {
				"type": "postgres",
				"tableChanges": "doc_changes",
				"tableResult": "task_result",
				"dbHost": "localhost",
				"dbPort": 5432,
				"dbName": "onlyoffice",
				"dbUser": "onlyoffice",
				"dbPass": "onlyoffice",
				"charset": "utf8",
				"connectionlimit": 10,
				"max_allowed_packet": 1048575,
				"pgPoolExtraOptions": {}
			},
			"redis": {
				"name": "redis",
				"prefix": "ds:",
				"host": "localhost",
				"port": 6379,
				"options": {}
			},
			"pubsub": {
				"maxChanges": 1000
			},
			"expire": {
				"saveLock": 60,
				"presence": 300,
				"locks": 604800,
				"changeindex": 86400,
				"lockDoc": 30,
				"message": 86400,
				"lastsave": 604800,
				"forcesave": 604800,
				"saved": 3600,
				"documentsCron": "0 */2 * * * *",
				"files": 86400,
				"filesCron": "00 00 */1 * * *",
				"filesremovedatonce": 100,
				"sessionidle": "0",
				"sessionabsolute": "30d",
				"sessionclosecommand": "2m",
				"pemStdTTL": "1h",
				"pemCheckPeriod": "10m",
				"updateVersionStatus": "5m",
				"monthUniqueUsers": "1y"
			},
			"ipfilter": {
				"rules": [{"address": "*", "allowed": true}],
				"useforrequest": false,
				"errorcode": 403
			},
			"request-filtering-agent" : {
				"allowPrivateIPAddress": true,
				"allowMetaIPAddress": true
			},
			"secret": {
				"browser": {"string": "secret", "file": "", "tenants": {}},
				"inbox": {"string": "secret", "file": "", "tenants": {}},
				"outbox": {"string": "secret", "file": ""},
				"session": {"string": "secret", "file": ""}
			},
			"token": {
				"enable": {
					"browser": false,
					"request": {
						"inbox": false,
						"outbox": false
					}
				},
				"browser": {
					"secretFromInbox": true
				},
				"inbox": {
					"header": "Authorization",
					"prefix": "Bearer ",
					"inBody": false
				},
				"outbox": {
					"header": "Authorization",
					"prefix": "Bearer ",
					"algorithm": "HS256",
					"expires": "5m",
					"inBody": false,
					"urlExclusionRegex": ""
				},
				"session": {
					"algorithm": "HS256",
					"expires": "30d"
				},
				"verifyOptions": {
					"clockTolerance": 60
				}
			},
			"plugins": {
				"uri": "/sdkjs-plugins",
				"autostart": []
			},
			"themes": {
				"uri": "/web-apps/apps/common/main/resources/themes"
			},
			"editor":{
				"spellcheckerUrl": "",
				"reconnection":{
					"attempts": 50,
					"delay": "2s"
				},
				"websocketMaxPayloadSize": "1.5MB"
			},
			"sockjs": {
				"sockjs_url": "",
				"websocket": true
			},
			"callbackBackoffOptions": {
				"retries": 0,
				"timeout":{
					"factor": 2,
					"minTimeout": 1000,
					"maxTimeout": 2147483647,
					"randomize": false
				},
				"httpStatus": "429,500-599"
			}
		}
	},
	"license" : {
		"license_file": "",
		"warning_limit_percents": 70,
		"packageType": 0
	},
	"FileConverter": {
		"converter": {
			"maxDownloadBytes": 104857600,
			"downloadTimeout": {
				"connectionAndInactivity": "2m",
				"wholeCycle": "2m"
			},
			"downloadAttemptMaxCount": 3,
			"downloadAttemptDelay": 1000,
			"maxprocesscount": 1,
			"fontDir": "null",
			"presentationThemesDir": "null",
			"x2tPath": "null",
			"docbuilderPath": "null",
			"docbuilderAllFontsPath": "null",
			"docbuilderCoreFontsPath": "",
			"args": "",
			"spawnOptions": {},
			"errorfiles": "",
			"streamWriterBufferSize": 8388608,
			"maxRedeliveredCount": 2,
			"inputLimits": [
				{
				"type": "docx;dotx;docm;dotm",
				"zip": {
					"uncompressed": "50MB",
					"template": "*.xml"
				}
				},
				{
				"type": "xlsx;xltx;xlsm;xltm",
				"zip": {
					"uncompressed": "300MB",
					"template": "*.xml"
				}
				},
				{
				"type": "pptx;ppsx;potx;pptm;ppsm;potm",
				"zip": {
					"uncompressed": "50MB",
					"template": "*.xml"
				}
				}
			]
		}
	}
}

主要是多一行 - ./default.json:/etc/onlyoffice/documentserver/default.json

到該目錄執行:

docker-compose up -d

在nextcloud 的應用程式(右上點選下拉點選+應用程式)
https://ithelp.ithome.com.tw/upload/images/20220912/20136076XxzG1phHP2.jpg

步驟5:
安裝 Nextcloud Office 如下:
在nextcloud 的應用程式(右上點選下拉點選+應用程式)
https://ithelp.ithome.com.tw/upload/images/20220912/20136076ZPbiFKVYI9.jpg
啟動成功安裝畫面:
https://ithelp.ithome.com.tw/upload/images/20220912/20136076pPuorua4Xu.jpg

因為是雲端都是用網址方式連線,我是用 portainer 去設定,我都會自行設定 port 以免衝突 如下:
以下範例採用 local 方式,更好要採用ssl
https://ithelp.ithome.com.tw/upload/images/20220912/20136076KZ63tD51aO.jpg
ssl目前仍在測試所以無法在此說明


上一篇
RFID一體成形
下一篇
用 Node Red 設計登入系統
系列文
地圖物聯32
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 則留言

0
shooding
iT邦新手 5 級 ‧ 2022-12-21 10:53:45

Onlyoffice剛推出的7.2版已經有繁體中文囉

大感謝

0
chang0206
iT邦新手 1 級 ‧ 2023-03-06 09:07:28

內建的 nextcloud office 在處理中文一直都有問題,有的文章說自行安裝中文字型可以解決,但是docker 版本要安裝自行,需要修改一個路徑,可是我在官方image 裡面找不到這個檔案
在github 上面有類似的 issue 討論,結論是要換一個非官方的 image

建議是採用 onlyoffice 出的 docker ,雖然在docker 起來之後,還有一些後續的步驟,但是可以支援中文,光這點就打死 nextcloud office 了

感謝您的告知,太高興了

我要留言

立即登入留言