Use rmpbuild to create the AliSQL database rpm package, rmpbuildalisql

Source: Internet
Author: User
Tags rpmbuild

Use rmpbuild to create the AliSQL database rpm package, rmpbuildalisql

Environment: REHL6.5

Software: rpmbuild

Used files: ALiSQL-Master

1. install required software
[root@alisql ~]# yum install rpm* rpm-build rpmdev* –y
[root@alisql ~]# rpmdev-setuptree
[root@alisql ~]# tree rpmbuild/  
rpmbuild/
├── BUILD
├── RPMS
├── SOURCES
├── SPECS
└── SRPMS

5 directories, 0 files

2. Upload the software SOURCE package to the SOURCE directory 3. Compile the configuration file

Run rpmdev-newspec-o alisql. spec in the rpmbuild/SPECS directory to generate a template file named alisql. spec in the current directory.

[root@alisql SPECS]# rpmdev-newspec -o alisql.spec

According to the modified alisql. spec file, the modified content is as follows:

Name:           alisqlVersion:        5.6.3Release:        1%{?dist}Summary:        AliSQLGroup:          System Environment/LibrariesLicense:        GPLURL:            http://www.abner.com.cnSource0:        %{name}-%{version}.tar.gzBuildRequires:  gcc gcc-c++Requires:       ncurses-devel bison%define MYSQL_USER mysql%define MYSQL_GROUP mysql%description    The %{name}-devel package contains libraries and header files fordeveloping applications that use %{name}.%prep%setup -quseradd mysqlmkdir –p /usr/local/mysqlmkdir -p /data/mysqldb%buildcmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8   -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1make %{?_smp_mflags}%installrm -rf $RPM_BUILD_ROOTmake install DESTDIR=$RPM_BUILD_ROOTfind $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'%preid mysql||useradd -m -s /bin/bash mysql &>/dev/nullmkdir -p /data/mysqldbchown -R mysql: /data/mysqldb%cleanrm -rf $RPM_BUILD_ROOT%post /usr/local/mysql/scripts/mysql_install_db  --basedir=/usr/local/mysql --user=mysql  --datadir=/data/mysqldb &>/dev/nullcp -f /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf sed -i 's/^# basedir.*/basedir=\/usr\/local\/mysql/g' /etc/my.cnfsed -i 's/^# datadir.*/datadir=\/data\/mysqldb/g' /etc/my.cnfsed -i 's/^# socket.*/socket= \/tmp\/mysql.sock/g' /etc/my.cnfcp -f /usr/local/mysql/support-files/mysql.server  /etc/init.d/mysqldecho export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH >> /etc/profilesource /etc/profilechkconfig --add mysqld &>/dev/nullchkconfig mysqld on &>/dev/null%preunchkconfig --del mysqld &>/dev/nullrm -rf /etc/init.d/mysqld &>/dev/null%postun userdel -r mysql &>/dev/nullrm -fr /data/mysqldb &>/dev/nullrm -fr /usr/local/mysql &>/dev/null%files%defattr(-,mysql,mysql,-)/usr/local/mysql/*%changelog
4. Install software required for packaging and compilation

1. install the software required for compilation

[root@alisql ~]# yum install gcc gcc-c++ ncurses-devel perl -y

2. Install cmake software (Click here to download)

Upload the cmake source code package to the home directory for decompression

[root@alisql ~]# tar -xf cmake-2.8.8.tar.gz [root@alisql ~]# cd cmake-2.8.8[root@alisql cmake-2.8.8]# ./configure [root@alisql cmake-2.8.8]# make && make install

3. Install bison

[root@alisql ~]# yum install bison -y
5. Run package compilation in the rpmbuild/SPECS directory
[root@alisql SPECS]# rpmbuild -bb alisql.spec

After the software is successfully packaged, the rpm package is generated in the rpmbuild/RPMS/x86_64 folder.

References

1. http://blog.chinaunix.net/uid-23069658-id-3944462.html

2. http://laoguang.blog.51cto.com/6013350/1103628

3. http://blog.csdn.net/kouyanqiu/article/details/53103249

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.