How to install NodeJS offline without internet
## prepare python 3
[root@localhost ~]# wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
--2021-12-14 15:06:13-- https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
Resolving www.python.org (www.python.org)... 146.75.48.223, 2a04:4e42:7c::223
Connecting to www.python.org (www.python.org)|146.75.48.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23017663 (22M) [application/octet-stream]
Saving to: ‘Python-3.7.4.tgz’
100%[======================================================================================================================================================================>] 23,017,663 104MB/s in 0.2s
2021-12-14 15:06:13 (104 MB/s) - ‘Python-3.7.4.tgz’ saved [23017663/23017663]
[root@localhost ~]# tar -xzvf Python-3.7.4.tgz && cd Python-3.7.4
Python-3.7.4/
Python-3.7.4/Doc/
Python-3.7.4/Doc/c-api/
Python-3.7.4/Doc/c-api/sys.rst
Python-3.7.4/Doc/c-api/conversion.rst
Python-3.7.4/Doc/c-api/marshal.rst
Python-3.7.4/Doc/c-api/coro.rst
Python-3.7.4/Doc/c-api/method.rst
Python-3.7.4/Doc/c-api/index.rst ^
## compile python 3
[root@localhost Python-3.7.4]# ./configure --enable-optimizations && make
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... no
checking for python3... no
checking for python... python
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
[root@localhost Python-3.7.4]# python3.7
bash: python3.7: 명령을 찾을 수 없습니다...
[root@localhost Python-3.7.4]# make altinstall
if test "no-framework" = "no-framework" ; then \
/usr/bin/install -c python /usr/local/bin/python3.7m; \
else \
/usr/bin/install -c -s Mac/pythonw /usr/local/bin/python3.7m; \
fi
if test "3.7" != "3.7m"; then \
if test -f /usr/local/bin/python3.7 -o -h /usr/local/bin/python3.7; \
then rm -f /usr/local/bin/python3.7; \
fi; \
(cd /usr/local/bin; ln python3.7m python3.7); \
fi
if test -f libpython3.7m.a && test "no-framework" = "no-framework" ; then \
if test -n "" ; then \
/usr/bin/install -c -m 555 /usr/local/bin; \
else \
/usr/bin/install -c -m 555 libpython3.7m.a /usr/local/lib/libpython3.7m.a; \
if test libpython3.7m.a != libpython3.7m.a; then \
(cd /usr/local/lib; ln -sf libpython3.7m.a libpython3.7m.a) \
fi \
fi; \
if test -n ""; then \
/usr/bin/install -c -m 555 /usr/local/lib/; \
fi; \
else true; \
fi
## check python 3
[root@localhost Python-3.7.4]# python3.7 -V
Python 3.7.4
## download nodejs source on rhel 7.9
[root@localhost ~]# wget https://nodejs.org/dist/v16.13.1/node-v16.13.1.tar.gz
--2021-12-14 15:03:30-- https://nodejs.org/dist/v16.13.1/node-v16.13.1.tar.gz
Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, 2606:4700:10::6814:172e, ...
Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 64385859 (61M) [application/gzip]
Saving to: ‘node-v16.13.1.tar.gz.1’
44% [========================================================================> ] 28,424,859 33.1MB/s ^
## configure nodejs
[root@localhost node-v16.13.1]# ./configure
Node.js configure: Found Python 3.7.4...
WARNING: failed to autodetect C++ compiler version (CXX=g++)
WARNING: warnings were emitted in the configure phase
INFO: configure completed successfully
[root@localhost node-v16.13.1]#
## configure nodejs
[root@localhost node-v16.13.1]# ./configure
Node.js configure: Found Python 3.7.4...
WARNING: failed to autodetect C++ compiler version (CXX=g++)
WARNING: warnings were emitted in the configure phase
INFO: configure completed successfully
[root@localhost node-v16.13.1]
#[root@localhost node-v16.13.1]# make
make -C out BUILDTYPE=Release V=0
make[1]: Entering directory `/root/node-v16.13.1/out'
g++ -o /root/node-v16.13.1/out/Release/obj.target/icuucx/deps/icu-small/source/common/appendable.o ../deps/icu-small/source/common/appendable.cpp '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DU_COMMON_IMPLEMENTATION=1' '-DU_ATTRIBUTE_DEPRECATED=' '-D_CRT_SECURE_NO_DEPRECATE=' '-DU_STATIC_IMPLEMENTATION=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' -I../deps/icu-small/source/common -pthread -Wall -Wextra -Wno-unused-parameter -m64 -Wno-deprecated-declarations -Wno-strict-aliasing -O3 -fno-omit-frame-pointer -fno-exceptions -std=gnu++14 -frtti -MMD -MF /root/node-v16.13.1/out/Release/.deps//root/node-v16.13.1/out/Release/obj.target/icuucx/deps/icu-small/source/common/appendable.o.d.raw -c
g++: error: unrecognized command line option ‘-std=gnu++14’
make[1]: *** [/root/node-v16.13.1/out/Release/obj.target/icuucx/deps/icu-small/source/common/appendable.o] 오류 1
make[1]: Leaving directory `/root/node-v16.13.1/out'
make: *** [node] 오류 2
[root@localhost node-v16.13.1]# g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost node-v16.13.1]# cd ..
failed....
## Simple IDEA
# Download Linux Binaries (x64)
[root@localhost ~]# wget https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz
--2021-12-14 15:51:09-- https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz
Resolving nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46, 2606:4700:10::6814:162e, ...
Connecting to nodejs.org (nodejs.org)|104.20.22.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21606428 (21M) [application/x-xz]
Saving to: ‘node-v16.13.1-linux-x64.tar.xz.1’
## set path
[root@localhost node-v16.13.1-linux-x64]# pwd
/root/node-v16.13.1-linux-x64
[root@localhost node-v16.13.1-linux-x64]# export PATH=/root/node-v16.13.1-linux-x64/bin:$PATH
[root@localhost node-v16.13.1-linux-x64]# node --version
v16.13.1
[root@localhost node-v16.13.1-linux-x64]#
댓글
댓글 쓰기