1. Required installation package:
2 install centos7
- 2.1Centos7 Procedure for enabling the network
- Enter ifconfig to view the local network IP address
- Run the vi /etc/sysconfig/network-scripts/ifcfg-ens33 command to set ONBOOT=yes in the file
- Enter service network start to enable the gateway
- Enter IP addr show to find the external IP address of the local host
- 2.2 Installing the Xshell upload and download tool Enter yum -y install LRZSZ
- Yum -y install gcc-C ++ yum -y install libevent Install FastDFS dependency libevent
The installation libfastcommon
- Go to the /usr/local directory: CD /usr/local
- Upload the libfastcommon zip to this directory: rz (a dialog will pop up)
- Extract: tar ZXVF – libfastcommonV1.0.7. Tar. Gz – C/usr/local
- Go to the libfastcommonV1.0.7 directory: CD libfastcommonV1.0.7
- Compiler:. / make. Sh
- Install:./make.sh install
Note that there is an error in the compile step
-
Input: yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget
-
Download what’s missing
The/usr/lib64 / libfastcommon. So copy to/usr/lib directory: Cp/usr/lib64 / libfastcommon. So/usr/lib (because libfastcommon installed automatically after copy the file to the/usr/lib64, because fastdfs program reference/usr/lib directory so need to copy)
The Tracker server installation
- Run the CD /usr/local command to switch to the /usr/local directory
- Pass in the FastDFS compression package: Rz
- Decompress: tar -zxvf fastdfs_v5.05.tar. gz
- Go to the FastDFS directory: CD FastDFS
- Compile the.. / make. Sh
- Installation. / make. Sh install
- The installation is successful. Copy the conf files in the installation directory to /etc/fdfs/.
- Create a folder for the user to store the tracker data and logs: mkdir -p /home/fastdfs
- Conf: vi tracker.conf
Modify base_path:
base_path=/home/FastDFS
- To start the Tracker service, run the /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf command
- Whether the service is open: netstat unltp | grep FDFS TCP 0 0 0.0.0.0:22122 0.0.0.0: * LISTEN
Add: be sure to look at the log if tracker fails: the log place is: CD /home/fastdfs/logs
Installing the Storage Service
Note: If the tracker and storage services are on the same machine, the following steps are not necessary. If the tracker and storage services are on different machines, the following steps must be performed.
Install centos7.
Install libfastCommon as above
- Run the CD /usr/local command to switch to the /usr/local directory
- Pass in the FastDFS compression package: Rz
- Decompress: tar -zxvf fastdfs_v5.05.tar. gz
- Go to the FastDFS directory: CD FastDFS
- Compile the.. / make. Sh
- Installation. / make. Sh install
- The installation is successful. Copy the conf files in the installation directory to /etc/fdfs/.
- Go to the /etc/fdfs directory: CD /etc/fdf/
- Copy the Storage configuration file to cp storage.conf.sample storage.conf
- Create a folder for storing data: mkdir -p /home/fastdfs/fafs_storage
- Modify storage.conf file: Conf Base_path =/home/FastDFS Store_path0=/home/ fastdffs/fDFs_storage tracker_server= IP (IP address of the tracker server):221
- Start the storage service: /usr/bin/fdfs_storaged /etc/ffs/storage.conf
- See whether activation: netstat unltp | grep FDFS
Install nigix server (because FastDFS cannot transfer files over HTTP)
- Go to the /usr/local/ directory CD /usr/local
- Upload the nginx package Rz
- Decompress the nginx package tar -zxvf nginx-1.8.0.tar.gz
- Upload the fastdfS-nginx-module_V1.16.tar. gz integration package Rz
- Decompress the package tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
- Go to the fastdfs-nginx-module/ SRC directory: CD /usr/local/fastdfs-nginx-module/ SRC
- Modify the configuration file vi config
- # change /usr/local/in CORE_INCS to /usr/local/in CORE_LIBS
- CORE_INCS=”$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/”
- CORE_LIBS=”$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient”
- Run the following command to transfer the mod_fastdfs.conf configuration file to cp mod_fastdfs.conf /etc/fdfs
- Run the CD /etc/fdfs/command to modify the /etc/fdfs/mod_fastdfs.conf configuration file
- Modification: vi mod_fastdfs.conf base_path=/home/FastDFS tracker_server=yourid:22122 url_have_group_name = true store_path0=/home/FastDFS/fdfs_storage
- Will libfdfsclient. So copy to/usr/lib: under cp/usr/lib64 / libfdfsclient so/usr/lib /
- To create the nginx/client directory: mkdir -p /var/temp/nginx/client
- Install Nginx:
[root@localhost nginx-1.10.3]#./configure –prefix=/usr/local/nginx –pid-path=/var/run/nginx/nginx.pid –lock-path=/var/lock/nginx.lock –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –with-http_gzip_static_module –http-client-body-temp-path=/var/temp/nginx/client –http-proxy-temp-path=/var/temp/nginx/proxy –http-fastcgi-temp-path=/var/temp/nginx/fastcgi –http-uwsgi-temp-path=/var/temp/nginx/uwsgi –http-scgi-temp-path=/var/temp/nginx/scgi –add-module=/usr/local/fastdfs-nginx-module/ SRC –add-module=/usr/local/fastdfs-nginx-module/ SRC
-
# compile: make
-
Install: make install
-
Modify the Nginx configuration file
-
Create a data directory mkdir /home/fastdfs/fdfs_storage /data
-
Go to the nginx directory: CD /usr/local/nginx
-
[root@localhost nginx]# cd conf/
-
[root@localhost conf]# vim nginx.conf
server {
listen 80;Server_name 192.168.134.133; location /group1/M00/{ root /home/FastDFS/fdfs_storage/data; ngx_fastdfs_module; }Copy the code
}
-
Start: [root@localhost nginx]# CD sbin
[root@localhost sbin]# ./nginx
ngx_http_fastdfs_set pid=6203
- Errors encountered during installation:
To enable the centos firewall:
Firewall-cmd –zone=public –add-port=80/ TCP –permanent (–permanent takes effect permanently. If this parameter is not specified, it will become invalid after the port is restarted.