1.按照How to successfully build packages for WD My Cloud from source中的介绍,搭建完成WDMyCloud
的编译环境
2.使用如下方式编译:
$ su $ cd ~/wdmc-build/64k-jessie $ chroot build $ mount -t proc none /proc $ mount -t devtmpfs none /dev $ mount -t devpts none /dev/pts $ export DEBIAN_FRONTEND=noninteractive $ export DEBCONF_NONINTERACTIVE_SEEN=true $ export LC_ALL=C $ export LANGUAGE=C $ export LANG=C $ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' $ export DEB_BUILD_OPTIONS=nocheck $ cd root $ apt-get update $ apt-get upgrade $ apt-get install ca-certificates $ apt-get install dh-autoreconf $ apt-get install git $ apt-get install apache2-dev $ apt-get install apache2 $ apt-get install systemtap-sdt-dev $ apt-get install libxml2 $ apt-get install libxml2-dev $ apt-get install libssl-dev $ apt-get install libpcre3 libpcre3-dev $ apt-get install libsqlite3-dev $ apt-get install libbz2-dev $ apt-get install libcurl4-openssl-dev $ apt-get install libqdbm-dev $ apt-get install libdb-dev #configure: error: Cannot find enchant $ apt-get install enchant libenchant-dev #configure: error: webp/decode.h not found $ apt-get install libwebp-dev #configure: error: png.h not found. $ apt-get install libpng-dev #configure: error: xpm.h not found. $ apt-get install libxpm-dev #configure: error: freetype-config not found. $ apt-get install libfreetype6-dev #configure: error: Unable to find gd.h anywhere under /usr $ apt-get install libgd-dev #configure: error: Unable to locate gmp.h $ apt-get install libgmp-dev #configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information. $ apt-get install libc-client-dev #configure: error: Kerberos libraries not found. $ apt-get install libkrb5-dev #configure: error: libfbclient, libgds or libib_util not found! Check config.log for more information. $ apt-get install firebird-dev #configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works. $ apt-get install libicu-dev #configure: error: sasl.h not found! $ apt-get install libsasl2-dev #configure: error: mcrypt.h not found. Please reinstall libmcrypt. $ apt-get install libmcrypt-dev #checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found! $ apt-get install unixODBC-dev #configure: error: Directory /usr is not a FreeTDS installation directory $ apt-get install FreeTDS-dev #configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path $ apt-get install libpq-dev #configure: error: Cannot find pspell $ apt-get install libpspell-dev #configure: error: Please reinstall libedit - I cannot find readline.h $ apt-get install libedit-dev #configure: error: Can not find recode.h anywhere under /usr /usr/local /usr /opt. $ apt-get install librecode-dev #configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation. $ apt-get install libsnmp-dev #configure: error: Cannot find libtidy $ apt-get install libtidy-dev #checking for XMLRPC-EPI in default path... not found $ apt-get install libxmlrpc-epi-dev #configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution $ apt-get install libxslt-dev #configure: error: Please reinstall the libzip distribution $ apt-get install libzip-dev $ git clone -b master-7.1 https://gitlab.com/deb.sury.org/php.git php7 --depth=1 $ cd php7 #禁用systemd $ sed -i "s/CONFIGURE_SYSTEMD *:= *--with-fpm-systemd/CONFIGURE_SYSTEMD := --without-fpm-systemd/g" debian/rules $ sed -i "s/DH_SYSTEMD *:= *--with systemd/DH_SYSTEMD :=/g" debian/rules $ dpkg-buildpackage -d -b -uc #编译依赖包php-common $ cd .. $ git clone -b debian/50 git://anonscm.debian.org/pkg-php/php-defaults.git $ cd php-defaults #禁用systemd $ sed -i "s/DH_SYSTEMD *:= *--with *systemd/DH_SYSTEMD :=/g" debian/rules $ dpkg-buildpackage -d -b -uc $ exit
3.编译php-apcu
,这个模块WD MyCloud
需要
$ su $ cd ~/wdmc-build/64k-jessie $ chroot build $ mount -t proc none /proc $ mount -t devtmpfs none /dev $ mount -t devpts none /dev/pts $ export DEBIAN_FRONTEND=noninteractive $ export DEBCONF_NONINTERACTIVE_SEEN=true $ export LC_ALL=C $ export LANGUAGE=C $ export LANG=C $ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' $ export DEB_BUILD_OPTIONS=nocheck $ cd root #安装依赖 $ apt-get install shtool $ apt-get install liblist-moreutils-perl $ apt-get install xml2 # "dch" command $ apt-get install devscripts #安装我们刚刚编译好的PHP7包 $ dpkg -i php-common_50_all.deb $ dpkg -i php7.1-common_7.1.10-1_armhf.deb $ dpkg -i php7.1-readline_7.1.10-1_armhf.deb $ dpkg -i php7.1-opcache_7.1.10-1_armhf.deb $ dpkg -i php7.1-json_7.1.10-1_armhf.deb $ dpkg -i php7.1-cli_7.1.10-1_armhf.deb $ dpkg -i php7.1-dev_7.1.10-1_armhf.deb #编译依赖 $ git clone git://anonscm.debian.org/pkg-php/dh-php.git $ cd dh-php $ git checkout debian/0.26 -b debian/0.26 $ dpkg-buildpackage -d -b -uc $ cd .. $ dpkg -i dh-php_0.26_all.deb #参考 https://packages.debian.org/source/sid/php-apcu # git://anonscm.debian.org/pkg-php/php-apcu.git #https://pecl.php.net/package/APCu $ git clone git://anonscm.debian.org/pkg-php/php-apcu.git $ cd php-apcu $ git checkout debian/5.1.8+4.0.11-1 -b debian/5.1.8+4.0.11-1 #Build the package $ debuild -b -d -uc -us $ cd .. $ dpkg -i php-apcu_5.1.8+4.0.11-1_armhf.deb $ git clone git://anonscm.debian.org/pkg-php/php-apcu-bc.git $ cd php-apcu-bc $ debuild -b -d -uc -us $ exit
上面下载的代码由于是国外的服务器,因此可能会出现一直无法下载成功的情况,可以从这里下载代码的拷贝。PHP源代码点击这里,PHP7 Debian编译配置文件点击这里,dh-php源代码点击这里,php-apcu源代码点击这里, php-apcu-bc源代码点击这里。
在WDMyCloud
中安装的时候执行如下命令:
$ sudo apt-get update $ sudo apt-get install -y --force-yes php7.1 $ sudo apt-get install -y --force-yes libapache2-mod-php7.1 $ sudo apt-get install -y --force-yes php7.1-curl $ sudo apt-get install -y --force-yes php-apcu $ sudo apt-get install -y --force-yes php-apcu-bc $ sudo apt-get install -y --force-yes php7.1-xml #这个是个坑,如果没有增加这个模块,也是可以正常启动的,但是却没办法正常登录进入,应用会出现异常 $ sudo apt-get install -y --force-yes php7.1-mbstring #由于PHP7中的parse_ini_file不再兼容“#”作为注释字符,只能使用“;”进行注释,但是这个注释无法 #被其他应用读取,而WDMyCloud里面的其他脚本也需要读取/etc/system.conf里面的内容 #目前唯一的解决方法就是删除全部的注释行 # /var/www/htdocs/UI/index.php $ sudo cp /etc/system.conf /etc/system.conf.bak $ sudo sed -i '/^#/d' /etc/system.conf #语法调整 $ sudo cp /var/www/htdocs/UI/views/common/dates.php /var/www/htdocs/UI/views/common/dates.php.bak $ sudo sed -i 's/^<?.*$/<?php/g' /var/www/htdocs/UI/views/common/dates.php #/var/www/htdocs/UI/views/layouts/main/main.php $ sudo cp /etc/php5/apache2/conf.d/include_path.ini /etc/php/7.1/apache2/conf.d/ $ sudo chmod 777 /etc/php/7.1/apache2/conf.d/include_path.ini $ sudo a2dismod php5 $ sudo a2enmod php7.1 $ sudo phpenmod curl $ sudo service apache2 restart
注意,这部分的功能目前仅仅是可用,还没有达到完全正常的情况,如果出现问题,可以切换回PHP5
,目前已知的完美切换回到原来的PHP5
的办法就是卸载上面安装的所有PHP7
的相关应用才能切换成功,否则总有部分小功能不是太正常.