{"id":4520,"date":"2024-05-30T07:17:43","date_gmt":"2024-05-30T07:17:43","guid":{"rendered":"https:\/\/zinisoft.net\/?p=4520"},"modified":"2025-10-02T08:26:06","modified_gmt":"2025-10-02T08:26:06","slug":"how-to-install-node-js-16-on-centos-7","status":"publish","type":"post","link":"https:\/\/zinisoft.net\/vi\/how-to-install-node-js-16-on-centos-7\/","title":{"rendered":"H\u01b0\u1edbng D\u1eabn C\u00e0i \u0110\u1eb7t Node.js 16 Tr\u00ean CentOS 7"},"content":{"rendered":"<p><strong>Node.js<\/strong> l\u00e0 m\u1ed9t m\u00f4i tr\u01b0\u1eddng ch\u1ea1y <strong>JavaScript runtime<\/strong> m\u1ea1nh m\u1ebd, cho ph\u00e9p b\u1ea1n x\u00e2y d\u1ef1ng c\u00e1c \u1ee9ng d\u1ee5ng ph\u00eda m\u00e1y ch\u1ee7 (server-side) c\u00f3 kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u00e0 hi\u1ec7u su\u1ea5t cao. Trong h\u01b0\u1edbng d\u1eabn n\u00e0y, ch\u00fang ta s\u1ebd th\u1ef1c hi\u1ec7n t\u1eebng b\u01b0\u1edbc \u0111\u1ec3 c\u00e0i \u0111\u1eb7t Node.js phi\u00ean b\u1ea3n 16 tr\u00ean m\u00e1y ch\u1ee7 CentOS 7. Cho d\u00f9 b\u1ea1n l\u00e0 ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u hay m\u1ed9t nh\u00e0 ph\u00e1t tri\u1ec3n c\u00f3 kinh nghi\u1ec7m, h\u01b0\u1edbng d\u1eabn n\u00e0y s\u1ebd gi\u00fap b\u1ea1n s\u1eb5n s\u00e0ng l\u00e0m vi\u1ec7c.<\/p>\n<h2>Y\u00eau c\u1ea7u c\u1ea7n c\u00f3<\/h2>\n<p>\u00a0 \u00a0 <\/p>\n<p>Tr\u01b0\u1edbc khi b\u1eaft \u0111\u1ea7u, h\u00e3y \u0111\u1ea3m b\u1ea3o b\u1ea1n c\u00f3 nh\u1eefng \u0111i\u1ec1u ki\u1ec7n sau:<\/p>\n<ul>\n\u00a0 \u00a0 <\/p>\n<li>M\u1ed9t m\u00e1y ch\u1ee7 <strong>CentOS 7<\/strong> v\u1edbi quy\u1ec1n truy c\u1eadp <strong>SSH<\/strong> (b\u1ea1n c\u00f3 th\u1ec3 l\u00e0m theo h\u01b0\u1edbng d\u1eabn v\u1ec1 c\u00e1ch <a href=\"https:\/\/azdigi.com\/blog\/en\/linux-server-en\/linux-fundementals\/how-to-login-to-linux-vps-with-ssh-protocol\/\" target=\"_blank\" rel=\"noopener\">\u0111\u0103ng nh\u1eadp v\u00e0o Linux VPS b\u1eb1ng SSH<\/a>).<\/li>\n<p>\u00a0 \u00a0 <\/p>\n<li>Ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 d\u00f2ng l\u1ec7nh Linux.<\/li>\n<\/ul>\n<h3>B\u01b0\u1edbc 1: K\u1ebft N\u1ed1i SSH \u0110\u1ebfn M\u00e1y Ch\u1ee7 CentOS 7<\/h3>\n<p>\u0110\u1ea7u ti\u00ean, h\u00e3y \u0111\u0103ng nh\u1eadp v\u00e0o m\u00e1y ch\u1ee7 CentOS 7 c\u1ee7a b\u1ea1n qua SSH v\u1edbi quy\u1ec1n ng\u01b0\u1eddi d\u00f9ng **root** ho\u1eb7c ng\u01b0\u1eddi d\u00f9ng c\u00f3 quy\u1ec1n **sudo**. N\u1ebfu b\u1ea1n kh\u00f4ng quen thu\u1ed9c v\u1edbi SSH, h\u00e3y l\u00e0m theo h\u01b0\u1edbng d\u1eabn \u0111\u01b0\u1ee3c li\u00ean k\u1ebft \u1edf tr\u00ean.<\/p>\n<h3>B\u01b0\u1edbc 2: C\u1eadp Nh\u1eadt H\u1ec7 Th\u1ed1ng CentOS<\/h3>\n<p>\u00a0 \u00a0 <\/p>\n<p>C\u1eadp nh\u1eadt h\u1ec7 th\u1ed1ng CentOS c\u1ee7a b\u1ea1n \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o t\u1ea5t c\u1ea3 c\u00e1c g\u00f3i hi\u1ec7n c\u00f3 \u0111\u1ec1u l\u00e0 phi\u00ean b\u1ea3n m\u1edbi nh\u1ea5t:<\/p>\n<p>\u00a0 \u00a0 <\/p>\n<blockquote style=\"background-color: #00008B;\"><p>yum update -y<\/p><\/blockquote>\n<h3>B\u01b0\u1edbc 3: C\u00e0i \u0110\u1eb7t Node.js 16 B\u1eb1ng Repository c\u1ee7a NodeSource<\/h3>\n<p>\u00a0 \u00a0 <\/p>\n<p>B\u00e2y gi\u1edd ch\u00fang ta h\u00e3y c\u00e0i \u0111\u1eb7t Node.js 16 b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng kho l\u01b0u tr\u1eef (repository) c\u1ee7a NodeSource:<\/p>\n<ol>\n\u00a0 \u00a0 <\/p>\n<li><strong>C\u00e0i \u0111\u1eb7t c\u00e1c Th\u01b0 vi\u1ec7n B\u1eaft bu\u1ed9c:<\/strong> C\u00e0i \u0111\u1eb7t c\u00e1c th\u01b0 vi\u1ec7n <code>gcc-c++<\/code> v\u00e0 <code>make<\/code> (c\u1ea7n thi\u1ebft cho vi\u1ec7c x\u00e2y d\u1ef1ng c\u00e1c ti\u1ec7n \u00edch b\u1ed5 sung g\u1ed1c):<br \/>\n<blockquote style=\"background-color: #00008B;\"><p>yum install -y gcc-c++ make<\/p><\/blockquote>\n<\/li>\n<p>\u00a0 \u00a0 <\/p>\n<li><strong>Th\u00eam Repository c\u1ee7a NodeSource:<\/strong> Th\u00eam kho l\u01b0u tr\u1eef Node.js 16.x c\u1ee7a NodeSource v\u00e0o h\u1ec7 th\u1ed1ng c\u1ee7a b\u1ea1n:<br \/>\n<blockquote style=\"background-color: #00008B;\"><p>curl -sL https:\/\/rpm.nodesource.com\/setup_16.x | sudo -E bash &#8211;<\/p><\/blockquote>\n<\/li>\n<p>\u00a0 \u00a0 <\/p>\n<li><strong>C\u00e0i \u0111\u1eb7t Node.js v\u00e0 npm:<\/strong><br \/>\n<blockquote style=\"background-color: #00008B;\"><p>sudo yum install -y nodejs<\/p><\/blockquote>\n<\/li>\n<\/ol>\n<h3>B\u01b0\u1edbc 4: Ki\u1ec3m Tra Phi\u00ean B\u1ea3n C\u00e0i \u0110\u1eb7t<\/h3>\n<p>\u00a0 \u00a0 <\/p>\n<p>X\u00e1c nh\u1eadn r\u1eb1ng Node.js v\u00e0 npm \u0111\u00e3 \u0111\u01b0\u1ee3c c\u00e0i \u0111\u1eb7t th\u00e0nh c\u00f4ng b\u1eb1ng c\u00e1ch ki\u1ec3m tra phi\u00ean b\u1ea3n c\u1ee7a ch\u00fang:<\/p>\n<p>\u00a0 \u00a0 <\/p>\n<blockquote style=\"background-color: #00008B;\"><p>node &#8211;version<br \/>\nnpm &#8211;version<\/p><\/blockquote>\n<p>\u00a0 \u00a0 <\/p>\n<p>B\u1ea1n s\u1ebd th\u1ea5y s\u1ed1 phi\u00ean b\u1ea3n \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb, cho th\u1ea5y Node.js 16 \u0111\u00e3 \u0111\u01b0\u1ee3c c\u00e0i \u0111\u1eb7t th\u00e0nh c\u00f4ng.<\/p>\n<h2>T\u00f3m T\u1eaft<\/h2>\n<p>Ch\u00fac m\u1eebng! B\u1ea1n \u0111\u00e3 ho\u00e0n t\u1ea5t vi\u1ec7c c\u00e0i \u0111\u1eb7t Node.js 16 tr\u00ean m\u00e1y ch\u1ee7 CentOS 7. Gi\u1edd \u0111\u00e2y b\u1ea1n \u0111\u00e3 s\u1eb5n s\u00e0ng \u0111\u1ec3 b\u1eaft \u0111\u1ea7u x\u00e2y d\u1ef1ng c\u00e1c \u1ee9ng d\u1ee5ng tuy\u1ec7t v\u1eddi. N\u1ebfu b\u1ea1n g\u1eb7p b\u1ea5t k\u1ef3 s\u1ef1 c\u1ed1 n\u00e0o ho\u1eb7c c\u1ea7n h\u1ed7 tr\u1ee3 th\u00eam, \u0111\u1eebng ng\u1ea7n ng\u1ea1i h\u1ecfi nh\u00e9!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MongoDB l\u00e0 m\u1ed9t h\u1ec7 qu\u1ea3n tr\u1ecb c\u01a1 s\u1edf d\u1eef li\u1ec7u NoSQL h\u01b0\u1edbng t\u00e0i li\u1ec7u (document-oriented) d\u1eabn \u0111\u1ea7u th\u1ecb tr\u01b0\u1eddng.<\/p>\n","protected":false},"author":1,"featured_media":4525,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[97],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/posts\/4520"}],"collection":[{"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/comments?post=4520"}],"version-history":[{"count":8,"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/posts\/4520\/revisions"}],"predecessor-version":[{"id":4895,"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/posts\/4520\/revisions\/4895"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/media\/4525"}],"wp:attachment":[{"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/media?parent=4520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/categories?post=4520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zinisoft.net\/vi\/wp-json\/wp\/v2\/tags?post=4520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}