游戏体验地址:人生重开模拟器
上文已经记录了Centos8安装Git的完整过程,这里不再赘述。
代码地址:人生重开模拟器
[root@C20210805207038 home]# git clone https://github.com/AliyunWorkbench/lifeRestart.git
正克隆到 'lifeRestart'...
remote: Enumerating objects: 112, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 112 (delta 20), reused 10 (delta 10), pack-reused 62
接收对象中: 100% (112/112), 791.09 KiB | 4.82 MiB/s, 完成.
处理 delta 中: 100% (31/31), 完成.
[root@C20210805207038 lifeRestart]# sudo yum module install nodejs
上次元数据过期检查:0:22:31 前,执行于 2022年02月12日 星期六 13时29分50秒。
依赖关系解决。
===========================================================================================================================================================
软件包 架构 版本 仓库 大小
===========================================================================================================================================================
安装组/模块包:
nodejs x86_64 1:10.24.0-1.module_el8.3.0+717+fa496f1d AppStream 8.8 M
npm x86_64 1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d AppStream 3.7 M
安装弱的依赖:
nodejs-full-i18n x86_64 1:10.24.0-1.module_el8.3.0+717+fa496f1d AppStream 7.3 M
安装模块配置档案:
nodejs/common
启用模块流:
nodejs 10
事务概要
===========================================================================================================================================================
安装 3 软件包
总下载:20 M
安装大小:71 M
确定吗?[y/N]: y
下载软件包:
(1/3): npm-6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64.rpm 388 kB/s | 3.7 MB 00:09
(2/3): nodejs-full-i18n-10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64.rpm 443 kB/s | 7.3 MB 00:16
(3/3): nodejs-10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64.rpm 501 kB/s | 8.8 MB 00:18
-----------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.1 MB/s | 20 MB 00:18
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
运行脚本: npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64 1/1
准备中 : 1/1
安装 : nodejs-full-i18n-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64 1/3
安装 : npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64 2/3
安装 : nodejs-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64 3/3
运行脚本: nodejs-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64 3/3
验证 : nodejs-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64 1/3
验证 : nodejs-full-i18n-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64 2/3
验证 : npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64 3/3
已安装:
nodejs-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64 nodejs-full-i18n-1:10.24.0-1.module_el8.3.0+717+fa496f1d.x86_64
npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64
完毕!
[root@C20210805207038 lifeRestart]# npm install
> core-js@3.21.0 postinstall /home/lifeRestart/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js:
> https://opencollective.com/core-js
> https://patreon.com/zloirock
> https://paypal.me/zloirock
> bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for webpack-dev-server@4.7.4: wanted: {"node":">= 12.13.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: webpack-dev-server@4.7.4
npm WARN notsup Unsupported engine for http-proxy-middleware@2.0.3: wanted: {"node":">=12.0.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: http-proxy-middleware@2.0.3
npm WARN notsup Unsupported engine for open@8.4.0: wanted: {"node":">=12"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: open@8.4.0
npm WARN notsup Unsupported engine for schema-utils@4.0.0: wanted: {"node":">= 12.13.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: schema-utils@4.0.0
npm WARN notsup Unsupported engine for strip-ansi@7.0.1: wanted: {"node":">=12"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: strip-ansi@7.0.1
npm WARN notsup Unsupported engine for webpack-dev-middleware@5.3.1: wanted: {"node":">= 12.13.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: webpack-dev-middleware@5.3.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN notsup Unsupported engine for ansi-regex@6.0.1: wanted: {"node":">=12"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: ansi-regex@6.0.1
npm WARN notsup Unsupported engine for schema-utils@4.0.0: wanted: {"node":">= 12.13.0"} (current: {"node":"10.24.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: schema-utils@4.0.0
npm WARN xlsx_transform@ No repository field.
npm WARN xlsx_transform@ No license field.
added 511 packages from 331 contributors and audited 512 packages in 32.109s
53 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
[root@C20210805207038 lifeRestart]# npm run build
> xlsx_transform@ build /home/lifeRestart
> webpack --mode production && cp -r ./view/* ./public/ && cp -r ./data ./public/ && mv public build
asset bundle.js 783 KiB [emitted] [minimized] [big] (name: main)
orphan modules 85.9 KiB [orphan] 8 modules
runtime modules 221 bytes 1 module
modules by path ./node_modules/core-js/internals/*.js 118 KiB
./node_modules/core-js/internals/to-string-tag-support.js 210 bytes [built] [code generated]
./node_modules/core-js/internals/well-known-symbol.js 1.03 KiB [built] [code generated]
./node_modules/core-js/internals/global.js 590 bytes [built] [code generated]
+ 151 modules
modules by path ./node_modules/core-js/modules/*.js 70.8 KiB
./node_modules/core-js/modules/es.object.to-string.js 380 bytes [built] [code generated]
./node_modules/core-js/modules/es.promise.js 14 KiB [built] [code generated]
./node_modules/core-js/modules/web.dom-collections.for-each.js 887 bytes [built] [code generated]
./node_modules/core-js/modules/es.array.iterator.js 2.45 KiB [built] [code generated]
+ 31 modules
./src/index.js + 8 modules 87.8 KiB [built] [code generated]
./node_modules/regenerator-runtime/runtime.js 24.3 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
bundle.js (783 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (783 KiB)
bundle.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.68.0 compiled with 3 warnings in 6764 ms
[root@C20210805207038 lifeRestart]# ls
bitcoin: build.sh _config.yml data _layouts node package.json README.md src utils webpack.config.cjs
build CNAME core-js@3.21.0 index.md LICENSE node_modules package-lock.json repl test view yarn.lock
[root@C20210805207038 lifeRestart]# cd build
[root@C20210805207038 build]# ls
bundle.js dark.css iconfont.ttf iconfont.woff2 index.html manifest.json test.html
condition_test.html data iconfont.woff images light.css sw.js
出现了build文件夹,说明编译完成。
运行如下代码,站点即为 localhost:5000(临时使用)
npm run build
npm run preview
http-serve部署(长期部署)
npm install http-server -g
dist目录下运行 http-server -p 5000
Starting up http-server, serving ./public
http-server version: 14.1.0
http-server settings:
CORS: disabled
Cache: 3600 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none
Available on:
http://127.0.0.1:8080
http://10.10.155.2:8080
Hit CTRL-C to stop the server
查看防火墙某个端口是否开放
firewall-cmd --query-port=3306/tcp
开放防火墙端口3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent
注意:开放端口后要重启防火墙生效
重启防火墙
systemctl restart firewalld
关闭防火墙端口
firewall-cmd --remove-port=3306/tcp --permanent
查看防火墙状态
systemctl status firewalld
关闭防火墙
systemctl stop firewalld
打开防火墙
systemctl start firewalld
开放一段端口
firewall-cmd --zone=public --add-port=40000-45000/tcp --permanent
查看开放的端口列表
firewall-cmd --zone=public --list-ports
查看被监听(Listen)的端口
netstat -lntp
检查端口被哪个进程占用
netstat -lnp|grep 3306