腾讯云 centOS7.6 Node 环境配置

382 阅读1分钟

一. Node 安装

1. 下载

Node官网下载地址

拷贝链接

2. 安装

首先,我们将移动到/usr/src目录,通常用于存放软件源的位置

cd /usr/src

下载node

wget https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz

解压

tar -zxvf node-v12.18.3-linux-x64.tar.xz

现在node和npm还不能全局使用,我们要添加环境变量 首先在 root 目录下找到 .bash_profile 文件,编辑

cd /root
vim .bash_profile

找到 PATH= $PATH:$HOME/bin,在后面添加路径为:

PATH=\$PATH:\$HOME/bin:/usr/local/src/node/bin

保存修改,然后重载一下

source ~/.bash_profile

二. git 安装

命令安装

yum install git
git --version

配置基本信息

[root@VM-0-9-centos /]# git config --global user.name xiaoming
[root@VM-0-9-centos /]# git config --global user.email 123456@qq.com

查看配置

[root@VM-0-9-centos /]# git config --list

生成公钥

[root@VM-0-9-centos /]# ssh-keygen

查看公钥

[root@VM-0-9-centos /]# cat root/.ssh/id_rsa.pub

访问 github SSH keys 配置页面,加入公钥即可 github.com/settings/ss…

克隆代码

git clone git@github.com:123/node-webserver.git