为知笔记【https://www.wiz.cn/zh-cn】,之前一直是只能连接官方的笔记服务器的;
虽然,提供了为知盒子的产品,但是对于个人用户而言,还是相当贵的;
不过好消息是,最近为知笔记开放了私有部署的Docker镜像,并且5个用户以下的用量,没有时间限制,永久免费。

这让对数据比较敏感的一些用户感到大快人心。

为知笔记官方发布了私有部署Docker的详细文档:
https://www.wiz.cn/zh-cn/docker
https://www.wiz.cn/zh-cn/enterprise-private-cloud.html

不过,对于这么良心的笔记服务商来说,如果有条件购买的话,还是可以支持以下他们的【为知盒子】:
https://www.wiz.cn/zh-cn/wizbox-introduce


下面,开始按照官方文档,在本地搭建一个为知笔记的私有服务端吧。

环境要求是这样的:

内存:8G 以上
操作系统:MAC / MS Windows / Linux 都可以
软件需求:Docker

在我的环境中:
OS:CentOS 7
内存:8G


安装Docker:Install Docker on CentOS 7

配置YUM的清华大学源:

[root@WizNoteServer ~]# vi /etc/yum.repos.d/tsinghua.repo
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/tsinghua.repo 
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# sed -i '/gpgcheck/s/1/0/g' /etc/yum.repos.d/tsinghua.repo             
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# cat /etc/yum.repos.d/tsinghua.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-7 - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-7 - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-7 - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos,
              : subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base                                          | 3.6 kB     00:00     
extras                                        | 2.9 kB     00:00     
updates                                       | 2.9 kB     00:00     
(1/4): updates/x86_64/primary_db                | 1.1 MB   00:00     
(2/4): extras/x86_64/primary_db                 | 152 kB   00:11     
(3/4): base/x86_64/group_gz                     | 165 kB   00:12     
(4/4): base/x86_64/primary_db                   | 6.0 MB   00:13     
repo id                      repo name                         status
base/x86_64                  CentOS-7 - Base                   10,097
extras/x86_64                CentOS-7 - Extras                    304
updates/x86_64               CentOS-7 - Updates                   311
repolist: 10,712
[root@WizNoteServer ~]# 

安装需要的系统RPM包:

[root@WizNoteServer ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
Loaded plugins: langpacks, product-id, search-disabled-repos,
              : subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Package yum-utils-1.1.31-52.el7.noarch already installed and latest version
Package device-mapper-persistent-data-0.8.5-1.el7.x86_64 already installed and latest version
Package 7:lvm2-2.02.185-2.el7.x86_64 already installed and latest version
Nothing to do
[root@WizNoteServer ~]# 

添加Docker的YUM源信息:

[root@WizNoteServer ~]# ls -ltr /etc/yum.repos.d/
total 8
-rw-r--r--. 1 root root  358 Sep 26 23:13 redhat.repo
-rw-r--r--. 1 root root 1538 Sep 26 23:20 tsinghua.repo
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# ls -ltr /etc/yum.repos.d/
total 12
-rw-r--r--. 1 root root 2640 Sep 25 16:16 docker-ce.repo
-rw-r--r--. 1 root root  358 Sep 26 23:13 redhat.repo
-rw-r--r--. 1 root root 1538 Sep 26 23:20 tsinghua.repo
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# cat /etc/yum.repos.d/docker-ce.repo 
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-edge]
name=Docker CE Edge - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-edge-debuginfo]
name=Docker CE Edge - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-edge-source]
name=Docker CE Edge - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos,
              : subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
docker-ce-stable                              | 3.5 kB     00:00     
(1/2): docker-ce-stable/x86_64/primary_db       |  34 kB   00:00     
(2/2): docker-ce-stable/x86_64/updateinfo       |   55 B   00:00     
repo id                       repo name                        status
base/x86_64                   CentOS-7 - Base                  10,097
docker-ce-stable/x86_64       Docker CE Stable - x86_64            56
extras/x86_64                 CentOS-7 - Extras                   304
updates/x86_64                CentOS-7 - Updates                  311
repolist: 10,768
[root@WizNoteServer ~]# 

刷新YUM缓存:

[root@WizNoteServer ~]# yum makecache
Loaded plugins: langpacks, product-id, search-disabled-repos,
              : subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base                                          | 3.6 kB     00:00     
