看这篇文章之前请确认服务器有超过1G的内存,不然可以不用看了
我在阿里云ECS上面搭建的:
1
2
3
4
|
# uname -a Linux fbctf 3.13.0-86-generic #130-Ubuntu SMP Mon Apr 18 18:27:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux # cat /etc/issue Ubuntu 14.04.5 LTS |
首先在/etc/apt/sources.list
加上以下源(或者直接替换)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyuncs.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://dl.hhvm.com/ubuntu trusty main deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty-backports main restricted universe multiverse |
其次执行以下命令:不然hhvm
会一直找不到装不上
1
|
echo '140.211.166.134 dl.hhvm.com' >> /etc/hosts |
官方源码及安装指导在这里:FBCTF
以上设置完毕后我们直接敲下面的代码(root下):
1
2
3
4
5
|
sudo apt-get update sudo apt-get install git curl git clone https://github.com/facebook/fbctf cd fbctf ./extra/provision.sh -m prod -s $PWD |
经过漫长的等待,又遇到下面这个问题:
1
|
Fatal error: unexpected St13runtime_error: locale::facet::_S_create_c_locale name not valid |
解决办法
1
2
3
4
5
6
|
$ vim etc/default/locale # 加上下面这两句 LC_CTYPE="en_US.UTF-8" LC_ALL="en_US.UTF-8" $ export LC_ALL=C # 重新连接ssh |
再次经过无敌漫长的等待…又出错了,安装flow-bin等很久,自己本机下载一下上传到服务器,用下面命令安装一下,可能还会有其他包也会遇到等很久,那是网络问题,同样的方法解决下就可以了(要在fbctf目录下)
1
|
npm install --save-dev -g ../flow-bin-0.33.0.tgz |
经过无数次的失败、尝试和等待,灰头土脸的摸索出点经验,一开始要么你直接把fbctf整个文件夹移动到/var/www/
下再安装,要么直接用下面这个命令:
1
|
./extra/provision.sh -m prod -s $PWD -d $PWD |
这边还需要自己手动装下unison
放到/
目录下:
1
2
|
cd / tar -xJvf unison-2.48.4-1-x86_64.pkg.tar.xz |
1
|
sudo tar Jxvf unison-2.48.4-1-x86_64.pkg.tar.xz |
到最后离成功只有一步了,报错了,看了一下Cannot allocate memory
,查了一下才知道hhvm内存大户,虽说fbctf建议1GB或者以上的内存
,但是光有1G还是跑不起来,毕竟还要运行其他程序。最后查了很多资料没办法解决,如果想装的话2G内存就很理想,不会有问题了。这边先放着,等后面摸个大内存的服务器再试行。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
[+] Enabling HHVM RepoAuthoritative mode running hphp... parsing inputs... Unable to stat file /var/www/fbctf/vendor/phpunit/php-token-stream/tests/_fixture/test1.php Unable to stat file /var/www/fbctf/vendor/phpunit/php-token-stream/tests/_fixture/test2.php Unable to stat file /var/www/fbctf/vendor/phpunit/php-token-stream/tests/_fixture/test3.php Unable to stat file /var/www/fbctf/vendor/phpunit/php-token-stream/tests/_fixture/test4.php Unable to stat file /var/www/fbctf/vendor/phpunit/php-token-stream/vendor/autoload.php Unable to stat file /var/www/fbctf/vendor/phpunit/phpunit-mock-objects/vendor/autoload.php Unable to stat file /var/www/fbctf/vendor/phpunit/phpunit/build/tools/phar:/composer.phar/bin/composer Unable to stat file /var/www/fbctf/vendor/phpunit/phpunit/vendor/autoload.php Unable to stat file /var/www/fbctf/vendor/sebastian/comparator/vendor/autoload.php Unable to stat file /var/www/fbctf/vendor/sebastian/resource-operations/build/arginfo.php analyzeProgram... analyzeProgram took 0'00" (748143 us) wall time parsing inputs took 2'02" (122352354 us) wall time pre-optimizing... Assertion failure: /tmp/tmp.3f6VuVMO0N/hphp/runtime/base/rds.cpp:534: void HPHP::rds::threadInit(): assertion `tl_base != ((void *) -1)' failed. Failed to mmap persistent RDS region. errno = Cannot allocate memory Core dumped: Aborted Stack trace in /tmp/stacktrace.2075.log hphp failed running hphp took 2'03" (123549962 us) wall time |