環境
OS:CentOS6.9
MySQL:mysql-community-5.7.21-1.el6.src.rpm
つまずき
1.cmakeのv2.8.12が入っているのにcmake28 >= 2.8.2を求められる。
2.GPG鍵が無い。
3.openldap-develが足りなくてコンパイルエラー(bug)
4./var/lib/mysqlがSELinux
エラーその1 cmeke28
cmake28を求められる。どうやらcmakeとは別物のよう。
# rpmbuild --rebuild --define='runselftest 0' mysql-community-5.7.21-1.el6.src.rpm
Installing mysql-community-5.7.21-1.el6.src.rpm
warning: InstallSourcePackage at: psm.c:244: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed build dependencies:
cmake28 >= 2.8.2 is needed by mysql-community-5.7.21-1.el6.x86_64
# /usr/bin/cmake --version
cmake version 2.8.12.2
- /usr/bin/cmakeにcmake28のシンボリックリンクを作成してもダメだった。
# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/c/cmake28-2.8.12.2-2.el6.x86_64.rpm && \
rpm -i cmake28-2.8.12.2-2.el6.x86_64.rpm
- cmake28をインストールすることでエラーを回避。
エラーその2 GPG鍵のエラー
エラーでもインストールできないことはない。
[root@mysql src]# rpmbuild --rebuild --define='runselftest 0' mysql-community-5.7.21-1.el6.src.rpm
mysql-community-5.7.21-1.el6.src.rpm をインストール中です。
警告: InstallSourcePackage at: psm.c:244: ヘッダ V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
^C[root@mysql src]# rpm -K mysql-community-5.7.21-1.el6.src.rpm
mysql-community-5.7.21-1.el6.src.rpm: (SHA1) DSA sha1 md5 (GPG) OK ではありません。(見つからない鍵: GPG#5072e1f5)
[root@mysql src]# rpm --import mysql_pubkey.asc
[root@mysql src]# rpm -K mysql-community-5.7.21-1.el6.src.rpm
mysql-community-5.7.21-1.el6.src.rpm: (sha1) dsa sha1 md5 gpg OK
[root@mysql src]# rpmbuild --rebuild --define='runselftest 0' mysql-community-5.7.21-1.el6.src.rpm
mysql-community-5.7.21-1.el6.src.rpm をインストール中です。
実行中(%prep): /bin/sh -e /var/tmp/rpm-tmp.A1vsgI
RPM ビルドエラー:
InstallSourcePackage at: psm.c:244: ヘッダ V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
ファイルが見つかりません:
- キーファイルmysql_pubkey.ascを作成し、
# gpg --import mysql_pubkey.asc
でインポートすればよい。
参考資料
MySQL 5.6をCentOS5にインストール(pg-sugarless.hatenablog.jp)
2.1.3.2 Signature Checking Using GnuPG(dev.mysq.com)
エラーその3 コンパイルのエラー
authenticationのプラグインが見つからない…と探していたら、商用MySQL版に認証のツールがあること発見したが関係なかった。
/root/rpmbuild/BUILDROOT/mysql-community-5.7.21-1.el6.x86_64/usr/lib64/mysql/plugin/authentication_ldap_sasl_client.so
ファイルが見つかりません:
/root/rpmbuild/BUILDROOT/mysql-community-5.7.21-1.el6.x86_64/usr/lib64/mysql/plugin/debug/authentication_ldap_sasl_client.so
-- Creating LDAP authentication SASL client library.
-- Looking for include file sasl/sasl.h
-- Looking for include file sasl/sasl.h - found
-- Looking for include file lber.h
-- Looking for include file lber.h - not found
-- Required LBER library is missing. Skipping the LDAP SASL client authentication plugin.
- コンパイルの結果を
| tee
で出力しながら、LDAPを検索してくと、それっぽいものを作ろうとしているけれど失敗している模様。 - どうやらバグっぽい。事前に
yum install -y openldap-devel
で解決した。
参考資料
Rebuilding RPM of 5.7 fails because missing lber.h(bugs.mysql.com)
MySQL×LDAP認証でつらくないデータベース権限管理(tech.geniee.co.jp)
エラーその4 /var/lib/mysqlのパーミッション
mysqlがStartできない。
2018-04-16T04:43:29.119544Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2018-04-16T04:43:29.119554Z 0 [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions
2018-04-16T04:43:29.119563Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-04-16T04:43:29.720234Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-04-16T04:43:29.720268Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-04-16T04:43:29.720283Z 0 [ERROR] Failed to initialize builtin plugins.
2018-04-16T04:43:29.720293Z 0 [ERROR] Aborting
- SELinuxが原因。
-
# restorecon -R /var/lib/mysql
で解決。 - もしかしたらSELinuxでポートも塞がってるかも。
参考資料
MySQL - バージョンアップしたら起動できなくなった(babiy3104.hateblo.jp)
インストールできた流れ
cmake28を入れる、openldap-develを入れる、SELinuxの対応をする。余裕があればGPGKeyも入れる。
# cd /usr/local/src && \
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/c/cmake28-2.8.12.2-2.el6.x86_64.rpm && \
rpm -i cmake28-2.8.12.2-2.el6.x86_64.rpm && \
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-5.7.21-1.el6.src.rpm ; \
yum install -y gperf readline-devel libaio-devel ncurses-devel cmake zlib-devel openldap-devel libtool-ltdl libtool-ltdl-devel; \
yum install -y numactl-devel ; \
rpmbuild --rebuild --define='runselftest 0' mysql-community-5.7.21-1.el6.src.rpm ;\
cd /root/rpmbuild/RPMS/x86_64/ ;\
rpm -ivh mysq-community-{client,common,server,devel,libs,libs-compat}-*
# rm -rf /var/lib/mysql
# /usr/sbin/mysqld --defaults-file=/var/lib/my.cnf --initialize-insecure --user=mysql
# restorecon -R /var/lib/mysql
# /etc/init.d/mysqld start
- /var/lib/my.cnfは基礎MySQL ~その2~ my.cnf (設定ファイル)(qiita.com/yoheiW@github)を参照。
-
mysql -uroot
で入りたいときは、my.cnfの[mysqld]にskip-grant-tables
を設定する。 - mysqldで初期化する前にmy.cnfファイルの作成を忘れずに。