CentOS NodeJS PhantomJS PhearJS 失败的尝试……

Install GCC 4.8+

PhearJS 需要 C11 的支持,而 CentOS 6 目前最新的 gcc 不支持。所以需要自己编译安装 gcc 。这里以 gcc 4.9.4 为例,下载链接以中科大镜像为例:

$ cd ~
$ wget -c http://mirrors.ustc.edu.cn/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.bz2
$ tar -jxvf gcc-4.9.4.tar.bz2
$ ./contrib/download_prerequisites
$ cd ..
$ mkdir gcc4.9.4-build
$ cd gcc4.9.4-build
$ ../gcc-4.9.4/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
$ make -j4
$ sudo make install

安装完成后,可以查看 gcc 的版本:

$ gcc --version
gcc (GCC) 4.9.4
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.

Install Binutils

在 configure glibc 2.24 的过程中,会提示 as ld 版本过低,所以要首先升级 binutils 。

$ cd ~
$ wget -c http://mirrors.ustc.edu.cn/gnu/binutils/binutils-2.27.tar.gz
$ tar zxvf binutils-2.27.tar.gz
$ mkdir binutils2.27-build && cd binutils2.27-build
$ ../binutils-2.27/configure
$ make -j4
$ make install

Install GLIBC

$ wget -c http://mirrors.ustc.edu.cn/gnu/glibc/glibc-2.24.tar.gz
$ tar zxvf glibc-2.24.tar.gz
$ mkdir glibc2.24-build && cd glibc2.24-build
$ ../glibc-2.24/configure
$ 

configure 的过程提示:

configure: error: 
*** These critical programs are missing or too old: as ld
*** Check the INSTALL file for required versions.

似乎要先把 binutils 也更新了……
然而,在更新了 binutils 之后,又遇到了 linux kernel header files missing or too old! 的问题……感觉还是换服务器比较合适……之前在 Archlinux 上运行 PhearJS 成功过。

checking installed Linux kernel header files... missing or too old!
configure: error: GNU libc requires kernel header files from
Linux 3.2.0 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 3.2.0 or later.  This check uses <linux/version.h>,so
make sure that file was built correctly when installing the kernel header
files.  To use kernel headers not from /usr/include/linux,use the
configure option --with-headers.

Install NodeJS

通过源码编译安装的方法:

$ wget -c https://nodejs.org/dist/v6.9.1/node-v6.9.1.tar.gz
$ tar zxvf node-v6.9.1.tar.gz
$ cd node-v6.9.1
$ ./configure
$ make -j4
$ sudo make install

Install PhantomJS

PhantomJS 的安装比较简单,直接从 PhantomJS 官网下载 binary package ,解压,放入路径中就可以了。本文以 PhantomJS 2.1.1 为例

$ sudo yum install fontconfig
$ cd ~
$ wget -c https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
$ tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2
$ mv phantomjs-2.1.1-linux-x86_64 phantomjs

向 ~/.bashrc 中添加如下的内容:

export PATH=$HOME/phantomjs/bin:$PATH

Install memcached

$ sudo yum install memcached

Install PhearJS

$ cd ~
$ git clone https://github.com/Tomtomgo/phearjs.git
$ cd ~/phearjs
$ npm install

如果觉得 npm 太慢,国内的玩家可以考虑阿里巴巴的淘宝 NPM 镜像: https://npm.taobao.org/
先用以下命令安装 cnpm :

$ sudo npm install -g cnpm --registry=https://registry.npm.taobao.org

然后用 cnpm install 替换 npm install

相关文章

linux下开机自启: 在/etc/init.d目录下新建文件elasticsear...
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以...
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用...
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一...
设置时区(CentOS 7) 先执行命令timedatectl status|grep &...
vim&#160;/etc/sysconfig/network-scripts/ifcfg-eth0 B...