0
点赞
收藏
分享

微信扫一扫

CentOS搭建 Leanote

Python芸芸 2022-02-02 阅读 56
运维

下载 Leanote 服务端

下载 Mongodb

解压软件压缩包

tar xzvf mongodb-linux-x86_64-rhel70-3.6.3.tgz

tar xzvf leanote-linux-amd64-v2.6.1.bin.tar.gz

rm -rf leanote-linux-amd64-v2.6.1.bin.tar.gz mongodb-linux-x86_64-rhel70-3.6.3.tgz

mv mongodb-linux-x86_64-rhel70-3.6.3 mongodb

mkdir /root/mongodb/data
mkdir /root/mongodb/logs
' 软链接 '
ln -s /root/mongodb/bin/mongod /usr/local/bin/

mongod --dbpath=/root/mongodb/data --logpath=/root/mongodb/logs --fork

ps -ef | grep mongod

netstat -nltp | grep mongod

配置 mongodb 数据库服务项

vim /etc/profile

export PATH=$PATH:/root/mongodb/bin

source /etc/profile

主要指定数据库文件,日志文件,以及一些启动参数

cd /root/mongodb/bin/

vim mongod.conf

dbpath=/root/mongodb/data
logpath=/root/mongodb/logs
fork=true

参数信息

kill -9 2438

' 重新启动 '
mongod -f mongod.conf

编写自定义服务

cd /lib/systemd/system/

vim mongodb.service

[Unit]
Description=mongodb
After=network.target  remote-fs.target  nss-lookup.target

[Service]
Type=forking
ExecStart=/root/mongodb/bin/mongod --config /root/mongodb/bin/mongod.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/root/mongodb/bin/mongod --shutdown --config /root/mongodb/bin/mongod.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl stop mongodb.service
systemctl start mongodb.service
systemctl enable mongodb.service

配置 Leanote 服务器端软件

cd /root/leanote/bin

chmod 777 run.sh

./run.sh
' 导入数据 '
mongorestore  -h  localhost  -d  leanote  --dir  /root/leanote/mongodb_backup/leanote_install_data/
mongo
show dbs

cd /etc/rc.d/init.d;vim leanote.sh
#/bin/bash
#chkconfig: 2345 80 90
#description:leanote.sh
cd /root/leanote/bin
bash run.sh &

chmod 755 leanote.sh

' 启动服务 '
service leanote.sh  start

' 将服务脚本加入到系统启动队列 '
chkconfig --add leanote.sh
chkconfig leanote.sh on 
vim /root/leanote/conf/app.conf

' kill leanote '
netstat -nltp | grep leanote
kill -9 2858

' 启动 自启 '
service leanote.sh  start
chkconfig --add leanote.sh
chkconfig leanote.sh on 

' 防火墙 '
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=27017/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-all | grep ports

系统管理员默认账户: admin

默认密码: abc123

举报

相关推荐

0 条评论