CentOS-6.9 to build Fastdfs (the end of the article has a key installation script) _fastdfs

Source: Internet
Author: User
Tags file url openssl iptables server port
1. Required installation Package

Libfastcommon-master.zip
Fastdfs_v5.05.tar.gz
Fastdfs-nginx-module_v1.16.tar.gz
Nginx-1.8.0.tar.gz 2. Install Libfastcommon Package

The following dependencies need to be installed before the ① is installed Libfastcommon (the system does not need to be installed if it has one):
Yum install-y gcc
Yum Install-y gcc-c++

② Decompression Libfastcommon-master.zip
Unzip Libfastcommon-master.zip

③ compilation
CD Libfastcommon-master
./make.sh

④ Installation
./make.sh install 3. Install Fastdfs

① Decompression FASTDFS installation package
TAR-ZXVF fastdfs_v5.05.tar.gz

② compilation
CD Fastdfs
./make.sh

③ Installation
./make.sh Install 4. Configure Tracker Services

① Enter the directory where the Fastdfs configuration file resides:
cd/etc/fdfs/

② Modify Profile Name
MV Client.conf.sample client.conf
MV Storage.conf.sample storage.conf
MV Tracker.conf.sample tracker.conf

③ Open tracker.conf and modify the following configuration:

# The base path to store data and log files 
Base_path=/opt/qiuxiao/fastdfs_tracker

Note: Set Tracker data Directory (database) and log directory (logs) (Specify directory does not exist to create first)

# The Tracker server port
port=22122

Note: Port parameters are not recommended for modification

④ Start Tracker
/usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf start

⑤ to see if the service started successfully
Netstat-unltp|grep Fdfs

⑥tracker added to power-on self-starter
Vim/etc/rc.d/rc.local
Add the following command to the file
/usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf start
5. Configure the storage service

① Configuration storage.conf File

# The base path to store data and log files
Base_path=/opt/qiuxiao/fastdfs_storage_log

Note: Log directory (the specified directory does not exist to be created first)

# store_path#, based 0, if Store_path0 not exists, it ' s value is Base_path # The paths must to be exist store_path0=/
Opt/qiuxiao/fastdfs_storage_data

Note: Store directory (the specified directory does not exist to create first)

# tracker_server can ocur more than once, and tracker_server the format  is # ' Host:port ', host can be hostname or IP a Ddress
tracker_server=10.211.55.7:22122

Note: Tracker server IP and port (the specified directory does not exist to be created first)

② Start Storage Service
/usr/bin/fdfs_storaged/etc/fdfs/storage.conf restart

③ to see if the service started successfully
Netstat-unltp|grep Fdfs

After the ④ starts successfully, view the cluster situation through Fdfs_monitor, that is, storage has been registered in the Racker server
/usr/bin/fdfs_monitor/etc/fdfs/storage.conf

⑤tracker added to power-on self-starter
Vim/etc/rc.d/rc.local
Add the following command to the file
/usr/bin/fdfs_monitor/etc/fdfs/storage.conf restart

⑥ Configuration client.conf File

# The base path to store log files
base_path=/opt/qiuxiao/fastdfs_tracker

# tracker_server can ocur more than once , and Tracker_server format
is #  ' Host:port ', host can be hostname or IP address
tracker_server=10.211.55.7:2 2122

So far, FASDDFS deployment is complete.
Next Enter the Nginx module installation 6. Install and configure Nginx and Fastdfs-nginx-module modules

① Installation Dependencies
Yum install-y gcc (installed Libfastcommon installed)
Yum install-y gcc-c++ (installed when Libfastcommon installed)
Yum install-y pcre Pcre-devel
Yum install-y zlib Zlib-devel
Yum Install-y OpenSSL Openssl-devel

② Create soft links (because the Lib directory set by the FASTDFS main program is/usr/local/lib, you need to create soft links)
Ln-s/usr/lib64/libfastcommon.so/usr/local/lib/libfastcommon.so
Ln-s/usr/lib64/libfastcommon.so/usr/lib/libfastcommon.so
Ln-s/usr/lib64/libfdfsclient.so/usr/local/lib/libfdfsclient.so
Ln-s/usr/lib64/libfdfsclient.so/usr/lib/libfdfsclient.so

③ decompression Nginx and Fastdfs-nginx-module
Copy fastdfs-nginx-module Module pack to/usr/local
cp/opt/download/fastdfs-nginx-module_v1.16.tar.gz/usr/local/

Decompression Nginx
Tar-zxvf/opt/download/nginx-1.8.0.tar.gz

Decompression Fastdfs-nginx-module
Tar-zxvf/usr/local/fastdfs-nginx-module_v1.16.tar.gz

