CentOS-7 搭建 Ant Design Pro
Ant Design Pro 官网:https://pro.ant.design/docs/getting-started-cn
antd 是基于 Ant Design 设计体系的 React UI 组件库,主要用于研发企业级中后台产品。
操作系统:CentOS-7
配置防火墙
# 查看防火墙【服务】状态
systemctl status firewalld
# 查看防火墙【运行】状态
firewall-cmd --state
# 开启
service firewalld start
# 重启
service firewalld restart
# 临时关闭
service firewalld stop
# 永久关闭
systemctl disable firewalld.service
# 查询端口是否开放
firewall-cmd --query-port=8080/tcp
# 开放80端口
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=8080-8085/tcp
# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp
# 查看防火墙的开放的端口
firewall-cmd --permanent --list-ports
# 重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload
配置 SELinux
# 临时关闭 SELinux
setenforce 0
# 临时打开 SELinux
setenforce 1
# 查看 SELinux 状态
getenforce
# 开机关闭 SELinux
# 编辑 /etc/selinux/config 文件,将 SELinux 的值设置为 disabled。
vi /etc/selinux/config
SELINUX=disabled
【安装】git
yum install git
========================================================================================================================================
Package 架构 版本 源 大小
========================================================================================================================================
正在安装:
git x86_64 1.8.3.1-22.el7_8 updates 4.4 M
为依赖而安装:
perl-Error noarch 1:0.17020-2.el7 base 32 k
perl-Git noarch 1.8.3.1-22.el7_8 updates 56 k
perl-TermReadKey x86_64 2.30-20.el7 base 31 k
rsync x86_64 3.1.2-10.el7 base 404 k
事务概要
========================================================================================================================================
安装 1 软件包 (+4 依赖软件包)
总下载量:4.9 M
安装大小:23 M
【安装】Node.js
NodeJS 官网:https://nodejs.org/dist/
# 下载
cd /usr/src && wget https://nodejs.org/dist/latest-v14.x/node-v14.1.0-linux-x64.tar.xz
# 解压
xz -d node-v14.1.0-linux-x64.tar.xz
tar -xvf node-v14.1.0-linux-x64.tar
# 链接
ln -s /usr/src/node-v14.1.0-linux-x64/bin/node /usr/bin/node
ln -s /usr/src/node-v14.1.0-linux-x64/bin/npm /usr/bin/npm
# 验证
node -v
v14.1.0
npm -v
6.14.5
# 安装依赖
mkdir -p /var/www/Ant-Design-Pro
cd /var/www/Ant-Design-Pro
# 更换 npm 源
npm config set registry https://registry.npm.taobao.org/
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass
# 查看 npm 配置
npm config get
# 更新 NPM
npm install -g npm
# 或者
npm i -g npm
创建项目目录
mkdir -p /var/www/Ant-Design-Pro
cd /var/www/Ant-Design-Pro
安装 ant-design-pro
npm install create-umi -g
npm WARN deprecated @types/vfile-message@2.0.0: This is a stub types definition. vfile-message provides its own type definitions, so you do not need this installed.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
/usr/src/node-v14.1.0-linux-x64/bin/create-umi -> /usr/src/node-v14.1.0-linux-x64/lib/node_modules/create-umi/cli.js
> core-js-pure@3.6.5 postinstall /usr/src/node-v14.1.0-linux-x64/lib/node_modules/create-umi/node_modules/core-js-pure
> 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 on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> ejs@2.7.4 postinstall /usr/src/node-v14.1.0-linux-x64/lib/node_modules/create-umi/node_modules/ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of @typescript-eslint/parser@^1.9.0 but none is installed. You must install peer dependencies yourself.
+ create-umi@0.23.1
added 978 packages from 505 contributors in 95.885s
结束后,输入
npm create umi
出现以下界面
Select the boilerplate type (Use arrow keys)
❯ ant-design-pro - Create project with an layout-only ant-design-pro boilerplate, use together with umi block.
app - Create project with a simple boilerplate, support typescript.
block - Create a umi block.
library - Create a library with umi.
plugin - Create a umi plugin.
当 > 在【ant-design-pro】前面时,输入【回车】
?