在Centos上安装Growi v5.x的方法
我在CentOS上搭建了Growi的v5.x版本。
建立的环境
-
- CentOS: 7.9
-
- nodejs: v14.21.1
-
- npm: 6.14.7
-
- yarn: 1.22.19
-
- elasticsearch: 7系(Growiのv5.x以降はelasticsearchの6系でも動くらしいが将来的なことを考えて7系にしました)
-
- Mongodb: 4.4
- Growi: 5.0.12
安装Node.js和Yarn
作業目錄是主目錄。
本次安装的是v14版本的node.js。
curl -sL https://rpm.nodesource.com/setup_14.x | bash -
yum install gcc-c++ make
yum install nodejs
安装Yarn
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
yum install yarn
安装Elasticsearch
据说elasticsearch是使用全文搜索功能所必需的东西。
- JDKのインストール
yum install java-1.8.0-openjdk
- RPM公開鍵のインポート
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
- yumにリポジトリを認識させる
vi /etc/yum.repos.d/elasticsearch7.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
- elasticsearchのインストール
yum install elasticsearch
yum list installed | grep elasticsearch
确认安装是否正确完成
- elasticsearchの自動起動の設定をする
systemctl start elasticsearch
systemctl enable elasticsearch
systemctl status elasticsearch
这里也有可能会出现[○○的工作]的错误吗?(原因不明)
- 推奨されているelasticsearchプラグインをインストール
rpm -ql elasticsearch | grep bin | grep plugin
--------------------------------------------------
/usr/share/elasticsearch/bin/elasticsearch-plugin(多分これと同じものが出る)
--------------------------------------------------
将上述所显示的内容与下方相同。
/usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-kuromoji
/usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu
安装MongoDB
- リポジトリの作成
[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
我在没有注意到这个部分的错误之下遇到了困难。
- mongodbのインストール
yum install mongodb-org
- インストール出来ているか確認
yum list installed | grep mongodb
- mongodbの自動起動の設定をする
systemctl start mongod
systemctl enable mongod
systemctl status mongod
在中国以本地方式对Growi进行安装。
这次将安装在/opt目录下。
由于需要克隆Growi存储库,因此需要安装git。
yum install git
cd /opt/
git clone https://github.com/weseek/growi /opt/growi
cd /opt/growi/
git tag -l
git checkout -b v5.○○ refs/tags/v5.○○
请注意,只有在版本号为v5.0或更高时,Growi页面树才被实现。
cd /opt/growi/
yarn
确认启动
MONGO_URI=mongodb://localhost:27017/growi \
ELASTICSEARCH_URI=http://localhost:9200/growi \
npm start
这里需要花费一些时间。
使用systemd自动启动的Growi系统
vi /etc/systemd/system/growi.service
[Unit]
Description=Growi
After=network.target mongod.service
[Service]
WorkingDirectory=/opt/growi
Environment=PORT=3000\
MONGO_URI=mongodb://localhost:27017/growi\
ELASTICSEARCH_URI=http://localhost:9200/growi
ExecStart=/usr/bin/npm start
[Install]
WantedBy=multi-user.target
systemctl start growi
systemctl enable growi
systemctl status growi
我想这样插入已经完成了。
我认为你可以连接到http://127.0.0.1:3000。
最后
希望Growi的版本可以根据依赖关系的变化进行相应调整,请注意这一点。
希望这篇文章对某人有所帮助。
请参考此文