Redmine是用Ruby开发的基于web的项目管理软件,是用ROR框架开发的一套跨平台项目管理系统,据说是源于Basecamp的ror版而来,支持多种数据库,有不少自己独特的功能,例如提供wiki、新闻台等,还可以集成其他版本管理系统和BUG跟踪系统,例如SVN、CVS、TD等等。这种 Web 形式的项目管理系统通过“项目(Project)”的形式把成员、任务(问题)、文档、讨论以及各种形式的资源组织在一起,大家参与更新任务、文档等内容来推动项目的进度,同时系统利用时间线索和各种动态的报表形式来自动给成员汇报项目进度
这东西相对Mantis来说,我觉得看相还是不错的,但是由于是ruby写的,同时我又不是程序员,不好去评价一个东西的好坏,但是这东西就是有人用,开工,我会尽量弄详细点,赫赫.....
1、编译PHP所需要的库
libiconv库为需要做转换的应用提供了一个iconv()的函数,以实现一个字符编码到另一个字符编码的转换
[root@ErpServer script]# tar zxf libiconv-1.13.1.tar.gz
[root@ErpServer script]# cd libiconv-1.13.1
[root@ErpServer libiconv-1.13.1]# ./configure --prefix=/usr/local
[root@ErpServer libiconv-1.13.1]# make && make install
libmcrypt是加密算法扩展库。支持DES, 3DES, RIJNDAEL, Twofish, IDEA, GOST, CAST-256, ARCFOUR, SERPENT, SAFER+等算法。
[root@ErpServer script]# tar zxf libmcrypt-2.5.8.tar.gz
[root@ErpServer script]# cd libmcrypt-2.5.8/
[root@ErpServer libmcrypt-2.5.8]# ./configure
[root@ErpServer libmcrypt-2.5.8]# make && make install
[root@ErpServer libmcrypt-2.5.8]# /sbin/ldconfig
[root@ErpServer libmcrypt-2.5.8]# cd libltdl/
[root@ErpServer libltdl]# ./configure --enable-ltdl-install
[root@ErpServer libltdl]# make && make install
Mhash为PHP提供了多种哈希算法,如MD5,SHA1,GOST 等。你可以通过MHASH_hashname()来查看支持的算法有哪些。
[root@ErpServer script]# tar jxf mhash-0.9.9.9.tar.bz2
[root@ErpServer script]# cd mhash-0.9.9.9
[root@ErpServer mhash-0.9.9.9]# ./configure
[root@ErpServer mhash-0.9.9.9]# make && make install
[root@ErpServer mhash-0.9.9.9]# echo "/usr/local/lib" >>/etc/ld.so.conf && /sbin/ldconfig
Mcrypt库支持20多种加密算法和8种加密模式,具体可以通过函数mcrypt_list_algorithms()和mcrypt_list_modes()来显示
[root@ErpServer script]# tar zxf mcrypt-2.6.8.tar.gz
[root@ErpServer script]# cd mcrypt-2.6.8
[root@ErpServer mcrypt-2.6.8]# /sbin/ldconfig
[root@ErpServer mcrypt-2.6.8]# ./configure && make && make install
编译安装mysql,有关mysql的编译参数以及使用,请参考我前面的文章
[root@ErpServer script]# tar zxf mysql-5.1.68.tar.gz
[root@ErpServer script]# cd mysql-5.1.68
[root@ErpServer mysql-5.1.68]# /usr/sbin/groupadd mysql
[root@ErpServer mysql-5.1.68]# /usr/sbin/useradd -g mysql mysql
[root@ErpServer mysql-5.1.68]# ./configure --prefix=/software/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
[root@ErpServer mysql-5.1.68]# make && make install
[root@ErpServer mysql-5.1.68]# chown -R mysql:mysql /software/mysql/
[root@ErpServer mysql-5.1.68]# chmod u+w /software/mysql/
[root@ErpServer mysql-5.1.68]# mkdir -p /data/database
[root@ErpServer mysql-5.1.68]# chown -R mysql:mysql /data/database/
以mysql用户帐号的身份建立数据表:
[root@ErpServer mysql-5.1.68]# /software/mysql/bin/mysql_install_db --basedir=/software/mysql/ --datadir=/data/database/ --user=mysql
创建mysql配置文件
[root@ErpServer mysql-5.1.68]# cat /software/mysql/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysql]
no-auto-rehash
[mysqld]
user = mysql
port = 3306
socket = /tmp/mysql.sock
basedir = /software/mysql
datadir = /data/database
open_files_limit = 600
back_log = 20
max_connections = 1000
max_connect_errors = 200
table_cache = 60
external-locking = FALSE
max_allowed_packet = 16M
sort_buffer_size = 128K
join_buffer_size = 128K
thread_cache_size = 10
thread_concurrency = 8
query_cache_size = 2M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default_table_type = MyISAM
thread_stack = 192K
transaction_isolation = READ-UNCOMMITTED
tmp_table_size = 512K
max_heap_table_size = 32M
long_query_time = 1
log_long_format
server-id = 1
#log-bin = /data/soft/mysql/binlog
binlog_cache_size = 2M
max_binlog_cache_size = 4M
max_binlog_size = 512M
expire_logs_days = 7
key_buffer_size = 4M
read_buffer_size = 1M
read_rnd_buffer_size = 2M
bulk_insert_buffer_size = 2M
myisam_sort_buffer_size = 4M
myisam_max_sort_file_size = 10G
myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
[mysqldump]
quick
max_allowed_packet = 16M
修改mysqld脚本
[root@ErpServer mysql-5.1.68]# cp /software/mysql/share/mysql/mysql.server /etc/init.d/mysqld
[root@ErpServer mysql-5.1.68]# vi /etc/init.d/mysqld
basedir=/software/mysql
datadir=/data/database
启动mysql
[root@ErpServer mysql-5.1.68]# service mysqld start
[root@ErpServer mysql-5.1.68]# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 28805 mysql 3u IPv4 87995 0t0 TCP *:mysql (LISTEN)
[root@ErpServer mysql-5.1.68]# netstat -pant | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 28805/mysqld
测试登录mysql 并设置数据库密码
[root@ErpServer mysql-5.1.68]# /software/mysql/bin/mysql -u root -p
mysql> DELETE FROM mysql.user WHERE host='localhost' AND user='';
mysql> FLUSH PRIVILEGES; #设置root密码,quit退出
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('chenyi');
自启动
[root@ErpServer mysql-5.1.68]# chkconfig --add mysqld
[root@ErpServer mysql-5.1.68]# chkconfig mysqld on
[root@ErpServer mysql-5.1.68]# chkconfig --list | grep mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
编译安装PHP(FastCGI)
[root@ErpServer script]# tar zxf php-5.2.17.tar.gz
[root@ErpServer script]# gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1
[root@ErpServer script]# cd php-5.2.17
[root@ErpServer php-5.2.17]# patch -p1 <../php-5.2.17-max-input-vars.patch
[root@ErpServer php-5.2.17]# sed -i "s/\!png_check_sig (sig, 8)/png_sig_cmp (sig, 0, 8)/" ext/gd/libgd/gd_png.c
编译参数:
[root@ErpServer php-5.2.17]# ./configure --prefix=/software/php --with-config-file-path=/software/php/etc --with-mysql=/software/mysql --with-mysqli=/software/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap
如果是64位系统 由于库原因会出现 configure: error: libjpeg.(a|so) not found. 解决方法如下:
[root@localhost php-5.2.17]# cp -frp /usr/lib64/libjpeg.* /usr/lib/
[root@localhost php-5.2.17]# cp -frp /usr/lib64/libpng* /usr/lib/
[root@localhost php-5.2.17]# cp -frp /usr/lib64/libldap* /usr/lib/
继续编译
[root@ErpServer php-5.2.17]# make ZEND_EXTRA_LIBS='-liconv'
[root@localhost php-5.2.17]# make install
[root@ErpServer php-5.2.17]# cp php.ini-dist /software/php/etc/php.ini
Memcache是一个高性能的分布式的内存对象缓存系统,通过在内存里维护一个统一的巨大的hash表,它能够用来存储各种格式的数据,包括图像、视频、文件以及数据库检索的结果等。简单的说就是将数据调用到内存中,然后从内存中读取,从而大大提高读取速度。
[root@ErpServer script]# tar zxf memcache-2.2.6.tgz
[root@ErpServer script]# cd memcache-2.2.6/
[root@ErpServer memcache-2.2.6]# /software/php/bin/phpize
[root@ErpServer memcache-2.2.6]# ./configure --with-php-config=/software/php/bin/php-config
[root@ErpServer memcache-2.2.6]# make && make install
eAccelerator是一个自由开放源码php加速器,优化和动态内容缓存,提高了php脚本的缓存性能,使得PHP脚本在编译的状态下,对服务器的开销几乎完全消除。 它还有对脚本起优化作用,以加快其执行效率。使您的PHP程序代码执效率能提高1-10倍;
[root@ErpServer script]# tar jxf eaccelerator-0.9.6.1.tar.bz2
[root@ErpServer script]# cd eaccelerator-0.9.6.1/
[root@ErpServer eaccelerator-0.9.6.1]# /software/php/bin/phpize
[root@ErpServer eaccelerator-0.9.6.1]# ./configure --enable-eaccelerator=shared --with-php-config=/software/php/bin/php-config --without-eaccelerator-use-inode
[root@ErpServer eaccelerator-0.9.6.1]# make && make install
PDO版驱动
[root@ErpServer eaccelerator-0.9.6.1]# tar zxf PDO_MYSQL-1.0.2.tgz
[root@ErpServer eaccelerator-0.9.6.1]# cd PDO_MYSQL-1.0.2
[root@ErpServer PDO_MYSQL-1.0.2]# /software/php/bin/phpize
[root@ErpServer PDO_MYSQL-1.0.2]# ./configure --with-php-config=/software/php/bin/php-config --with-pdo-mysql=/software/mysql/
[root@ErpServer PDO_MYSQL-1.0.2]# make && make install
位图图形,出图用的, 现在多半使用了gd了
[root@ErpServer script]# tar zxf ImageMagick-6.7.0-8.tar.gz
[root@ErpServer script]# cd ImageMagick-6.7.0-8
[root@ErpServer ImageMagick-6.7.0-8]# ./configure && make && make install
同上
[root@ErpServer script]# tar zxf imagick-3.0.1.tgz
[root@ErpServer script]# cd imagick-3.0.1
[root@ErpServer imagick-3.0.1]# /software/php/bin/phpize
[root@ErpServer imagick-3.0.1]# ./configure --with-php-config=/software/php/bin/php-config
[root@ErpServer imagick-3.0.1]# make && make install
修改配置,如无特殊需要,你复制粘贴一般能解决问题,赫赫
[root@ErpServer imagick-3.0.1]# sed -i "s/output_buffering = Off/output_buffering = On/" /software/php/etc/php.ini
[root@ErpServer imagick-3.0.1]# sed -i "s/extension_dir =/; extension_dir =/" /software/php/etc/php.ini
[root@ErpServer imagick-3.0.1]# sed -i "s/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/" /software/php/etc/php.ini
[root@ErpServer imagick-3.0.1]# sed -i 's%;open_basedir =%open_basedir ="/tmp/:/data/www/"%' /software/php/etc/php.ini
[root@ErpServer imagick-3.0.1]# sed -i "s/disable_functions =/disable_functions = popen,pentl_exec,passthru,exec,system,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,show_source,escapeshellcmd,escapeshellarg,curl_exec,curl_multi_exec,parse_ini_file,assert/" /software/php/etc/php.ini
[root@ErpServer imagick-3.0.1]# sed -i "s/expose_php = On/expose_php = Off/" /software/php/etc/php.ini
[root@ErpServer imagick-3.0.1]# sed -i "s/display_errors = On/display_errors = Off/" /software/php/etc/php.ini
[root@ErpServer imagick-3.0.1]# sed -i "s/log_errors = Off/log_errors = On/" /software/php/etc/php.ini
在php.ini最后添加如下:
extension_dir = "/software/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"
[eaccelerator]
zend_extension="/software/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="1"
eaccelerator.cache_dir="/software/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys = "disk_only"
eaccelerator.sessions = "disk_only"
eaccelerator.content = "disk_only"
创建eAccelerator缓存目录
[root@ErpServer imagick-3.0.1]# mkdir /software/eaccelerator_cache
创建php-fpm.conf文件
[root@ErpServer imagick-3.0.1]# rm /software/php/etc/php-fpm.conf
[root@ErpServer imagick-3.0.1]# cat /software/php/etc/php-fpm.conf
[root@ErpServer imagick-3.0.1]# cat /software/php/etc/php-fpm.conf
<?xml version="1.0" ?>
<configuration>
All relative paths in this config are relative to php's install prefix
<section name="global_options">
Pid file
<value name="pid_file">/software/php/logs/php-fpm.pid</value>
Error log file
<value name="error_log">/software/php/logs/php-fpm.log</value>
Log level
<value name="log_level">notice</value>
When this amount of php processes exited with SIGSEGV or SIGBUS ...
<value name="emergency_restart_threshold">10</value>
... in a less than this interval of time, a graceful restart will be initiated.
Useful to work around accidental curruptions in accelerator's shared memory.
<value name="emergency_restart_interval">1m</value>
Time limit on waiting child's reaction on signals from master
<value name="process_control_timeout">5s</value>
Set to 'no' to debug fpm
<value name="daemonize">yes</value>
</section>
<workers>
<section name="pool">
Name of pool. Used in logs and stats.
<value name="name">default</value>
Address to accept fastcgi requests on.
Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
<value name="listen_address">127.0.0.1:9000</value>
<value name="listen_options">
Set listen(2) backlog
<value name="backlog">-1</value>
Set permissions for unix socket, if one used.
In linux read/write permissions must be set in order to allow connections from web server.
Many BSD-derrived systems allow connections regardless of permissions.
<value name="owner"></value>
<value name="group"></value>
<value name="mode">0666</value>
</value>
Additional php.ini defines, specific to this pool of workers.
<value name="php_defines">
<value name="sendmail_path">/usr/sbin/sendmail -t -i</value>
<value name="display_errors">1</value>
</value>
Unix user of processes
<value name="user">www</value>
Unix group of processes
<value name="group">www</value>
Process manager settings
<value name="pm">
Sets style of controling worker process count.
Valid values are 'static' and 'apache-like'
<value name="style">static</value>
Sets the limit on the number of simultaneous requests that will be served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.
<value name="max_children">8</value>
Settings group for 'apache-like' pm style
<value name="apache_like">
Sets the number of server processes created on startup.
Used only when 'apache-like' pm_style is selected
<value name="StartServers">20</value>
Sets the desired minimum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MinSpareServers">5</value>
Sets the desired maximum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MaxSpareServers">35</value>
</value>
</value>
The timeout (in seconds) for serving a single request after which the worker process will be terminated
Should be used when 'max_execution_time' ini option does not stop script execution for some reason
'0s' means 'off'
<value name="request_terminate_timeout">0s</value>
The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
'0s' means 'off'
<value name="request_slowlog_timeout">0s</value>
The log file for slow requests
<value name="slowlog">logs/slow.log</value>
Set open file desc rlimit
<value name="rlimit_files">65535</value>
Set max core size rlimit
<value name="rlimit_core">0</value>
Chroot to this directory at the start, absolute path
<value name="chroot"></value>
Chdir to this directory at the start, absolute path
<value name="chdir"></value>
Redirect workers' stdout and stderr into main error log.
If not set, they will be redirected to /dev/null, according to FastCGI specs
<value name="catch_workers_output">yes</value>
How much requests each process should execute before respawn.
Useful to work around memory leaks in 3rd party libraries.
For endless request processing please specify 0
Equivalent to PHP_FCGI_MAX_REQUESTS
<value name="max_requests">1024</value>
Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
Makes sense only with AF_INET listening socket.
<value name="allowed_clients">127.0.0.1</value>
Pass environment variables like LD_LIBRARY_PATH
<value name="environment">
<value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
<value name="TMP">/tmp</value>
<value name="TMPDIR">/tmp</value>
<value name="TEMP">/tmp</value>
<value name="OSTYPE">$OSTYPE</value>
<value name="MACHTYPE">$MACHTYPE</value>
<value name="MALLOC_CHECK_">2</value>
</value>
</section>
</workers>
</configuration>
创建www用户及启动php-fpm并加入启动脚本
[root@ErpServer imagick-3.0.1]# /usr/sbin/groupadd www
[root@ErpServer imagick-3.0.1]# /usr/sbin/useradd -g www www
[root@ErpServer imagick-3.0.1]# mkdir /data/www
[root@ErpServer imagick-3.0.1]# chown -R www:www /data/www
[root@ErpServer imagick-3.0.1]# chmod +w /data/www
[root@ErpServer imagick-3.0.1]# ulimit -SHn 65535
[root@ErpServer imagick-3.0.1]# /software/php/sbin/php-fpm start
Starting php_fpm done
rc.local,还用多说什么。。。
[root@ErpServer imagick-3.0.1]# echo "ulimit -SHn 65535" >> /etc/rc.local
[root@ErpServer imagick-3.0.1]# echo "/software/php/sbin/php-fpm start" >> /etc/rc.local
编译安装Nginx-1.0.1
[root@ErpServer script]# tar zxf pcre-8.21.tar.gz
[root@ErpServer script]# cd pcre-8.21
[root@ErpServer pcre-8.21]# ./configure && make && make install
安装nginx
[root@ErpServer script]# tar zxf nginx-1.2.7.tar.gz
[root@ErpServer script]# cd nginx-1.2.7
[root@ErpServer nginx-1.2.7]# ./configure --user=www --group=www --prefix=/software/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_dav_module --with-http_flv_module --with-http_addition_module --with-http_sub_module
[root@ErpServer nginx-1.2.7]# make && make install
[root@ErpServer script]# rm -rf /software/nginx/conf/nginx.conf
[root@ErpServer script]# cat /software/nginx/conf/nginx.conf
user www www;
worker_processes 1;
error_log /software/nginx/logs/error.log crit;
pid /software/nginx/conf/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 10240;
}
http
{
include mime.types;
default_type application/octet-stream;
#charset gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m;
include server/*.txt;
server
{
listen 80;
server_name default;
index index.php;
root /data/www/test;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
}
启动nginx并进行测试
[root@ErpServer script]# /software/nginx/sbin/nginx -t
nginx: the configuration file /software/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /software/nginx/conf/nginx.conf test is successful
[root@ErpServer script]# /software/nginx/sbin/nginx
[root@ErpServer script]# mkdir /data/www/test
[root@ErpServer script]# echo "<?php phpinfo();?>" > /data/www/test/index.php
[root@ErpServer script]# echo "/data/soft/nginx/sbin/nginx" >> /etc/rc.local
时间问题,不继续发了,先发张成果图在这供大家参考下(单击放大):