"Compiling and packaging" fastdfs-5.0.5-7.el7.centos.src.rpm

Source: Internet
Author: User

The official spec file is not fully functional and can only be packaged in RPM, but there are various problems with RPM package installation. Very few people feedback the spec file problem, estimated to use the RPM package to install, only me. With RPM installation, you can skip the repetitive and error-prone compilation process and improve the software installation experience.


(at the end of the article has Baidu Network disk link)


I have made a major transformation of the official spec file, and I have made the appropriate adjustments to the default configuration file, which is improved as follows:


1. Startup script

/usr/bin/stop.sh and/usr/bin/restart.sh name too domineering, abandon!

Original Fdfs_trackerd and Fdfs_storaged startup scripts due to call/usr/bin/stop.sh/usr/bin/restart.sh

The new startup script instead calls the/etc/rc.d/init.d/functions public function to start, shut down, and restart.


2. Running identity

The profile-related options are empty by default, which is to detect the current user identity, which can easily mislead users into creating a security risk by running the program with Root. RPM Package installation will create normal user Fdfs, configuration files, Run_by_user=fdfs and Run_by_group=fdfs

Using ROOT to execute the startup script, the program will automatically switch to the Fdfs user identity.


4. Path problem

The path in the configuration file, which is attributed to/var/lib/fastdfs, is a master Fdfs, such as/etc/fdfs/storage.conf

Base_path=/var/lib/fastdfs/storage


5, the packaged binary package Fastdfs-server split into Fastdfs-tracker and Fastdfs-storage, easy to deploy separately.


6. configuration file Fine-tuning

The file name removes the sample suffix and uses the Conf file directly.

Put parameters that might be modified in front of the configuration file for easy lookup.


Attach the modified Fastdfs.spec file as follows:

