F2etest是阿里巴巴开源的一个面向前端、测试、产品等岗位的多浏览器兼容性测试整体解决方案,GitHub地址:https://github.com/alibaba/f2etest
本文参考F2etest官方docker部署方案(https://www.yuque.com/artist/f2etest),请严格按照本教程进行安装,请先确保成功一次再进行二次修改!
前期准备:
CentOS7系统,4C4G,IP地址:192.168.1.201,关闭防火墙,关闭selinux
Windows2008r2系统,4C4G,IP地址:192.168.1.207,关闭防火墙
CentOS7配置开始
1、添加wlnmp源
rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm
2、安装所需依赖
yum install gcc gcc-c++ wget libpng-devel cairo-devel uuid-devel git libvncserver-devel
3、克隆f2etest镜像
由于github过慢,我这里做了码云的镜像,以下任选其一
cd /root
git clone https://github.com/alibaba/f2etest.git
git clone https://gitee.com/whsir/f2etest.git
4、安装jdk
yum install jdk1.8
5、安装tomcat
yum install tomcat
6、安装freerdp依赖
CentOS7与CentOS6不同,CentOS7默认提供的freerdp是2.0版本,经过测试guacamole-server编译时无法找到该包,所以我这里需要安装1.0版本的freerdp。
freerdp-devel-1.0.2和freerdp-libs-1.0.2来自ftp.scientificlinux.org提供的包,为了方便大家安装,我直接将其放在了wlnmp源中
yum install freerdp-devel-1.0.2 freerdp-libs-1.0.2
安装yum-plugin-versionlock插件,锁定版本防止误升级 (可选)
yum install yum-plugin-versionlock
加锁防止误升级
yum versionlock add freerdp-devel freerdp-libs
7、编译guacamole-server
cd f2etest/f2etest-guacamole
tar xf guacamole-server-0.9.3.tar.gz
cd guacamole-server-0.9.3
./configure --with-init-dir=/etc/init.d
确保运行完毕后,RDP为yes
------------------------------------------------
guacamole-server version 0.9.3
Library status:
freerdp ............. yes
pango ............... no
libssh2 ............. no
libssl .............. no
libtelnet ........... no
libVNCServer ........ yes
libvorbis ........... no
libpulse ............ no
Protocol support:
RDP ....... yes
SSH ....... no
Telnet .... no
VNC ....... yes</pre>
make -j 8
make install
ldconfig
chkconfig --add guacd
chkconfig guacd on
/etc/init.d/guacd start
8、配置guacamole-client
guacamole默认配置文件在/etc/guacamole下,需要手动创建
mkdir /etc/guacamole
mkdir /usr/share/tomcat/.guacamole
ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat/.guacamole
创建guacamole.properties配置文件
vi /etc/guacamole/guacamole.properties
内容如下
# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port: 4822
enable-websocket: true
enable-clipboard-integration: true
auth-provider: net.sourceforge.guacamole.net.auth.noauth.NoAuthenticationProvider
noauth-config: /etc/guacamole/noauth-config.xml
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider
basic-user-mapping: /etc/guacamole/user-mapping.xml
创建noauth-config配置文件
vi /etc/guacamole/noauth-config.xml
内容如下
<configs>
<config name="f2etest-ie8" protocol="rdp">
<param name="hostname" value="192.168.1.207" />
<param name="port" value="3389" />
<param name="enable-drive" value="true" />
<param name="drive-path" value="/home/guacdshare" />
</config>
</configs>
参数说明:
<config name="f2etest-ie8" protocol="rdp">:远程连接服务器的名称及协议,其中name对应F2etest-web的conf/app.json中的server
<param name="hostname" value="192.168.1.207" />:此处的IP地址为windows-server的IP
<param name="enable-drive" value="true" />:是否启动文件传输功能
<param name="drive-path" value="/home/guacdshare" />:文件传输的存储位置,如果未开启文件传输,此项会被忽略
9、启动guacamole-client
mv /root/f2etest/f2etest-guacamole/guacamole-0.9.3.war /usr/share/tomcat/webapps/guacamole.war
systemctl enable tomcat
systemctl start tomcat
10、验证guacamole-client
访问:http://192.168.1.201:8080/guacamole/
如果配置一切正常即可看到以下页面,一定要确保看到的是以下页面
PS:如果出现以下登陆窗口,请确认是不是因为没有做以下操作
mkdir /usr/share/tomcat/.guacamole
ln -sv /etc/guacamole/guacamole.properties /usr/share/tomcat/.guacamole
11、配置F2etest-web
mkdir -p /data/www
cp -R /root/f2etest/f2etest-web/ /data/www/
cd /data/www/f2etest-web
vi conf/site.json
{
"port": 3000,
"name": "F2etest",
"about": "浏览器云测平台",
"icon": "/favicon.ico",
"dbHost": "127.0.0.1",
"dbUser": "root",
"dbPass": "",
"dbTable": "f2etest",
"clientApiKey":"f2etest",
"guacamoleApi": "http://192.168.1.201:8080/guacamole/client.xhtml",
"footer": "",
"wdEnabled": false,
"wdCheckNodesInterval": 5000,
"wdCheckNodesParallelLimit": 16
}
参数说明:
port:通过浏览器访问的端口
name和about:就是浏览器的title,即<title>F2etest - 浏览器云测平台</title>
icon:站点图标,该图标在public/favicon.ico
dbHost:数据库地址
dbUser:数据库用户名
dbPass:数据库密码,不填就是空
dbTable:数据库名称
clientApiKey:该值与windows-server中setUser.asp的key一致
guacamoleApi:此处地址是guacamole-client
footer:页面底部© alibaba.com 2019后面的文案
wdEnabled:是否开启WebDriver云,默认关闭
wdCheckNodesInterval:定时检查WebDriver节点是否空闲、运行中、不可用,单位ms
wdCheckNodesParallelLimit:定时检查节点并发限制
vi conf/server.json
删除原有文件,配置以下内容
[
{
"id": "f2etest-ie8",
"ip": "192.168.1.207",
"remoteApp": true
}
]
参数说明:
id:服务器名称,必须与app.json中的server名称保持一致
ip:服务器的IP地址,即windows-server的IP
vi conf/app.json
删除原有文件,配置以下内容
[
{
"id": "hostsshare",
"name": "hosts",
"server": "f2etest-ie8",
"program": "c:\\app\\hostsshare.bat"
},
{
"id": "ie8",
"name": "IE 8",
"server": "f2etest-ie8",
"program": "c:\\app\\ie8.bat"
}
]
参数说明:
id:对应浏览器云测平台界面中的图标,即public/imgs/ico目录中的图标,名称需和目录中的图标对应
name:浏览器云测平台界面中图标下方显示的名称
server:对应server.json中的id
program:windows-server中配置的文件位置
12、安装mysql
通过wlnmp源安装mysql,数据库默认密码为空
yum install wmysql55
导入数据库
mysql < /data/www/f2etest-web/f2etest.sql
13、安装NodeJS8.x
curl -sL https://rpm.nodesource.com/setup_8.x | bash -
yum install nodejs
node --version
v8.16.2
npm --version
6.4.1
14、更换npm国内镜像
npm config set registry https://registry.npm.taobao.org
15、安装pm2
npm install -g pm2@3.5.1
安装f2etest-web相关依赖
npm install
16、启动f2etest-web
通过pm2启动f2etest-web
pm2 start app.js --name f2etest-web
重启命令
pm2 restart f2etest-web
启动成功后即可看到3000端口