centos8.5 installation docker
- Install
yum install -y docker
- Check whether Docker is installed successfully
yum list installed | grep docker
- Set up auto-start at power on
systemctl enable docker
- start up
systemctl start docker
- View version
docker -v
docker install onlyoffice
- To pull the image pull OnlyOffice, it is recommended to specify the version number. Other versions may encounter problems in the project.
sudo docker pull onlyoffice/documentserver:7.3
- run
Map port 9000 of the local machine to port 80 of docker. Access through the server ip: 9000, and use -v to mount the local machine ==/home/onlyOffice== folder to docker’s /var/www /onlyoffice/documentserver/web-apps/wsData file, and then read the corresponding folder directly through http request. JWT_SECRET
Fill in the key you defined, and set JWT_ENABLED
to true to enable token verification.
Method 1: Specify the key and open the token
docker run -i -t -d -p 9000:80 -v /home/myOnlyOffice:/var/www/onlyoffice/documentserver/web-apps/wsData --env JWT_SECRET=VI71S3cGtXg96HgFWzQhblz1KwMc1Jzk -e JWT_ENABLED=true onlyoffice/ documentserver:7.3
Method two:
docker run -i -t -d -p 9000:80 -v /home/myOnlyOffice:/var/www/onlyoffice/documentserver/web-apps/wsData onlyoffice/documentserver:7.3
Method 1 is recommended. Method 2 may cause the configuration file to be reset after restarting the service, resulting in the inability to set the secret key.
- Test OnlyOffice service
Access URL: http://172.17.0.1:9000/example/. It needs to be accessed by IP plus port. It cannot be accessed by localhost.
- Execute the following command
According to the prompts on the http://172.17.0.1:9000 page, execute the following command
sudo docker exec 856d790c064b sudo supervisorctl start ds:example
sudo docker exec 856d790c064b sudo sed 's,autostart=false,autostart=true,' -i /etc/supervisor/conf.d/ds-example.conf
- If it prompts that the document cannot be saved, close the firewall, restart docker, and then start onlyoffice.
- If it prompts that the security token is incorrect, use the following command to check whether the secret key is configured:
sudo docker exec 856d790c064b /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string'
The key will be displayed if configured.
- Check OnlyOffice version number
Reference documentation:
Docker installation practice (super simple) + install OnlyOffice_onlyoffice docker-CSDN blog
Linux installation natapp mapping tool
Install a virtual machine on your local computer and install centos on the virtual machine. Since the local computer cannot connect to the network cable for the time being and can only connect to wifi, I have tried various network adapter connection methods, but the local computer cannot connect to Linux on the virtual machine (the local computer and Linux on the virtual machine are not in the same network segment), but the virtual machine Linux on the machine can ping the local computer and external network IP, so the natapp external network mapping tool is used as an intermediate bridge to connect the local computer to the IP and port on the virtual machine to test onlyOffice. The deployment process of natapp is as follows:
- Register natapp and configure ip and port;
- Download the Linux version of the client on the official website NATAPP-Intranet Penetration, a domestic high-speed intranet mapping tool based on ngrok, and place the client file (natapp) in the /download directory;
- Grant executable permissions to the client file: chmod u + x natapp;
- Execute the command to start the client: ./natapp -authtoken=XXXX
- After startup, the console will display the generated external network address. By accessing this address through the external network, you can access the Linux IP and configured port.
Start: Execute in /download directory: ./natapp -authtoken=32f063241bc276d1
Install fonts and modify font sizes
Install fonts:
- Prepare font files
- Copy the fonts you want to install in the c:\windows\fonts folder, such as “Imitation Song Regular”
- Paste into the newly created “Fake Song Regular” folder
- Create fonts using FontCreator software
Click File->Open to open the font file (ttf format, if it is ttc format, follow the software prompts and click Next to convert the file to ttf format and then repeat this step to open the corresponding ttf file), click Font->Properties, and modify FontFamily is the font name, click OK;
Click File->Export Font as->Export Desktop Font(ttf/otf) to save the font file in ttf format. The export file is as shown below:
- Use Xftp to upload the fonts folder storing the exported fonts to the “/home/fonts” directory
- Enter the OnlyOffice container
docker exec -it 856d790c064b /bin/bash
- Delete the original fonts under the container. Note: Do not perform this step if you do not need to delete the original fonts.
cd /usr/share/fonts/ rm -rf * cd /var/www/onlyoffice/documentserver/core-fonts/ rm -rf *
- exit container
exit
- Copy the fonts outside the container into the container. Note: the folder must be “fonts” and the “fonts folder under the container needs to be overwritten.
sudo docker cp /home/fonts 856d790c064b:/usr/share
- Enter the container
docker exec -it 856d790c064b /bin/bash
- Execute the following command to update the AllFonts.js file
cd /usr/bin ./documentserver-generate-allfonts.sh
- Clear your browser cache to see installed fonts
Modify font size:
- Copy app.js in the container to the root directory
docker cp 856d790c064b:/var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/main/app.js ./
- Use Xftp to transfer to the local and open it. Copy the following content to the front of {value:8,displayValue:”8″}, a total of 3 places:
{value:42,displayValue:"No.1"},{value:36,displayValue:"Xiaochu"},{value:26,displayValue:"No.1"},{value :24,displayValue:"小一"},{value:22,displayValue:"二号"},{value:18,displayValue:"小二"},{value:16,displayValue: "No. 3"},{value:15,displayValue:"小三"},{value:14,displayValue:"No. 4"},{value:12,displayValue:"小四" },{value:10.5,displayValue:"No. 5"},{value:9,displayValue:"No. 5"},{value:7.5,displayValue:"No. 6"},{value: 6.5,displayValue:"小六"},{value:5.5,displayValue:"No. 7"},{value:5,displayValue:"No. 8"},
- Overwrite the modified app.js file into the container:
docker cp /app.js 856d790c064b:/var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/main/app.js
- Restart container
docker restart 856d790c064b
- You can see the installed font size after clearing your browser cache.
FAQ:
Problem: When opening a file after starting the project, it prompts that token is not correctly
deal with:
If no custom key is added during the onlyoffice service establishment process, a random key will be automatically generated. To get the default key, run the following command:
sudo docker exec 856d790c064b /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string'
Set the obtained key to the application.properties file in the project: files.docservice.secret=6JLcrUAHV8SSMsk6fTG5iH0HwfMx8iau1
When opening a file after starting the project, it prompts that the file cannot be saved. Please check the connection or contact the administrator
Solution: After starting the project, do not use 127.0.0.1 or localhost when accessing the project. Instead, use the IP address to access such as: http://172.16.1.111:9001
Other questions
If you need to reset the key, follow the following tutorial:
Copy the configuration file to the settings directory
sudo docker cp 856d790c064b:/etc/onlyoffice/documentserver/local.json /home/myOnlyOffice
After modifying the configuration file, overwrite it to the document directory
sudo docker cp /home/myOnlyOffice/local.json 856d790c064b:/etc/onlyoffice/documentserver/
Enter the container
docker exec -it 856d790c064b /bin/bash
View configuration file
cat /etc/onlyoffice/documentserver/local.json
Set up a key (JWT token) for OnlyOffice – ROYWANG
Windows kill port
Check the process number corresponding to the port number:
netstat -ano | findstr 8080
Kill the process:
taskkill /f /pid 28808
springboot integrates OnlyOffice
project address:
https://gitee.com/yinqi2030/JavaSpringOnlyOffice.git
The parameters that need to be configured in the JavaSpringOnlyOffice\src\main\resources\application.properties file are as follows:
files.storage=E:\yqfiles
server.port=9001
files.docservice.url.site=http://xabs7i.natappfree.cc/ #onlyoffice service address
files.docservice.secret=6JLcrUAHV8SSMsk6fTG5iH0HwfMx8iau #secretKey
Start the project access: http://ip:9001/ to operate the online documents
VUE component encapsulation method calls onlyoffice service
Vue3 scaffolding construction and operation process
- Install nodejs
- Install Taobao image: npm config set registry https://registry.npm.taobao.org
- If you have installed 2.0 scaffolding before, you need to uninstall it. Run npm uninstall vue-cli -g on the console to uninstall globally.
- Execute the command npm install @vue/cli -g to download the scaffolding of vue3
- Execute vue create your project name (note no capital letters)
- Execute the command in the project path to install dependencies: npm install
- Start the project: npm run serve
- If an error is reported during startup, ERROR Error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree. Then upgrade vue to the latest available version in the project path: npm i [email protected]
- Restart the project: npm run serve
Run the onlyoffice official case for integrating VUE
- Clone the project from the GitHub repository: git clone GitHub – ONLYOFFICE/document-editor-vue: Vue component for ONLYOFFICE Document Server
- Change the address of the document server in the config/default.json file: “documentServerUrl”: “http://documentserver/”;
- Install react: npm i react react-dom -D
- Generate Storybook using the following command: npm run build-storybook
- Start Storybook: npm run storybook
- Visit the project: http://localhost:6006/
FAQ
Please refer to the following two materials
https://www.cnblogs.com/WangJianqiu/p/17373887.html
Error when starting vue vue (>=3.2.13) or @vue/compiler-sfc_lijun_xiao2009’s blog-CSDN blog
Docker installation of OnlyOffice in Win10 system
Install docker
- To install docker on win10, the prerequisite is to install WSL2.
Docker Desktop now runs using WSL 2 by default instead of the previous Hyper-V.
The full name of WSL2 is Windows Subsystem on Linux. This means that in win10, you can directly start a Linux. Because docker relies on the Linux kernel.
- Download the Linux kernel update package
WSL2 Linux kernel update package for x64 machines
Click to download the latest update package. After downloading, double-click to run the installation.
- Open the system virtual machine platform and WSL
Control Panel->Programs->Turn Windows features on or off
Check these two. If prompted to restart the computer, do so.
- Run Windows PowerShell as administrator to set WSL2 as the default version
wsl --set-default-version 2
- Go to the docker official website to download the desktop version of docker. After downloading, just double-click to run the installation.
Docker: Accelerated, Containerized Application Development
- Open Docker Desktop
If the following error pops up after opening, update WSL
wsl --update
It starts normally after reopening.
- Configure domestic acceleration image
Click “settings–>Docker Engine”, add a comma in the outermost “{}”, and paste the following content into the braces
"registry-mirrors": [ "https://bd7n7e9w.mirror.aliyuncs.com", "http://docker.mirrors.ustc.edu.cn" ]
- View information
View version: docker version
View details: docker info
- Change data storage location
Windows version (Windows 10) WSL 2 version docker default program is installed to the c drive, and the data is stored in C:\Users\current user name\AppData\Local\Docker\wsl\data\ext4.vhdx This will cause docker usage to increase and the space on the C drive will increase. To solve this problem move the data part to other disk.
- Stop docker
Click the button below to exit
Close all distributions
wsl --shutdown
Open cmd window. Check the stop situation and see if the state is stop
wsl --list -v
- Back up and export existing data
wsl --export docker-desktop-data "E:\soft\dockerFile\docker-desktop-data.tar"
- Delete original data
wsl --unregister docker-desktop-data
- Import data to new disk
Create a directory to store docker data, such as the “E:\soft\dockerFile\data” directory
wsl --import docker-desktop-data "E:\soft\dockerFile\data" "E:\soft\dockerFile\docker-desktop-data.tar" -- version 2
- Restart docker
docker installs OnlyOffice
- To pull the image pull OnlyOffice, it is recommended to specify the version number. Other versions may encounter problems in the project.
docker pull onlyoffice/documentserver:7.3
- Run container
Specify secret and enable JET verification:
docker run -i -t -d -p 9800:80 --restart=always -e JWT_SECRET=VI71S3cGtXg96HgFWzQhblz1KwMc1Jzk -e JWT_ENABLED=true onlyoffice/documentserver:7.3
- Excuting an order
Open the web page http://IP:9800/ and execute the following two commands on the web page to install successfully.
The knowledge points of the article match the official knowledge files, and you can further learn relevant knowledge. Cloud native entry-level skills treeContainer (docker)Install docker17029 people are learning the system