centos5.8下FastDFS分布式文件系统+redis+ImageMagick

#所需安装包
FastDFS_v3.08.tar.gz
ImageMagick-6.7.7-6.tar.gz
libevent-2.0.19-stable.tar.gz
nicolasff-phpredis-2.2.1-59-gf1231c9.zip
redis-2.4.14.tar.gz
ZendServer-5.6.0-RepositoryInstaller-linux.tar.gz
#安装环境依赖包
yum install gcc
#查看libevent是否已安装
ls -al /usr/lib | grep libevent
#安装libevent
tar zxvf libevent-2.0.19-stable.tar.gz
cd libevent-2.0.19-stable
./configure --prefix=/usr/local/libevent
make
make install

#安装fastdfs
tar zxvf FastDFS_v3.08.tar.gz
cd FastDFS
vim make.sh
WITH_HTTPD=1
WITH_LINUX_SERVICE=1
#如果fastdfs需要支持web和开机自动脚本(默认是不支持的),需要修改make.sh文件
./make.sh C_INCLUDE_PATH=/usr/local/libevent/include LIBRARY_PATH=/usr/local/libevent/lib
./make.sh install
#创建数据存放目录
mkdir -p /data/fastdfs
#修改配置文件
vim /etc/fdfs/tracker.conf
disabled=false
bind_addr=
port=22122
connect_timeout=30
network_timeout=60
base_path=/data/fastdfs/tracker #需修改的
max_connections=256
work_threads=4
store_lookup=2
store_group=group2
store_server=0
store_path=0
download_server=0
reserved_storage_space = 4GB
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
sync_log_buff_interval = 10
check_active_interval = 120
thread_stack_size = 64KB
storage_ip_changed_auto_adjust = true
storage_sync_file_max_delay = 86400
storage_sync_file_max_time = 300
use_trunk_file = false
slot_min_size = 256
slot_max_size = 16MB
trunk_file_size = 64MB
trunk_create_file_advance = false
trunk_create_file_time_base = 02:00
trunk_create_file_interval = 86400
trunk_create_file_space_threshold = 20G
http.disabled=true #按需修改的
http.server_port=8080
http.check_alive_interval=30
http.check_alive_type=tcp
http.check_alive_uri=/status.html
http.need_find_content_type=true

vim /etc/fdfs/storage.conf
disabled=false
group_name=group1
#因当前环境tracker与storage为同一台服务器故tracker_server指向本机
bind_addr=192.168.0.249 #需修改的
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/data/fastdfs/storage #需修改的
max_connections=256
buff_size = 256KB
work_threads=4
disk_rw_separated = true
disk_reader_threads = 1
disk_writer_threads = 1
sync_wait_msec=50
sync_interval=0
sync_start_time=00:00
sync_end_time=23:59
write_mark_file_freq=500
store_path_count=1
store_path0=/data/fastdfs/storage #需修改的
subdir_count_per_path=256
#因当前环境tracker与storage为同一台服务器故tracker_server指向本机,若不在同一台服务器指向其他,同时可以定义多个tracker服务器
tracker_server=192.168.0.249:22122
#tracker_server=192.168.0.249:22122
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
file_distribute_path_mode=0
file_distribute_rotate_count=100
fsync_after_written_bytes=0
sync_log_buff_interval=10
sync_binlog_buff_interval=10
sync_stat_file_interval=300
thread_stack_size=512KB
upload_priority=10
if_alias_prefix=
check_file_duplicate=0
key_namespace=FastDFS
keep_alive=0
http.disabled=true#需修改的
http.domain_name=
http.server_port=8888
http.trunk_size=256KB
http.need_find_content_type=true

#32位则执行
ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /lib/libevent-2.0.so.5
#64位则执行
ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5

#启动
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/local/bin/fdfs_storaged  /etc/fdfs/storage.conf
#查看进程
ps aux|grep fdfs
root     12003  0.0  0.0  25484  3088 ?        Sl   09:59   0:00 /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
root     12034  0.1  1.6  82836 66820 ?        Sl   10:02   0:00 /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
root     12046  0.0  0.0  61228   764 pts/0    S+   10:02   0:00 grep fdfs


#安装zend
tar zxvf ZendServer-5.6.0-RepositoryInstaller-linux.tar.gz
cd ZendServer-RepositoryInstaller-linux/
./install_zs.sh 5.3 ce
#进行web安装
http://192.168.0.251:10081
#安装php扩展
yum install autoconf
cd /root/Installpackage/FastDFS/php_client
/usr/local/zend/bin/phpize
./configure --with-php-config=/usr/local/zend/bin/php-config
make&&make install

