已安装Nodejs ,可参考:安装 Nodejs (CentOS7 与 Windows)_瘦身小蚂蚁的博客-CSDN博客
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
[root@Tracy local]# curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
yum install yarn //中间会有提示Is this ok[y/N] 都填写y即
或
yum install -y yarn //中间的提示忽略,都按y执行
[root@Tracy local]# yum install yarn
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
yarn | 2.9 kB 00:00:00
(1/7): epel/x86_64/group_gz | 97 kB 00:00:00
(2/7): extras/7/x86_64/primary_db | 250 kB 00:00:00
(3/7): epel/x86_64/updateinfo | 1.1 MB 00:00:00
(4/7): docker-ce-stable/7/x86_64/primary_db | 82 kB 00:00:00
(5/7): epel/x86_64/primary_db | 7.0 MB 00:00:00
(6/7): updates/7/x86_64/primary_db | 17 MB 00:00:00
(7/7): yarn/primary_db | 23 kB 00:00:01
Resolving Dependencies
--> Running transaction check
---> Package yarn.noarch 0:1.22.19-1 will be installed
--> Processing Dependency: nodejs for package: yarn-1.22.19-1.noarch
--> Running transaction check
---> Package nodejs.x86_64 1:16.15.0-3.el7 will be installed
--> Processing Dependency: nodejs-libs(x86-64) = 1:16.15.0-3.el7 for package: 1:nodejs-16.15.0-3.el7.x86_64
--> Processing Dependency: libuv >= 1:1.43.0 for package: 1:nodejs-16.15.0-3.el7.x86_64
--> Processing Dependency: openssl11 >= 1:1.1.1 for package: 1:nodejs-16.15.0-3.el7.x86_64
--> Processing Dependency: libbrotlidec.so.1()(64bit) for package: 1:nodejs-16.15.0-3.el7.x86_64
--> Processing Dependency: libbrotlienc.so.1()(64bit) for package: 1:nodejs-16.15.0-3.el7.x86_64
--> Processing Dependency: libnode.so.93()(64bit) for package: 1:nodejs-16.15.0-3.el7.x86_64
--> Processing Dependency: libuv.so.1()(64bit) for package: 1:nodejs-16.15.0-3.el7.x86_64
--> Running transaction check
---> Package brotli.x86_64 0:1.0.7-5.el7 will be installed
---> Package libuv.x86_64 1:1.44.2-1.el7 will be installed
---> Package nodejs-libs.x86_64 1:16.15.0-3.el7 will be installed
---> Package openssl11.x86_64 1:1.1.1k-4.el7 will be installed
--> Processing Dependency: openssl11-libs(x86-64) = 1:1.1.1k-4.el7 for package: 1:openssl11-1.1.1k-4.el7.x86_64
--> Running transaction check
---> Package openssl11-libs.x86_64 1:1.1.1k-3.el7 will be updated
---> Package openssl11-libs.x86_64 1:1.1.1k-4.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================
Installing:
yarn noarch 1.22.19-1 yarn 1.2 M
Installing for dependencies:
brotli x86_64 1.0.7-5.el7 epel 318 k
libuv x86_64 1:1.44.2-1.el7 epel 145 k
nodejs x86_64 1:16.15.0-3.el7 epel 100 k
nodejs-libs x86_64 1:16.15.0-3.el7 epel 14 M
openssl11 x86_64 1:1.1.1k-4.el7 epel 692 k
Updating for dependencies:
openssl11-libs x86_64 1:1.1.1k-4.el7 epel 1.5 M
Transaction Summary
========================================================================================================================================
Install 1 Package (+5 Dependent packages)
Upgrade ( 1 Dependent package)
Total download size: 18 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/7): brotli-1.0.7-5.el7.x86_64.rpm | 318 kB 00:00:00
(2/7): libuv-1.44.2-1.el7.x86_64.rpm | 145 kB 00:00:00
(3/7): nodejs-16.15.0-3.el7.x86_64.rpm | 100 kB 00:00:00
(4/7): openssl11-1.1.1k-4.el7.x86_64.rpm | 692 kB 00:00:00
(5/7): openssl11-libs-1.1.1k-4.el7.x86_64.rpm | 1.5 MB 00:00:00
(6/7): nodejs-libs-16.15.0-3.el7.x86_64.rpm | 14 MB 00:00:00
warning: /var/cache/yum/x86_64/7/yarn/packages/yarn-1.22.19-1.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 6963f07f: NOKEY:04 ETA
Public key for yarn-1.22.19-1.noarch.rpm is not installed
(7/7): yarn-1.22.19-1.noarch.rpm | 1.2 MB 00:00:02
----------------------------------------------------------------------------------------------------------------------------------------
Total 7.5 MB/s | 18 MB 00:00:02
Retrieving key from https://dl.yarnpkg.com/rpm/pubkey.gpg
Importing GPG key 0x6963F07F:
Userid : "Yarn RPM Packaging "
Fingerprint: 9a6f 73f3 4beb 7473 4d8c 6914 9cbb b558 6963 f07f
From : https://dl.yarnpkg.com/rpm/pubkey.gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 1:openssl11-libs-1.1.1k-4.el7.x86_64 1/8
Installing : brotli-1.0.7-5.el7.x86_64 2/8
Installing : 1:libuv-1.44.2-1.el7.x86_64 3/8
Installing : 1:nodejs-libs-16.15.0-3.el7.x86_64 4/8
Installing : 1:openssl11-1.1.1k-4.el7.x86_64 5/8
Installing : 1:nodejs-16.15.0-3.el7.x86_64 6/8
Installing : yarn-1.22.19-1.noarch 7/8
Cleanup : 1:openssl11-libs-1.1.1k-3.el7.x86_64 8/8
Verifying : 1:nodejs-libs-16.15.0-3.el7.x86_64 1/8
Verifying : 1:nodejs-16.15.0-3.el7.x86_64 2/8
Verifying : 1:libuv-1.44.2-1.el7.x86_64 3/8
Verifying : 1:openssl11-1.1.1k-4.el7.x86_64 4/8
Verifying : 1:openssl11-libs-1.1.1k-4.el7.x86_64 5/8
Verifying : brotli-1.0.7-5.el7.x86_64 6/8
Verifying : yarn-1.22.19-1.noarch 7/8
Verifying : 1:openssl11-libs-1.1.1k-3.el7.x86_64 8/8
Installed:
yarn.noarch 0:1.22.19-1
Dependency Installed:
brotli.x86_64 0:1.0.7-5.el7 libuv.x86_64 1:1.44.2-1.el7 nodejs.x86_64 1:16.15.0-3.el7 nodejs-libs.x86_64 1:16.15.0-3.el7
openssl11.x86_64 1:1.1.1k-4.el7
Dependency Updated:
openssl11-libs.x86_64 1:1.1.1k-4.el7
Complete!
[root@Tracy local]# yarn -v
1.22.19
yarn -v
[root@Tracy local]# yarn -v
1.22.19