④ Editor Vim/usr/local/fastdfs-nginx-module/src/config
Modify the Core_incs line, as follows, remove all the local in the path, namely:
core_incs= "$CORE _incs/usr/include/fastdfs/usr/include/fastcommon/"

⑤nginx Join Fastdfs-nginx-module Module
CD nginx-1.8.0
./configure–prefix=/usr/local/nginx–add-module=/usr/local/fastdfs-nginx-module/src/
See the following results to indicate that the module joined successfully

⑥ installation Nginx
A) compiling Nginx
Make

Appears as shown in the illustration above to indicate successful compilation

b) Installation of Nginx
Make install
After installation, enter the/usr/local/directory, see nginx file directory indicates Nginx installation success

Enter/USR/LOCAL/NGINX/SBIN/NGINX-V to display the following information indicating that the Fastdfs-nginx-module installation was successful

⑦ Editor Nginx.conf
Vim/usr/local/nginx/conf/nginx.conf
Add the following configuration:
location/group1/m00 {
Root/opt/qiuxiao/fastdfs_storage_data/data;
Ngx_fastdfs_module;
}

⑧ copy configuration file to/etc/fdfs, edit mod_fastdfs.conf file
A) Copy the configuration files under Fastdfs http.conf and Mime.types to/etc/fdfs
cp/opt/download/fastdfs/conf/http.conf/etc/fdfs/
cp/opt/download/fastdfs/conf/mime.types/etc/fdfs/

b Copy the configuration file of the Fastdfs-nginx-module module mod_fastdfs.conf to/etc/fdfs
cp/usr/local/fastdfs-nginx-module/src/mod_fastdfs.conf/etc/fdfs/

c) Edit mod_fastdfs.conf
Modify the configuration as follows:

CA) Save Log directory # The base path to store log files Base_path=/opt/qiuxiao/fastdfs_storage_info CB) Tracker server address # Fastdfs Tracke R_server can ocur more than once, and tracker_server format are # "Host:port", host can be hostname or IP address # valid Only if Load_fdfs_parameters_from_tracker is true tracker_server=10.211.55.7:22122 cc) storage Server port number # The port of the L ocal Storage Server # The default value is 23000 storage_server_port=23000 CD) current server group name # The group name of the local s Torage server group_name=group1 CE) file URL has the group name # if the Url/uri including the group name # set to False when Uri Lik
E/M00/00/00/XXX # Set to True if URI like ${group_name}/m00/00/00/xxx, such as Group1/m00/xxx # default value is False Url_have_group_name = True CF) store path number, Store_path number Match # path (disk or mount point) count, default value is 1 # must same as storage.conf store_path_count=1 CG) Storage Path # store_path#, based 0, if Store_path0 not exists, it ' s value is Base_path # the Paths must be exist # MUSt Same as storage.conf Store_path0=/opt/qiuxiao/fastdfs_storage_data #store_path1 =/HOME/YUQING/FASTDFS1 CH) Sets the number of file types Http.need_find_content_type=true ci from file extensions # set the group Count # set to none zero to support Multi-grou P # set to 0 for single group only # groups Settings section as [group1], [group2], ..., [GROUPN] # Default value is 0 # Since v1.14 Group_count = 1 cj) release commented out [group1], configure related configuration # Group settings for group #1 # since v1.14 # when support Multi-gro Up, uncomment following section [group1] group_name=group1 storage_server_port=23000 store_path_count=1 store_path0=/ Opt/qiuxiao/fastdfs_storage_data #store_path1 =/HOME/YUQING/FASTDFS1

⑨ start Nginx
Build Soft Links
Ln-s/opt/qiuxiao/fastdfs_storage_data/data/opt/qiuxiao/fastdfs_storage_data/data/m00

Start Nginx
/usr/local/nginx/sbin/nginx

Release Port 80:
/sbin/iptables-i input-p tcp–dport 80-j ACCEPT
/etc/rc.d/init.d/iptables Save
/etc/init.d/iptables restart

Access Nginx to see if Nginx started successfully
7. Test

① use command to upload a local picture to Fastdfs
/usr/bin/fdfs_test/etc/fdfs/client.conf upload/opt/download/fsp.jpg

Access the uploaded file in the browser using the URL in the previous illustration


Https://www.cnblogs.com/debiao/p/6230260.html
http://blog.csdn.net/vanthyanhon/article/details/73718568 One-click installation script:

https://download.csdn.net/download/qiuxiao630320/10302878
Script Usage Instructions:
Put the script in CentOS any directory, give the script executable permissions, and then directly executed, one-click Fool-Type installation;
Related installation directory Please refer to the above article
Note: Scripts are available for testing in the CentOS6.9 environment, but make sure the machine is networked and the Yum command is available (this includes support for Yum installation and no Yum source instability)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.