序言
临近月末,开始补作业。
之前我在一台闲置的 VPS 上搭建了一个Wiki系统,方便记录零碎的东西,本来应该搭建完毕就写文章记录下来的,但是太忙了,只能记录关键步骤,现在来补上详细步骤。我的wiki系统可以访问 wiki.liangz.org 进行查看。
当然这个wiki系统是使用 TiddlyWiki 进行搭建的,不用一直携带一个很大的HTML文件,记录完毕就自动同步,没有保存就是下载一个新的wiki的缺点,在加上它是非线性的,随时记录零碎的知识。反正对我来说很好用,消耗的系统资源也不多。在wiki上记录零碎知识,然后整理到笔记软件中,或者整理成博客文章也是极好的。
由于我的VPS已经搭建并正在使用,因此,在本文中使用虚拟机 CentOS 7 进行操作。
TiddlyWiki
这个Wiki系统其实挺好的,以前还有一些缺点导致我放弃使用它,不过现在可以搭建成服务器来使用,这个缺点也消失了,我就在闲置的VPS上搭建使用。
安装node
首先,系统需要安装 node,需要先下载 Linux 版本的二进制包。
因为我的虚拟机用的是国内的网络,因此我选择国内的源进行下载
下载node二进制包
(base) [root@localhost ~]# wget https://npm.taobao.org/mirrors/node/latest-v12.x/node-v12.18.3-linux-x64.tar.xz
解压这个压缩包 (base) [root@localhost ~]# ls anaconda-ks.cfg Documents Music node-v12.18.3-linux-x64.tar.xz Public Videos Desktop Downloads node-v12.18.3-linux-x64 Pictures Templates 'VMware Tools'
node的名字有点儿长,改一下名字
(base) [root@localhost ~]# mv node-v12.18.3-linux-x64 nodejs
接下来将nodejs添加到环境变量中
(base) [root@localhost ~]# vim /etc/profile
将下面一行添加到profile最后
export PATH="/root/nodejs/bin:$PATH"
使环境变量生效
(base) [root@localhost ~]# source /etc/profile
执行命令,查看node是否能正常使用
(base) [root@localhost ~]# node -v
v12.18.3
出现版本号代表可以正常使用了。
安装TiddlyWiki
同样,由于网络问题,我先换成国内的taobao镜像源:
(base) [root@localhost ~]# npm config set registry https://registry.npm.taobao.org
(base) [root@localhost ~]# npm config get registry
https://registry.npm.taobao.org/
(base) [root@localhost ~]#
然后直接使用 npm 安装 TiddlyWiki:
(base) [root@localhost ~]# npm install -g tiddlywiki
/root/nodejs/bin/tiddlywiki -> /root/nodejs/lib/node_modules/tiddlywiki/tiddlywiki.js
+ [email protected]
added 1 package from 1 contributor in 19.553s
(base) [root@localhost ~]# tiddlywiki --version
5.1.22
只要TiddlyWiki命令可以正常使用,安装就成功了。
搭建Wiki
依赖的工具安装完毕,开始正菜。假如我将wiki安装到wiki目录下,wiki目录用于存放所有的wiki数据。安装步骤如下:
(base) [root@localhost ~]# tiddlywiki wiki --init server
Copied edition 'server' to wiki
wiki文件夹下是一个TiddlyWiki的配置文件,包含了主题插件等。
(base) [root@localhost ~]# cd wiki
(base) [root@localhost wiki]# ls
tiddlywiki.info
然后在wiki目录下执行命令,注意一定要在wiki配置文件所在的目录的上一层执行,否则会出现奇怪的错误。host=0.0.0.0 监听端口是80
(base) [root@localhost ~]# tiddlywiki wiki --listen host=0.0.0.0 port=80 Serving on http://0.0.0.0:80 (press ctrl-C to exit)
这样服务就启动了。注意:需要开启端口权限,否则是没法正常运行的。
iptables开放80端口方式(我这台CentOS 7 使用的是Firewalld防火墙,所以下面的iptables -L输出是不正确的):
(base) [root@localhost ~]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
(base) [root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:webcache
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT udp -- anywhere anywhere udp dpt:bootps
ACCEPT tcp -- anywhere anywhere tcp dpt:bootps
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere 192.168.122.0/24 ctstate RELATED,ESTABLISHED
ACCEPT all -- 192.168.122.0/24 anywhere
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:bootpc
firewalld开发80端口:
查看端口是否开放
(base) [root@localhost ~]# firewall-cmd --query-port=80/tcp
no
开放80端口
(base) [root@localhost ~]# firewall-cmd --add-port=80/tcp --permanent
success
重新载入防火墙
(base) [root@localhost ~]# firewall-cmd --reload
success
确认是否开放
(base) [root@localhost ~]# firewall-cmd --query-port=80/tcp
yes
(base) [root@localhost ~]#
接着访问PC的对外IP,如果是VPS,就访问公网IP,出现这个界面就可以正常使用了
pm2管理服务
因为是在服务器中使用,所以还是用pm2进程管理工具进行管理。
(base) [root@localhost ~]# npm install -g pm2
/root/nodejs/bin/pm2 -> /root/nodejs/lib/node_modules/pm2/bin/pm2
/root/nodejs/bin/pm2-runtime -> /root/nodejs/lib/node_modules/pm2/bin/pm2-runtime
/root/nodejs/bin/pm2-dev -> /root/nodejs/lib/node_modules/pm2/bin/pm2-dev
/root/nodejs/bin/pm2-docker -> /root/nodejs/lib/node_modules/pm2/bin/pm2-docker
npm WARN [email protected] requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ [email protected]
added 186 packages from 191 contributors in 23.439s
有warning也没关系,只要能正常运行就可以。
然后执行命令启动wiki,注意:这条命令必须在wiki文件夹下执行,否则会出现错误。
(base) [root@localhost wiki]# pm2 start --name wiki tiddlywiki -- --listen host=0.0.0.0 port=80
[PM2] Starting /root/nodejs/bin/tiddlywiki in fork_mode (1 instance)
[PM2] Done.
┌─────┬─────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼─────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ wiki │ default │ N/A │ fork │ 5006 │ 0s │ 0 │ online │ 0% │ 26.0mb │ root │ disabled │
└─────┴─────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
(base) [root@localhost wiki]#
以上,全部结束。
另外我的服务器上已经运行一个多月了,占用内存不到100MB,反正用着挺方便的。
结语
不知不觉就写了两个多小时,算是完成了一个作业,哈哈
如有错误,敬请指出,感谢指正! — 2020-08-31 22:02:48
最新评论
这个软件有bug的,客户端windows有些键不能用如逗号、句号
没有收到邮件通知
我的评论通知貌似坏掉了,定位一下问题
测试一下重新部署后的邮件功能
居然看到自己公司的MIB库,诚惶诚恐
那可能是RobotFramework-ride的版本问题。我装的1.7.4.2,有这个限制。我有空再尝试下旧版本吧,感谢回复。
你好!我在python2.7中安装RobotFramework-ride的时候提示wxPython的版本最高是2.18.12,用pip下载的wxPython版本是4.10,而且我在那个路径下没有找到2
真的太好了,太感谢了,在bilibili和CSDN上都找遍了,终于在你这里找到了