ECS 7天实践训练营-基于ECS搭建个人Leanote云笔记本

创建资源和连接云服务器

之前写过,这次不写。

安装MongoDB

1.安装MongoDB。
yum -y install mongodb mongodb-server.x86_64 mariadb-devel.i686
代码解释:
yum -y依然是在线下载,后面接的是包名
之后代码显示如下:

Dependency Updated:
  e2fsprogs.x86_64 0:1.42.9-17.el7       e2fsprogs-libs.x86_64 0:1.42.9-17.el7   glibc.x86_64 0:2.17-307.el7.1
  glibc-common.x86_64 0:2.17-307.el7.1   krb5-libs.x86_64 0:1.15.1-46.el7        libcom_err.x86_64 0:1.42.9-17.el7
  libselinux.x86_64 0:2.5-15.el7         libselinux-python.x86_64 0:2.5-15.el7   libselinux-utils.x86_64 0:2.5-15.el7
  libss.x86_64 0:1.42.9-17.el7           mariadb-libs.x86_64 1:5.5.65-1.el7      nscd.x86_64 0:2.17-307.el7.1

Complete!

2.启动MongoDB服务。
systemctl start mongod
代码解释:
systemctl start作用是启动xx服务,这里接的是mongod,在之前的学习里有docker
3.查看MongoDB运行状态。
systemctl status mongod
代码解释:
systemctl status用来查询服务运行状态
之后代码显示如下:

● mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-09-24 20:11:03 CST; 2min 27s ago
  Process: 1642 ExecStart=/usr/bin/mongod $OPTIONS run (code=exited, status=0/SUCCESS)
 Main PID: 1644 (mongod)
   CGroup: /system.slice/mongod.service
           └─1644 /usr/bin/mongod --quiet -f /etc/mongod.conf run

Sep 24 20:11:03 iZuf66ogddyortq9vi8pvvZ systemd[1]: Starting High-performance, schema-free document-oriented database...
Sep 24 20:11:03 iZuf66ogddyortq9vi8pvvZ mongod[1642]: about to fork child process, waiting until server is ready ...ons.
Sep 24 20:11:03 iZuf66ogddyortq9vi8pvvZ mongod[1642]: forked process: 1644
Sep 24 20:11:03 iZuf66ogddyortq9vi8pvvZ systemd[1]: Started High-performance, schema-free document-oriented database.
Hint: Some lines were ellipsized, use -l to show in full.

安装Leanote

1.下载Leanote二进制安装包。
wget https://nchc.dl.sourceforge.net/project/leanote-bin/2.6.1/leanote-linux-amd64-v2.6.1.bin.tar.gz
之后代码显示如下:

--2020-09-24 20:16:19--  https://nchc.dl.sourceforge.net/project/leanote-bin/2.6.1/leanote-linux-amd64-v2.6.1.bin.tar.gz
Resolving nchc.dl.sourceforge.net (nchc.dl.sourceforge.net)... 140.110.96.69, 2001:e10:ffff:1f02::17
Connecting to nchc.dl.sourceforge.net (nchc.dl.sourceforge.net)|140.110.96.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21438265 (20M) [application/x-gzip]
Saving to: ‘leanote-linux-amd64-v2.6.1.bin.tar.gz’

100%[==============================================================================>] 21,438,265  5.28MB/s   in 4.9s

2020-09-24 20:16:24 (4.20 MB/s) - ‘leanote-linux-amd64-v2.6.1.bin.tar.gz’ saved [21438265/21438265]

2.解压安装包。
tar -zxvf leanote-linux-amd64-v2.6.1.bin.tar.gz
代码解释:
tar是Unix和类Unix系统上的压缩打包工具,可以将多个文件合并为一个文件,打包后的文件后缀亦为“tar”。
tar -zxvf file.tar.gz 用来解压 tar.gz
3.编辑文件leanote/conf/app.conf。

  1. 使用vim编辑器打开文件leanote/conf/app.conf。
    vim leanote/conf/app.conf
  2. 输入:/app.secret=并按下回车查找app.secret位置。
  3. 按下i键进入编辑模式,修改该项的值为任意字符串。
  4. 修改完成后,按下esc键退出编辑模式,输入:wq保存并退出。
    4.初始化数据库。

mongorestore -h localhost -d leanote --dir /root/leanote/mongodb_backup/leanote_install_data/
代码解释:
--dir 后面为解压后的leanote中的路径,可将其改为自己对应的路径
之后代码显示如下:

2020-09-24T20:36:34.736+0800 /root/leanote/mongodb_backup/leanote_install_data/group_users.bson
2020-09-24T20:36:34.736+0800    going into namespace [leanote.group_users]
1 objects found
2020-09-24T20:36:34.737+0800    Creating index: { key: { _id: 1 }, name: "_id_", ns: "leanote.group_users" }
2020-09-24T20:36:34.737+0800    Creating index: { key: { GroupId: 1 }, name: "GroupId_1", ns: "leanote.group_users", background: true }

5.启动服务。
nohup bash /root/leanote/bin/run.sh > /root/leanote/run.log 2>&1 &
6.访问云笔记。
在浏览器中访问http://公网地址>:9000
打开如下图所示:
ECS 7天实践训练营-基于ECS搭建个人Leanote云笔记本
登录成功后如下图所示:
ECS 7天实践训练营-基于ECS搭建个人Leanote云笔记本

上一篇:ECS 7天实践训练营-基于ECS实现SLB负载均衡


下一篇:ECS 7天实践训练营-基于ECS搭建Docker环境