docker-ce-stable                              | 3.5 kB     00:00     
extras                                        | 2.9 kB     00:00     
updates                                       | 2.9 kB     00:00     
(1/8): docker-ce-stable/x86_64/filelists_db     |  16 kB   00:00     
(2/8): docker-ce-stable/x86_64/other_db         | 113 kB   00:00     
(3/8): extras/x86_64/filelists_db               | 207 kB   00:00     
(4/8): updates/x86_64/other_db                  | 120 kB   00:00     
(5/8): base/x86_64/other_db                     | 2.6 MB   00:01     
(6/8): updates/x86_64/filelists_db              | 1.0 MB   00:00     
(7/8): extras/x86_64/other_db                   | 100 kB   00:00     
(8/8): base/x86_64/filelists_db                 | 7.3 MB   00:02     
Metadata Cache Created
[root@WizNoteServer ~]# 

安装Docker-CE:

[root@WizNoteServer ~]# yum list | grep ^docker-ce
docker-ce.x86_64                        3:19.03.2-3.el7            docker-ce-stable
docker-ce-cli.x86_64                    1:19.03.2-3.el7            docker-ce-stable
docker-ce-selinux.noarch                17.03.3.ce-1.el7           docker-ce-stable
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# yum install -y docker-ce
Loaded plugins: langpacks, product-id, search-disabled-repos,
              : subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:19.03.2-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-19.03.2-3.el7.x86_64
--> Processing Dependency: containerd.io >= 1.2.2-3 for package: 3:docker-ce-19.03.2-3.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-19.03.2-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.107-3.el7 will be installed
---> Package containerd.io.x86_64 0:1.2.6-3.3.el7 will be installed
---> Package docker-ce-cli.x86_64 1:19.03.2-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================
 Package            Arch    Version          Repository         Size
=====================================================================
Installing:
 docker-ce          x86_64  3:19.03.2-3.el7  docker-ce-stable   24 M
Installing for dependencies:
 container-selinux  noarch  2:2.107-3.el7    extras             39 k
 containerd.io      x86_64  1.2.6-3.3.el7    docker-ce-stable   26 M
 docker-ce-cli      x86_64  1:19.03.2-3.el7  docker-ce-stable   39 M

Transaction Summary
=====================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 90 M
Installed size: 368 M
Downloading packages:
(1/4): container-selinux-2.107-3.el7.noarch.rpm |  39 kB   00:03     
warning: /var/cache/yum/x86_64/7Server/docker-ce-stable/packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for containerd.io-1.2.6-3.3.el7.x86_64.rpm is not installed
(2/4): containerd.io-1.2.6-3.3.el7.x86_64.rpm   |  26 MB   00:05     
(3/4): docker-ce-19.03.2-3.el7.x86_64.rpm       |  24 MB   00:05     
(4/4): docker-ce-cli-19.03.2-3.el7.x86_64.rpm   |  39 MB   00:04     
---------------------------------------------------------------------
Total                                   9.5 MB/s |  90 MB  00:09     
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:container-selinux-2.107-3.el7.noarch            1/4 
  Installing : containerd.io-1.2.6-3.3.el7.x86_64                2/4 
  Installing : 1:docker-ce-cli-19.03.2-3.el7.x86_64              3/4 
  Installing : 3:docker-ce-19.03.2-3.el7.x86_64                  4/4 
  Verifying  : 3:docker-ce-19.03.2-3.el7.x86_64                  1/4 
  Verifying  : 2:container-selinux-2.107-3.el7.noarch            2/4 
  Verifying  : containerd.io-1.2.6-3.3.el7.x86_64                3/4 
  Verifying  : 1:docker-ce-cli-19.03.2-3.el7.x86_64              4/4 

Installed:
  docker-ce.x86_64 3:19.03.2-3.el7                                   

Dependency Installed:
  container-selinux.noarch 2:2.107-3.el7                             
  containerd.io.x86_64 0:1.2.6-3.3.el7                               
  docker-ce-cli.x86_64 1:19.03.2-3.el7                               

Complete!
[root@WizNoteServer ~]# 

查看一下:

[root@WizNoteServer ~]# docker version
Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:28:55 2019
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@WizNoteServer ~]# 

这样,Docker-CE就安装好了。


启动Docker服务:

[root@WizNoteServer ~]# service docker status
Redirecting to /bin/systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: https://docs.docker.com
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# service docker start
Redirecting to /bin/systemctl start docker.service
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# service docker status
Redirecting to /bin/systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-09-26 23:38:24 CST; 6s ago
     Docs: https://docs.docker.com
 Main PID: 51529 (dockerd)
    Tasks: 8
   Memory: 39.9M
   CGroup: /system.slice/docker.service
           └─51529 /usr/bin/dockerd -H fd:// --containerd=/run/con...

