2011/11/13(日)QNAP TS-219P+を設定完了 (5) セットアップ備忘録。

はてブ数 2011/11/13 12:06 計算機な日記::ボクと計算機つーさ

セットアップのために打ち込んだコマンド群をメモっておく。
新たにQNAPのNASを使いたい人にとっては参考になるとかならないとか。

QNAP TS-219P+ @3.5.0 Build 0816T
apacheは自分で入れるが、mysqlは最初から入ってるやつを使う。

# system
	ipkg install bash coreutils findutils diffutils util-linux-ng procps
	ipkg install less grep sed gawk screen sudo
	ipkg install vim
	ipkg install wget tar unzip git svn patch
	ipkg install gcc make automake autoconf re2c
	ipkg install openssh memcached
	ipkg install openssl openssl-dev
	ipkg install libjpeg libpng zlib mysql freetype libxml2
	ln -s /opt/bin/arm-none-linux-gnueabi-gcc /opt/bin/arm-none-linux-gnueabi-ld

	# 自分でコンパイルして入れるものは /opt/localに入れることにする。
	mkdir /share/MD0_DATA/local
	ln -s /share/MD0_DATA/local /opt/local
	
	cd /opt/local
	mkdir src
	cd src

# perl
	# 注意: ipkg で perl-dbd-mysql を入れると、mysql4 がインストールされる
	ipkg install perl perl-dbi perl-extutils-cbuilder perl-gd perl-cgi perl-html-parser perl-xml-parser perl-xml-dom perl-xml-regexp
	ln -s /opt/bin/perl /usr/bin/perl
	ln -s /opt/bin/perl /usr/local/bin/perl
	ln -s /usr/local/mysql/bin/* /usr/local/bin/
	
	# cpanminus (cpan重いから)
	wget http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.4008.tar.gz
	tar xf App-cpanminus-1.4008.tar.gz
	cd App-cpanminus-1.4008
	perl Makefile.PL && make && make install
	cd ..
	
	# DBD::mysql
	cpanm DBD::mysql
	
	# ImageMagick
	wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
	tar xf ImageMagick.tar.gz
	cd ImageMagick-*
	CFLAGS="-O3" CXXFLAGS="-O3" LDFLAGS="-O3" ./configure --prefix=/opt/local/magick --with-perl=yes --with-xml
	make && make install
	cd ..

# apache2
	wget "http://ftp.riken.jp/net/apache//httpd/httpd-2.2.19.tar.gz"
	tar xf httpd-2.2.19.tar.gz 
	cd httpd-2.2.19

	# woker
	rm -rf /opt/local/apache2
	make distclean
	CFLAGS="-O3" CXXFLAGS="-O3" LDFLAGS="-O3" ./configure -C --prefix=/opt/local/apache2 --enable-so --enable-mods-shared=all --enable-auth-digest --enable-cache --enable-dav --enable-dav-fs --enable-deflate --enable-disk-cache --enable-file-cache --enable-mem-cache --enable-headers --enable-expires --enable-info  --enable-mime-magic --enable-proxy --enable-proxy-ftp --enable-proxy-http --enable-rewrite --enable-ssl --enable-vhost-alias --with-mpm=worker --with-z=/opt --with-ssl=/opt
	make && make install 
	mv /opt/local/apache2 /opt/local/apache2.worker

	# prefork
	rm -rf /opt/local/apache2
	make distclean
	CFLAGS="-O3" CXXFLAGS="-O3" LDFLAGS="-O3" ./configure -C --prefix=/opt/local/apache2 --enable-so --enable-mods-shared=all --enable-auth-digest --enable-cache --enable-dav --enable-dav-fs --enable-deflate --enable-disk-cache --enable-file-cache --enable-mem-cache --enable-headers --enable-expires --enable-info  --enable-mime-magic --enable-proxy --enable-proxy-ftp --enable-proxy-http --enable-rewrite --enable-ssl --enable-vhost-alias --with-mpm=prefork --with-z=/opt --with-ssl=/opt
	make && make install 
	mv /opt/local/apache2 /opt/local/apache2.prefork

	cd ..

	# mod_perl
	wget http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz
	tar xf mod_perl-2.0-current.tar.gz
	cd mod_perl-2.0.5
	perl Makefile.PL MP_APXS=/opt/local/apache2/bin/apxs
	make && make install
	cd ..

# php
	wget "http://jp2.php.net/get/php-5.3.7.tar.gz/from/jp.php.net/mirror"
	tar xf php-5.3.7.tar.gz 
	cd php-5.3.7

	patch -p0 << __EOF__
--- ext/standard/php_crypt_r.c	2011-08-21 18:18:43.057585724 +0900
+++ ext/standard/php_crypt_r.c.new	2011-08-21 18:19:52.097619638 +0900
@@ -94,6 +94,8 @@
 if (!initialized) {
 #ifdef PHP_WIN32
 		InterlockedIncrement(&initialized);
+#elif 1
+		initialized = 1;
 #elif (defined(__GNUC__) && !defined(__hpux) && (__GNUC__ > 4 || \\
     (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 1)))))
 		__sync_fetch_and_add(&initialized, 1);
__EOF__

	CFLAGS="-O3" CXXFLAGS="-O3" LDFLAGS="-O3" ./configure --prefix=/opt/local/php5 --enable-libgcc --with-gnu-ld --with-pear --enable-zend-multibyte --with-apxs2=/opt/local/apache2/bin/apxs --enable-cgi --enable-mbstring --enable-mbregex --with-gd  --with-zlib-dir=/opt --with-libxml-dir=/opt --with-jpeg-dir=/opt --with-png-dir=/opt  --with-freetype-dir=/opt  --enable-exif --with-mysql=/usr/local/mysql --enable-pdo --with-pdo-mysql=/usr/local/mysql --with-config-file-path=/opt/local/php5/conf --with-config-file-scan-dir=/opt/local/php5/conf/extra.d --enable-bcmath --enable-ftp --enable-sockets --enable-soap --with-xmlrpc --with-mysqli=/usr/local/mysql/bin/mysql_config --with-openssl=/opt
	make && make install
	ln -s /opt/local/php5/bin/* /usr/local/bin/
	cd ..

	ipkg install 

	# eaccelerator
	wget "http://downloads.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Feaccelerator%2Ffiles%2Feaccelerator%2FeAccelerator%25200.9.6.1%2F&ts=1313939262&use_mirror=cdnetworks-kr-1"
	tar xf eaccelerator-0.9.6.1.tar.bz2
	cd eaccelerator-0.9.6.1
	phpize
	CFLAGS=-O3 CXXFLAGS=-O3 LDFLAGS=-O3 ./configure --prefix=/opt/local/eaccelerator --enable-eaccelerator --with-eaccelerator-disassembler --with-eaccelerator-userid=httpdusr --with-gnu-ld
	make && make install
	cd ..
	
	# memcache
	pecl download memcache
	tar xf memcache-2.2.6.tgz
	cd memcache-2.2.6
	phpize
	CFLAGS="-O3" CXXFLAGS="-O3" LDFLAGS="-O3" ./configure --prefix=/opt/local/memcache --with-zlib-dir=/opt
	make && make install
	cd ..
	
	# apc
	pecl install APC

# nginx
	wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.tar.gz && tar xf pcre-8.13.tar.gz
	wget http://www.openssl.org/source/openssl-1.0.0d.tar.gz && tar xf openssl-1.0.0d.tar.gz
	wget http://nginx.org/download/nginx-1.0.5.tar.gz && tar xf nginx-1.0.5.tar.gz
	cd nginx-1.0.5
	CFLAGS="-O3" CXXFLAGS="-O3" LDFLAGS="-O3" ./configure --prefix=/opt/local/nginx --user=httpdusr --group=everyone --with-http_perl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_ssl_module --with-http_dav_module --with-perl=/opt/bin/perl --with-pcre=../pcre-8.13 --with-openssl=../openssl-1.0.0d
	make && make install
	cd ..

# OpenPNE3
	cd /share/Web
	git clone git://github.com/openpne/OpenPNE3.git
	cd OpenPNE3
	git checkout OpenPNE-3.6beta13
	#./symfony openpne:install
	while [ 1 ]; do echo -e "mysql\\nopenpne\\nhogefugapiyo\\nlocalhost\\n3306\\nopenpne\\n/tmp/mysql.sock\\nY" | ./symfony openpne:install; [ "$?" -ne "0" ] || break; done
	
	# plugins
	./symfony opPlugin:install opAutoFriendPlugin -r 1.1.0
	./symfony opPlugin:install opCalendarPlugin -r 0.9.3.1
	./symfony opPlugin:install opCommunityIntroductionPlugin -r 0.9.0 --force-license
	./symfony opPlugin:install opInquiryLEPlugin -r 1.0.0.1
	./symfony opPlugin:install opNicePlugin -r 0.9.3
	./symfony opPlugin:install opTagPlugin -r 0.9.3
	./symfony opPlugin:install opWikifyPlugin -r 1.0

	#./symfony openpne:migrate
	while [ 1 ]; do ./symfony openpne:migrate; [ "$?" -ne "0" ] || break; done
	
	cd -