vim /usr/local/zend/etc/php.ini
[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
disable_classes =
expose_php = On
max_execution_time=180
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = On
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = Off
error_log = "/usr/local/zend/var/log/php.log"
variables_order = "GPCS"
request_order = "GP"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
include_path = ".:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear"
doc_root =
user_dir =
extension_dir="/usr/local/zend/lib/php_extensions"
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[Date]
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=/var/lib/mysql/mysql.sock
[Phar]
[Syslog]
define_syslog_variables  = Off
[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path =/usr/lib/sendmail -t -i
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =/var/lib/mysql/mysql.sock
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =/var/lib/mysql/mysql.sock
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.entropy_length = 0
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[xsl]
[Zend]
zend.install_dir=/usr/local/zend
zend.conf_dir=/usr/local/zend/etc
zend.ini_scandir=conf.d
date.timezone="Asia/Shanghai"#追加
extension = redis.so#追加

cp /root/Installpackage/FastDFS/php_client/*.ini /usr/local/zend/etc/conf.d/
vim /usr/local/zend/etc/conf.d/fastdfs_client.ini
extension = fastdfs_client.so
fastdfs_client.base_path = /tmp
fastdfs_client.connect_timeout = 30
fastdfs_client.network_timeout = 60
fastdfs_client.log_level = info
fastdfs_client.log_filename =
fastdfs_client.http.anti_steal_secret_key =
fastdfs_client.tracker_group_count = 1
fastdfs_client.tracker_group0 = /etc/fdfs/client.conf

#查看fastdfs_client是否部署成功
http://ip:10081

#安装redis
tar zxvf redis-2.4.14.tar.gz
cd redis-2.4.14
make
make install

cp redis.conf /etc/
vim /etc/redis.conf
daemonize yes#需更改的
pidfile /var/run/redis.pid
port 6379
bind 127.0.0.1#需更改的
timeout 0
loglevel verbose
logfile stdout
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
slowlog-log-slower-than 10000
slowlog-max-len 128
vm-enabled no
vm-swap-file /tmp/redis.swap
vm-max-memory 0
vm-page-size 32
vm-pages 134217728
vm-max-threads 4
hash-max-zipmap-entries 512
hash-max-zipmap-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
#开启
redis-server /etc/redis.conf
#测试
redis-benchmark

#安装redis扩展
unzip /root/Installpackage/nicolasff-phpredis-2.2.1-59-gf1231c9.zip
cd /root/Installpackage/nicolasff-phpredis-f1231c9/
/usr/local/zend/bin/phpize
./configure --with-php-config=/usr/local/zend/bin/php-config
make&&make install

#查看redis是否部署成功
http://ip:10081

#安装ImageMagick
yum -y install tcl-devel.x86_64 libpng-devel.x86_64 libjpeg-devel.x86_64 ghostscript-devel.x86_64 bzip2-devel.x86_64 freetype-devel.x86_64 libtiff-devel.x86_64
yum -y install libjpeg-devel.x86_64 libpng-devel.x86_64 glib2-devel.x86_64 fontconfig-devel.x86_64 zlib-devel.x86_64 libwmf-devel.x86_64 freetype-devel.x86_64 libtiff-devel.x86_64

tar zxvf ImageMagick-6.7.7-6.tar.gz

cd ImageMagick-6.7.7-6

./configure --prefix=/usr --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes  --enable-shared --enable-lzw --without-perl --with-modules --with-php-config=/usr/local/php/bin/php-config

make clean

make&&make install

ldconfig /usr/

 

#安装扩展

tar zxvf imagick-2.3.0.tgz 

cd imagick-2.3.0

/usr/local/zend/bin/phpize

./configure --with-php-config=/usr/local/zend/bin/php-config --enable-shared

make&&make install

vim /usr/local/zend//etc/php.ini 

追加extension=imagick.so

vim /etc/fdfs/client.conf
connect_timeout=30
network_timeout=60
base_path=/data/fastdfs/
tracker_server=192.168.0.249:22122
log_level=info
http.tracker_server_port=8080
#重启apache
/usr/local/zend/bin/zendctl.sh restart-apache
#查看
convert -version
#到此为止该环境部署完成
#该应用程序此处不做提供,谨在此做演示
#部署测试应用程序
unzip /root/Installpackage/pis.zip
mv ./pis/* /var/www/html/
whereis convert
convert: /usr/bin/convert /usr/share/man/man1/convert.1
修改配置文件
vim /var/www/html/lib/Config.php
修改convert路径
#创建pis数据存储目录
mkdir -p /data/pis/fdfs
mkdir /data/pis/pis
chmod -R 777 /data/pis/
#测试
http://ip/upload.php

你可能感兴趣的:(redis,centos,分布式文件系统,fastDFS,ImageMagick)