Sep 26 23:38:23 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:23 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:23 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:23 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:23 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:24 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:24 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:24 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:24 WizNoteServer dockerd[51529]: time="2019-09-26T23:...
Sep 26 23:38:24 WizNoteServer systemd[1]: Started Docker Applicati...
Hint: Some lines were ellipsized, use -l to show in full.
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# chkconfig docker on
Note: Forwarding request to 'systemctl enable docker.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@WizNoteServer ~]# 

Docker的【Hello World】

[root@WizNoteServer ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:b8ba256769a0ac28dd126d584e0a2011cd2877f3f76e093a7ae560f2a5301c00
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

[root@WizNoteServer ~]# 

至此,Docker的安装就完成了。


安装【为知笔记】Docker服务端:

准备存储的挂载点:

[root@WizNoteServer ~]# ls -ltr /dev/sd*
brw-rw----. 1 root disk 8, 16 Sep 26 23:48 /dev/sdb
brw-rw----. 1 root disk 8,  0 Sep 26 23:48 /dev/sda
brw-rw----. 1 root disk 8,  2 Sep 26 23:48 /dev/sda2
brw-rw----. 1 root disk 8,  1 Sep 26 23:48 /dev/sda1
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/sda2  rhel lvm2 a--  <19.00g    0 
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# vgcreate vg_wiz_data /dev/sdb
  Volume group "vg_wiz_data" successfully created
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# vgs
  VG          #PV #LV #SN Attr   VSize   VFree  
  rhel          1   2   0 wz--n- <19.00g      0 
  vg_wiz_data   1   0   0 wz--n- <20.00g <20.00g
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root rhel -wi-ao---- <17.00g                                                    
  swap rhel -wi-ao----   2.00g                                                    
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# lvcreate -L 19G -n lv_wiz_data vg_wiz_data
  Logical volume "lv_wiz_data" created.
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# lvs
  LV          VG          Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root        rhel        -wi-ao---- <17.00g                                                    
  swap        rhel        -wi-ao----   2.00g                                                    
  lv_wiz_data vg_wiz_data -wi-a-----  19.00g                                                    
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# mkfs.ext4 /dev/vg_wiz_data/lv_wiz_data 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)

(过多的输出,...)

First data block=0
Maximum filesystem blocks=2153775104
152 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done   

[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# mkdir /data_wiz_note
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# vi /etc/fstab 
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# cat /etc/fstab | tail -n 3

# adamhuan / wiz note data
/dev/vg_wiz_data/lv_wiz_data    /data_wiz_note  ext4    defaults    0
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               2.0G     0  2.0G   0% /dev
tmpfs                  2.0G     0  2.0G   0% /dev/shm
tmpfs                  2.0G   13M  2.0G   1% /run
tmpfs                  2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/rhel-root   17G  4.4G   13G  26% /
/dev/sda1             1014M  169M  846M  17% /boot
tmpfs                  394M  8.0K  394M   1% /run/user/42
tmpfs                  394M     0  394M   0% /run/user/0
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# mount -a
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                             2.0G     0  2.0G   0% /dev
tmpfs                                2.0G     0  2.0G   0% /dev/shm
tmpfs                                2.0G   13M  2.0G   1% /run
tmpfs                                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/rhel-root                 17G  4.4G   13G  26% /
/dev/sda1                           1014M  169M  846M  17% /boot
tmpfs                                394M  8.0K  394M   1% /run/user/42
tmpfs                                394M     0  394M   0% /run/user/0
/dev/mapper/vg_wiz_data-lv_wiz_data   19G   45M   18G   1% /data_wiz_note
[root@WizNoteServer ~]# 

然后,下载并启动为知笔记服务:

[root@WizNoteServer ~]# docker run --name wiz -it -d -v /data_wiz_note:/wiz/storage -v /etc/localtime:/etc/localtime -p 80:80 -e SEARCH=true wiznote/wizserver

(过多的输出,...)
Docker的命令运行时的截图

等待下载完成,这段时间有可能很长,看不同的网络情况而定。

不过默认情况下,Docker会从国外的【https://hub.docker.com】上面拉取镜像,这样子非常慢;
你可以设置国内镜像地址,以加速下载;
具体操作方式如下:

[root@WizNoteServer ~]# ls -ltr /etc/docker/
total 4
drwxr-xr-x. 6 root root 113 Sep 26 22:25 certs.d
-rw-------. 1 root root 244 Sep 26 23:38 key.json
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# vi /etc/docker/daemon.json
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# ls -ltr /etc/docker/
total 8
drwxr-xr-x. 6 root root 113 Sep 26 22:25 certs.d
-rw-------. 1 root root 244 Sep 26 23:38 key.json
-rw-r--r--. 1 root root 212 Sep 27 00:26 daemon.json
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# cat /etc/docker/daemon.json 
{
    "registry-mirrors": [
        "https://1nj0zren.mirror.aliyuncs.com",
        "https://docker.mirrors.ustc.edu.cn",
        "http://f1361db2.m.daocloud.io",
        "https://registry.docker-cn.com"
    ]
}
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# systemctl daemon-reload
[root@WizNoteServer ~]# systemctl restart docker
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# systemctl status docker 
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-09-27 00:27:25 CST; 12s ago
     Docs: https://docs.docker.com
 Main PID: 2925 (dockerd)
    Tasks: 8
   Memory: 43.9M
   CGroup: /system.slice/docker.service
           └─2925 /usr/bin/dockerd -H fd:// --containerd=/run/cont...

Sep 27 00:27:24 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:24 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:24 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:24 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:25 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:25 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:25 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:25 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:25 WizNoteServer dockerd[2925]: time="2019-09-27T00:2...
Sep 27 00:27:25 WizNoteServer systemd[1]: Started Docker Applicati...
Hint: Some lines were ellipsized, use -l to show in full.
[root@WizNoteServer ~]# 

当上面的操作完成后,来看看系统的变化:

[root@WizNoteServer ~]# ls -ltr /data_wiz_note/
total 0
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# docker run --name wiz -it -d -v /data_wiz_note:/wiz/storage -v /etc/localtime:/etc/localtime -p 80:80 -e SEARCH=true wiznote/wizserver
Unable to find image 'wiznote/wizserver:latest' locally
latest: Pulling from wiznote/wizserver
d8d02d457314: Pull complete 
44590fb44a39: Pull complete 
7886b9352df3: Pull complete 
1f600e1dd2c3: Pull complete 
Digest: sha256:9a95c51a2cd8a70f42897bb0edd2acd727e2832cc0a2cc75d5992dbd130f4a7e
Status: Downloaded newer image for wiznote/wizserver:latest
8fbd045503f715e1caaa45142002e88f4226557370811e1d74c3d98a052e96ff
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# ls -ltr /data_wiz_note/                      total 12
drwxr-xr-x.  3 root     root     4096 Sep 27 00:30 logs
drwxr-xr-x.  2 adamhuan adamhuan 4096 Sep 27 00:30 index
drwxr-xr-x. 11       27       27 4096 Sep 27 00:30 db
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# du -sh /data_wiz_note/
216M    /data_wiz_note/
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                NAMES
8fbd045503f7        wiznote/wizserver   "/wiz/app/entrypoint…"   About a minute ago   Up About a minute   0.0.0.0:80->80/tcp   wiz
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# netstat -tupln | grep 80
tcp6       0      0 :::80                   :::*                    LISTEN      3154/docker-proxy   
[root@WizNoteServer ~]# 

访问一下这台服务器:
http://192.168.72.138/

可以看到,确实从私有服务器访问到了。

然后,你可以通过【注册】,在私有的为知笔记服务器上,创建自己的账户:
限制是:免费试用,用户数需要在【5】个以内;


修改【为知笔记】的时区:

[root@WizNoteServer ~]# date
Fri Sep 27 00:37:41 CST 2019
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# date -R
Fri, 27 Sep 2019 00:37:45 +0800
[root@WizNoteServer ~]# 
[root@WizNoteServer ~]# docker exec -it wiz /bin/bash
[root@8fbd045503f7 /]# 
[root@8fbd045503f7 /]# hostname
8fbd045503f7
[root@8fbd045503f7 /]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
cp: overwrite '/etc/localtime'? y
[root@8fbd045503f7 /]# 
[root@8fbd045503f7 /]# date -R
Fri, 27 Sep 2019 00:38:17 +0800
[root@8fbd045503f7 /]# 
[root@8fbd045503f7 /]# exit
exit
[root@WizNoteServer ~]# 

至此,私有Docker部署为知笔记服务器,就完成了。

说点什么

avatar

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

  Subscribe  
提醒
隐藏
变装