系统版本 centos7
[root@oracledb ~]# yum -y install docker-ce
[root@oracledb ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2022-02-19 10:03:27 CST; 58s ago
Docs: https://docs.docker.com
Main PID: 6875 (dockerd)
安装 docker网络
[root@oracledb ~]# docker network create mongo-net
安装mongodb
[root@oracledb ~]# docker run --name mongo --restart always --network mongo-net -d mongo --wiredTigerCacheSizeGB 0.25
[root@oracledb ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b8c69a61dc9e mongo "docker-entrypoint.s…" 9 seconds ago Up 8 seconds 27017/tcp mongo
安装 nodebb
[root@oracledb ~]# docker run --name forum --restart always --network mongo-net -p 4567:4567 -d nodebb/docker
[root@oracledb ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4b339d6ed9cf nodebb/docker "docker-entrypoint.s…" 7 minutes ago Up 7 minutes 0.0.0.0:4567->4567/tcp forum
b8c69a61dc9e mongo "docker-entrypoint.s…" 13 minutes ago Up 13 minutes 27017/tcp mongo
配置nginx(如果你安装了nginx,没有安装nginx可以直接访问http://你的IP:4567)
[root@oracledb ~]# vim /etc/nginx/nginx.conf
##增加以下内容
server {
listen 80 ;
listen [::]:80 ;
server_name www.xxx.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:4567;
}
}
查看运行的镜像进程
[root@oracledb ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b8f23fd1527d nodebb/docker "docker-entrypoint.s…" 3 months ago Up 12 minutes 0.0.0.0:4567->4567/tcp forum
977c0ae83111 mongo "docker-entrypoint.s…" 3 months ago Up 12 minutes 27017/tcp mongo
停止镜像进程
[root@oracledb ~]# docker stop b8f23fd1527d
b8f23fd1527d
[root@oracledb ~]# docker stop 977c0ae83111
977c0ae83111
卸载镜像
[root@oracledb ~]# docker rm b8f23fd1527d
b8f23fd1527d
[root@oracledb ~]# docker rm 977c0ae83111
977c0ae83111
[root@oracledb ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
查看当前docker的镜像IMAGE ID
[root@oracledb ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nodebb/docker latest 197c587669c3 3 months ago 1.34GB
mongo latest fefd78e9381a 4 months ago 699MB
删除镜像
[root@oracledb ~]# docker rmi fefd78e9381a
Untagged: mongo:latest
Untagged: mongo@sha256:07212fb304ea36b8c5a9e5694527f16deeb0b99f87fc60162dc15ab260bf8a2a
Deleted: sha256:fefd78e9381a1179990195a4a2b94103d4fee5c9ee16a725db2af5239cfa49e0
Deleted: sha256:61020392cf20b62d97c65ddaf1fdca0d34a63202d6b1f0225fed2d99a0af0443
Deleted: sha256:600659fc04f3d524308daa525ea5b41efc8b1d1f8182c8ecbe82fcca86fa84ea
Deleted: sha256:4a7b4587d382202d1dd80f84c73e50d503d0481efe93e585209ccaaff08f620e
Deleted: sha256:0e40e70049e1c439978b6b42f365e7c82509045af81569318d9d25ca4ae43ac8
Deleted: sha256:e32d56044445e386c117695c522d1b55b4404a67941d15373d927f6ba6ab998c
Deleted: sha256:6a74e1261a8f05a0e160b5576b517a617b1cde61e2e06caf741dc0288ab0f39a
Deleted: sha256:47ef14d94756f01bd1ab6df49c41c0df1653ef7596009418ec45f0b8fbf942eb
Deleted: sha256:d24f1d22ac6c19e32087304f478f921a57bfb717d26a1ec173ad98b892ec189c
Deleted: sha256:8e1fec7b6b6c506a19122cb48d9cffdb7c81dd3122c2cb444db0917a805937ac
Deleted: sha256:9f54eef412758095c8079ac465d494a2872e02e90bf1fb5f12a1641c0d1bb78b
[root@oracledb ~]# docker rmi 197c587669c3
Untagged: nodebb/docker:latest
Untagged: nodebb/docker@sha256:f74ee736f921500d61f8491a7985590b7eaebf092e2a736cc803f30715ab9ac8
Deleted: sha256:197c587669c3406d58ca11f8cd5aeb8bc0da93f6e8cfb6a889bde6d55ea74e8e
Deleted: sha256:e42d03291ad04b81930d8ca25b8d17d8af5b73e020fcd7ee5160423794d49439
Deleted: sha256:5762cfbc4ed9b8afce20532bb97c89f109fa11c7a6bbb4d553b45c6416c201d0
Deleted: sha256:09c579ae27345fbb25403d960aee03615bb9c5789c1ed7282e07d6e1a6d0440c
Deleted: sha256:e650b4d93a118e393ad5b15e28baa4f2877c5ce6dcb4c546c373729fd82c9585
Deleted: sha256:b6949c5ae50dfc78c68726b985ec543c444076a6e9a00c46e6c2222ceb48b06c
Deleted: sha256:337f747297b262181f5b1eadf453841bf27c25b5add2b36be48ac265865754c3
Deleted: sha256:050b17e6c7f20619de9d8df3f7cbaf1a507f7b9f8060467f526b29bf2f945eb9
Deleted: sha256:fcd370d875af7cc4923fcb6efa1757033ddf1b45456e8d5bcce39eb36e16592d
Deleted: sha256:70251061ec6935e497dcede16da95afed5d05af65c003e17d6e5dd10c363ff9c
Deleted: sha256:6d10575e1e58733b4116b86feb0546d719eb86c871ef2ed72404999c1011a5cc
Deleted: sha256:6738a60dabd67871d88608d386876e929086da90286191f1dbaf2cd5f774daa3
Deleted: sha256:3599c38d989d3ede47cb44afcb9ee1761090f034895a66df499d14c64f32dd04
Deleted: sha256:d6a325d281f2a509f28cb5f48f80d48f979b4b60873f9c42724c3ba3ccd90c4c
卸载docker
yum remove docker-ce
下图的mongo是你的mongo容器的名字
[root@oracledb ~]# yum -y install epel-release
[root@oracledb ~]# yum -y groupinstall "Development Tools" && yum -y install git redis ImageMagick npm
###Now we need install nodejs via npm as the repo package is too old.这一步网络差的话,隔一段时间尝试一下
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bash_profile
nvm list-remote
nvm install v14.18.1 # as of this writing check the result of the list-remote to see all choices
### start redis and set it to start on reboot
systemctl start redis
systemctl enable redis
### clone the NodeBB repository,也可以直接从https://github.com/NodeBB/NodeBB下载对应版本的zip包,到本地解压
cd /export/nodebb
git clone -b v1.18.x https://github.com/NodeBB/NodeBB nodebb
cd nodebb
###Initiate the setup script by running the app with the setup flag:
[nodebb@oracledb nodebb]$ ./nodebb setup
2022-02-19T04:59:21.326Z [24838] - info: NodeBB Setup Triggered via Command Line
Welcome to NodeBB v1.18.6!
This looks like a new installation, so you'll have to answer a few questions about your environment before we can proceed.
Press enter to accept the default setting (shown in brackets).
URL used to access this NodeBB (http://localhost:4567)
Please enter a NodeBB secret (cfbaeaea-862c-4865-a863-a504fe4cda0f)
Would you like to submit anonymous plugin usage to nbbpm? (yes)
Which database to use (mongo) redis
2022-02-19T04:59:34.720Z [24838] - info:
Now configuring redis database:
Host IP or address of your Redis instance (127.0.0.1)
Host port of your Redis instance (6379)
Password of your Redis database
Which database to use (0..n) (0)
2022-02-19T04:59:47.367Z [24838] - verbose: [minifier] utilizing a maximum of 0 additional threads
Configuration Saved OK
Populating database with default configs, if not already set...
2022-02-19T04:59:47.450Z [24838] - warn: [cache-buster] could not read cache buster ENOENT: no such file or directory, open '/export/nodebb/nodebb/build/cache-buster' {"code":"ENOENT","errno":-2,"path":"/export/nodebb/nodebb/build/cache-buster","stack":"Error: ENOENT: no such file or directory, open '/export/nodebb/nodebb/build/cache-buster'","syscall":"open"}
Enabling default theme: nodebb-theme-persona
No categories found, populating instance with default categories
2022-02-19T04:59:47.738Z [24838] - warn: No administrators have been detected, running initial user setup
Administrator username administrator
Administrator email address xxxx@xx.com
Password
Confirm Password
Creating welcome post!
###防火墙,如果防火墙关闭不需要管
firewall-cmd --zone=public --add-port=4567/tcp --permanent
firewall-cmd --reload
##启动
[nodebb@oracledb nodebb]$ ./nodebb start
Starting NodeBB
"./nodebb stop" to stop the NodeBB server
"./nodebb log" to view server output
"./nodebb help" for more commands