Wednesday, June 29, 2011

Node.js on Fedora 15

Since currently there is no easy way to install node.js via yum repository. Here is how you can quickly get the node.js installed on your fedora-15 box

1. Install fedora packager rpms (as root)



[nareshv@localhost SRPMS]$ sudo yum groupinstall "Fedora Packager"



2. Create the setup environment for building RPM (for non-root users)



[nareshv@localhost ~]$ rpmdev-setuptree



3. Download the SRPM (as nonroot)



[nareshv@localhost ~]$ cd rpmbuild/SRPMS/
[nareshv@localhost SRPMS]$ ls
[nareshv@localhost SRPMS]$ wget http://v3.sk/~lkundrak/SRPMS/nodejs-0.4.1-1.el6.src.rpm
--2011-06-29 22:18:50-- http://v3.sk/~lkundrak/SRPMS/nodejs-0.4.1-1.el6.src.rpm
Resolving v3.sk... 91.210.183.14
Connecting to v3.sk|91.210.183.14|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4859437 (4.6M) [application/x-rpm]
Saving to: ânodejs-0.4.1-1.el6.src.rpmâ

100%[====================================================>] 4,859,437 600K/s in 11s

2011-06-29 22:19:03 (444 KB/s) - nodejs-0.4.1-1.el6.src.rpm



4. Install the dependencies for the RPM (as root)



[nareshv@localhost SRPMS]$ sudo yum install openssl-devel v8-devel c-ares-devel \
libev-devel libeio-devel http-parser-devel \
waf libgpg-error-devel \
libstdc++-devel gcc-c++ -y




5. Build the RPM (as non-root)



[nareshv@localhost SRPMS]$ rpmbuild --rebuild nodejs-0.4.1-1.el6.src.rpm
...
...
...
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.OWCyPT
+ umask 022
+ cd /home/nareshv/rpmbuild/BUILD
+ cd node-v0.4.1
+ DOCDIR=/home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64/usr/share/doc/nodejs-0.4.1
+ export DOCDIR
+ rm -rf /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64/usr/share/doc/nodejs-0.4.1
+ /bin/mkdir -p /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64/usr/share/doc/nodejs-0.4.1
+ cp -pr ChangeLog LICENSE README.md doc /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64/usr/share/doc/nodejs-0.4.1
+ exit 0
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: http_parser.so.0()(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libcares.so.2()(64bit) libcrypto.so.10()(64bit) libdl.so.2()(64bit) libdl.so.2(GLIBC_2.2.5)(64bit) libeio.so.1()(64bit) libev.so.4()(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libm.so.6()(64bit) libpthread.so.0()(64bit) libpthread.so.0(GLIBC_2.2.5)(64bit) librt.so.1()(64bit) libssl.so.10()(64bit) libstdc++.so.6()(64bit) libstdc++.so.6(CXXABI_1.3)(64bit) libstdc++.so.6(GLIBCXX_3.4)(64bit) libutil.so.1()(64bit) libutil.so.1(GLIBC_2.2.5)(64bit) libv8-3.0.0.1.so()(64bit) libz.so.1()(64bit) rtld(GNU_HASH)
Processing files: nodejs-devel-0.4.1-1.fc15.x86_64
Provides: pkgconfig(nodejs) = 0.3.2
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /usr/bin/pkg-config
Processing files: nodejs-debuginfo-0.4.1-1.fc15.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64
Wrote: /home/nareshv/rpmbuild/RPMS/x86_64/nodejs-0.4.1-1.fc15.x86_64.rpm
Wrote: /home/nareshv/rpmbuild/RPMS/x86_64/nodejs-devel-0.4.1-1.fc15.x86_64.rpm
Wrote: /home/nareshv/rpmbuild/RPMS/x86_64/nodejs-debuginfo-0.4.1-1.fc15.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.ume4Ra
+ umask 022
+ cd /home/nareshv/rpmbuild/BUILD
+ cd node-v0.4.1
+ rm -rf /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64
+ exit 0
Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.goIXqg
+ umask 022
+ cd /home/nareshv/rpmbuild/BUILD
+ rm -rf node-v0.4.1
+ exit 0



6. Install the RPM (as root)



[nareshv@localhost SRPMS]$ sudo yum install /home/nareshv/rpmbuild/RPMS/x86_64/nodejs-0.4.1-1.fc15.x86_64.rpm --nogpg -y




7. Start node.js



[nareshv@localhost ~]$ node
> console.log("hello world!")
hello world!
>



Thats it!. Now you have node.js installed on your box.

Have a look at list of plugins and start playing with them.

5 comments:

  1. I get a lot of errors that group and user lkundrak aren't on my system -- that's kind of expected.

    I do eventually get an error from Waf:

    "ImportError: No module named js2c".

    I'm going to look around and see why that's missing.

    ReplyDelete
  2. I also found this. The thing probably is that the js2c module is not in the module path. I solved with:

    ln -s /usr/share/v8/js2c.py /usr/lib64/python2.7/
    ln -s /usr/share/v8/js2c.pyc /usr/lib64/python2.7/
    ln -s /usr/share/v8/js2c.pyo /usr/lib64/python2.7/

    ReplyDelete
  3. I got the error while downloading SRPM(as nonroot)
    HTTP request sent, awaiting response... 404 Not Found
    2013-06-20 12:12:43 ERROR 404: Not Found.

    plz help me...what i should do now.

    ReplyDelete
    Replies
    1. The rpms got deleted, you can use an alternative approach like 'nvm' to get the node installed on your system.

      Here is the link https://github.com/creationix/nvm

      Delete
  4. Thank you for sharing this information. This article is very interesting and useful. Keep up the good work!


    Melbourne Web Developer

    ReplyDelete