【安装Nodejs】CentOS7 下安装NodeJs+Express+MongoDB+Redis

时间:2021-01-13 06:11:25

最近想拿NodeJS做个文档管理系统玩玩,看看mongdb的gridfs效率咋样,谁晓得因为一个Yeoman的脚手架,整来整去的把文件权限全部搞乱,一想算了,还是重来搞一套吧!

1、安装  yum install epel-release

[root@iZ289zd8c52Z ~]#yum install epel-release
Loaded plugins: langpacks
base | 3.6 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/7): base/7/x86_64/group_gz | 155 kB 00:00:00
(2/7): epel/x86_64/group_gz | 170 kB 00:00:00
(3/7): extras/7/x86_64/primary_db | 132 kB 00:00:00
(4/7): epel/x86_64/updateinfo | 567 kB 00:00:00
(5/7): epel/x86_64/primary_db | 4.1 MB 00:00:04
(6/7): updates/7/x86_64/primary_db | 4.9 MB 00:00:04
(7/7): base/7/x86_64/primary_db | 5.3 MB 00:00:05
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-6 will be installed
--> Finished Dependency Resolution Dependencies Resolved ===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
epel-release noarch 7-6 epel 14 k Transaction Summary
===============================================================================================================================================================================================
Install 1 Package Total download size: 14 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-6.noarch.rpm | 14 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-6.noarch 1/1
warning: /etc/yum.repos.d/epel.repo created as /etc/yum.repos.d/epel.repo.rpmnew
Verifying : epel-release-7-6.noarch 1/1 Installed:
epel-release.noarch 0:7-6 Complete!

  2、安装 yum install nodejs

[root@iZ289zd8c52Z ~]# yum install nodejs
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-4.el7 will be installed
--> Processing Dependency: libuv.so.0.10()(64bit) for package: nodejs-0.10.42-4.el7.x86_6
--> Running transaction check
---> Package libuv.x86_64 1:0.10.34-2.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved =========================================================================================
Package Arch
=========================================================================================
Installing:
nodejs x86_64
Installing for dependencies:
libuv x86_64 Transaction Summary
=========================================================================================
Install 1 Package (+1 Dependent package) Total download size: 2.1 M
Installed size: 7.0 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): libuv-0.10.34-2.el7.x86_64.rpm
(2/2): nodejs-0.10.42-4.el7.x86_64.rpm
-----------------------------------------------------------------------------------------
Total
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:libuv-0.10.34-2.el7.x86_64
Installing : nodejs-0.10.42-4.el7.x86_64
Verifying : 1:libuv-0.10.34-2.el7.x86_64
Verifying : nodejs-0.10.42-4.el7.x86_64 Installed:
nodejs.x86_64 0:0.10.42-4.el7 Dependency Installed:
libuv.x86_64 1:0.10.34-2.el7 Complete!

3、yum install npm  (安装npm管理)

4、npm install -g n   (安装 n 用来管理nodejs)

5、n stable  (将nodejs升级到最新的稳定版本)

6、node -v (查看当前nodejs的版本,若还是之气的版本,那就请重启服务器,shutdown -r now)