name:fastdfsversion:        5.0.5release:         7%{?dist}Summary:FastDFS server and clientLicense:         gplgroup:arch/techurl:        https:// github.com/happyfish100/fastdfsbuildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-% (%{__id_u} -n)  source0:%{name}-%{version}.tar.gzsource1:fdfs_trackerd.initsource2:fdfs_storaged.initsource10:fdfs_ Trackerd.serviceSource20:fdfs_storaged.serviceSource3:tracker.confSource4:storage.confSource5: Client.confsource6:http.confrequires:%__cp %__mv %__chmod %__grep %__mkdir %__install  %__idBuildRequires:gccBuildRequires:  glibc-develBuildRequires:   Libtoolbuildrequires:  makebuildrequires:libfastcommon-develrequires (POST):  chkconfig% descriptionthis package provides tracker &  Storage of fastdfs%package  trackersummary:  fastdfs trackerrequires:  fastdfsRequires: libfastcommon%package  storageSummary:  fastdfs  storagerequires: fastdfsrequires: libfastcommon%package toolsummary: fastdfs  Toolsrequires: libfastcommon%package -n libfdfsclientsummary: the client dynamic  library of fastdfsrequires: libfastcommon%package -n libfdfsclient-develsummary : the client header of fastdfsrequires: libfdfsclient%description  trackerthis package provides tracker of fastdfs%description storagethis  package provides storage of fastdfs%description -n libfdfsclientthis  package is client dynamic library of fastdfs%description -n  Libfdfsclient-develthis package is client&nbsP;header of fastdfs client%description toolthis package is tools for  fastdfs%prep%setup -q%build# fixme: i need to fix the upstream  Makefile to use LIBDIR et al. properly and# send the  upstream maintainer a patch.# add docdir to the configure part./ make.sh%installrm -rf %{buildroot}destdir= $RPM _build_root ./make.sh installmkdir -p   $RPM _build_root%{_bindir}mkdir -p  $RPM _build_root%{_initrddir}mkdir -p  $RPM _build_ root%{_sysconfdir}/fdfsmkdir -p  $RPM _BUILD_ROOT%{_SHAREDSTATEDIR}/FASTDFS/{CLIENT,STORAGE,TRACKER}CP  conf/storage_ids.conf  $RPM _build_root%{_sysconfdir}/fdfs/cp conf/mime.types  $RPM _build_ root%{_sysconfdir}/fdfs/rm -rf  $RPM _BUILD_ROOT%{_SYSCONFDIR}/INIT.D/FDFS_STORAGED&NBSP;RM&NBSP;-RF   $RPM _build_root%{_sysconfdir}/init.d/fdfs_trackerdrm -rf  $RPM _build_root%{_bindir}/restart.shrm -rf  $RPM _ build_root%{_bindir}/stop.shrm -rf  $RPM _BUILD_ROOT%{_SYSCONFDIR}/FDFS/TRACKER.CONF.SAMPLERM&NBSP;-RF   $RPM _build_root%{_sysconfdir}/fdfs/storage.conf.samplerm -rf  $RPM _build_root%{_sysconfdir}/ fdfs/client.conf.samplerm -rf  $RPM _build_root%{_sysconfdir}/fdfs/storage_ids.conf.sample#  install sysv init stuff%{__mkdir} -p  $RPM _build_root%{_initrddir}%{__install} -m  755 %{SOURCE1}   $RPM _build_root%{_initrddir}/fdfs_trackerd%{__install} -m 755  %{SOURCE2}   $RPM _build_root%{_initrddir}/fdfs_storaged%{__install} -m 644 %{ source3}  $RPM _build_root%{_sysconfdir}/fdfs/tracker.conf%{__install} -m 644 %{source4}   $RPM _build_root%{_sysconfdir}/fdfs/storage.conf%{__install} -m 644 %{source5}  $RPM _ Build_root%{_sysconfdir}/fdfs/client.conf%{__install} -m 644 %{source6}  $RPM _build_root%{_sysconfdir}/fdfs/http.conf%pre#  Add the  "Fdfs"  usergetent group fdfs >/dev/null | |  groupadd -r fdfsgetent passwd fdfs >/dev/null | |      useradd -r -g fdfs -s /sbin/nologin      -d /var/lib/fastdfs -c  "Fastdfs user"   fdfsexit 0%post  Tracker/sbin/chkconfig --add fdfs_trackerd%preun trackerservice stop fdfs_trackerd  | |  true/sbin/chkconfig --del fdfs_trackerd%post storage/sbin/chkconfig --add fdfs_ storaged%preun storageservice stop fdfs_storaged | |  true/sbin/chkconfig --del fdfs_storaged%postun%cleanrm -rf  $RPM _build_rootpushd  common;make -s clean ;p Opdpushd tracker;make -s clean ; popdpushd storage;make -s clean ;p opdpushd test;make -s clean ; popdpushd client ;make -s clean ;p opd%files%defattr (-,root,root,-)%dir %{_ Sysconfdir}/fdfs%dir %attr (0755,FDFS,FDFS)  %{_sharedstatedir}/fastdfs%files tracker%defattr (-, root,root,-)%{_bindir}/fdfs_trackerd%{_initrddir}/fdfs_trackerd%config (noreplace)  %{_sysconfdir}/fdfs/ Tracker.conf%dir %attr (0755,FDFS,FDFS)  %{_sharedstatedir}/fastdfs/tracker%files storage%defattr (-,root,root,-)%{_bindir}/fdfs_storaged%{_initrddir}/fdfs_storaged%config (noreplace)  %{_sysconfdir}/fdfs/ Storage.conf%dir %attr (0755,FDFS,FDFS)  %{_sharedstatedir}/fastdfs/storage%files -n  Libfdfsclient%{_libdir}/libfdfsclient*%config (Noreplace)  %{_sysconfdir}/fdfs/client.conf%config (noreplace )  %{_sysconfdir}/fdfs/http.conf%config (Noreplace)  %{_sysconfdir}/fdfs/mime.types%config (noreplace)  %{_sysconfdir}/fdfs/storage_ids.conf%dir %attr (0755,FDFS,FDFS)  %{_sharedstatedir}/fastdfs/client%files -n  Libfdfsclient-devel%defattr (-,root,root,-)%{_includedir}/fastdfs/*%files tool%{_bindir}/fdfs_monitor%{_ Bindir}/fdfs_test%{_bindir}/fdfs_test1%{_bindir}/fdfs_crc32%{_bindir}/fdfs_upload_file%{_bindir}/fdfs_download _file%{_bindir}/fdfs_delete_file%{_bindir}/fdfs_file_info%{_bindir}/fdfs_appender_test%{_bindir}/fdfs_appender _test1%{_bindir}/fdfs_append_file%{_bindir}/fdfs_upload_appender%changelog* thu nov 05  2015  purple grape <[email protected]>- new init scripts-  Run as user fdfs by default* mon jun 23 2014  zaixue  Liao <[email protected]>- first RPM release  (1.0)




The number of attachments, the Baidu network disk

Http://pan.baidu.com/s/1pJszKHP


If the srpm package is recompiled, it is also available for CentOS 6


This article is from the "Focus on Linux Operations" blog, please be sure to keep this source http://purplegrape.blog.51cto.com/1330104/1710514

"Compiling and packaging" fastdfs-5.0.5-7.el7.centos.src.rpm

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.