close
Upgrading MySQL version 3 to 4 RedHat / Fedora
As you know the version of MySQL that is supplied by default with Fedora and the Red Hat Enterprise Linux versions is 3.23-58 whereas the current stable production version is 4.1.7-0. With the prospect that we aren't likely to provided with rpms for this current version from Red Hat for the foreseeable future, how do we upgrade, whilst maintaing the format we are familiar with Fedora/Red Hat.
Step 1. Obtain the source
Obtain the source rpm from MySQL from http://dev.mysql.com/downloads/mysql/4.1.html.
source rpm 在網頁的最下方哦!
Step 2. Extract The Source
Once the source rpm has been downloaded, extract it using rpm -ivh as shown below:
rpm -ivh MySQL-4.1.7-0.src.rpm [ENTER]
This will extract the source tar file to /usr/src/redhat/SOURCES.
如沒有這個目錄,請自行建立,建立好,再 rpm -ivh MySQL*.src.rpm 一次囉!
Now download the files mysql.init and my.cnf-def to /usr/src/redhat/SOURCES
http://fedoranews.org/contributors/tony_smith/mysql/mysql.init
http://fedoranews.org/contributors/tony_smith/mysql/my.cnf-def
Step 3. Build the rpms
Now we will build a new set of rpms, however we will not use the supplied spec file from MySQL, but instead we will use a customized version.
Download the file mysql4.1.spec to /usr/src/redhat/SPECS
http://fedoranews.org/contributors/tony_smith/mysql/mysql4.1.spec
We are now in the position to build our brand new mysql rpms. To do this change directory to /usr/src/redhat/SPECS
Now issue the command
rpmbuild -ba mysql4.1.spec [ENTER]
我做到這裡時,才發現沒有裝 rpmbuild
所以用 yum --list rpm* 找一下該套件名稱
rpm.i386 4.3.2-21 installed
rpm-libs.i386 4.3.2-21 installed
rpm-python.i386 4.3.2-21 installed
Available Packages
rpm-build.i386 4.3.2-21 base
rpm-devel.i386 4.3.2-21 base
rpmdb-fedora.i386 1:3-0.20041103 base
rpmlint.noarch 0.61-0.1.fc3.fr freshrpms
另外也發現 rpm 相關的一些套件沒裝,執行以下指令來安裝囉!
yum install rpm-build rpm-devel
又發現錯誤
rpmbuild -ba mysql4.1.spec
error: File /usr/src/redhat/SOURCES/mysql-4.1.9.tar.gz: No such file or directory
原來是 mysql4.1.spec 中的版本不一樣
vi mysql4.1.spec
因為我下載的 src.rpm 是 4.1.11 的版本
而該網站提供的 mysql4.1.spec 是 4.1.9 的,請改成 4.1.11 即可
改好後,再執行一次,又有錯誤,原因是我的 Fedora Core 3 是最小安裝,所以有一些套件都沒有
[root@dns01 SPECS]# rpmbuild -ba mysql4.1.spec
error: Failed build dependencies:
compat-gcc is needed by mysql-4.1.11-0RH_FC.i386
compat-gcc-c++ is needed by mysql-4.1.11-0RH_FC.i386
automake is needed by mysql-4.1.11-0RH_FC.i386
autoconf is needed by mysql-4.1.11-0RH_FC.i386
奇怪的是無法一次安裝,所以就分兩次囉!
yum install compat-gcc compat-gcc-c++
會發現更多的相依套件要裝...
yum install automake autoconf
安裝好相關套件後,再執行一次,就可以 Run 了...
[root@dns01 SPECS]# rpmbuild -ba mysql4.1.spec
但...又出現錯誤
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
error: Bad exit status from /var/tmp/rpm-tmp.14234 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.14234 (%build)
我再試著 rpmbuild 另外一個檔(好像是自動產生的)
[root@dns01 SPECS]# rpmbuild -ba mysql-4.1.11.spec
error: Failed build dependencies:
ncurses-devel is needed by MySQL-4.1.11-0.i386
yum install ncurses-devel
[root@dns01 SPECS]# rpmbuild -ba mysql-4.1.11.spec
還是有錯誤
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
error: Bad exit status from /var/tmp/rpm-tmp.87625 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.87625 (%build)
我猜測是 gcc 沒裝
yum install gcc
離下班還有大約一個小時十分鐘,剛剛寄了一條電源線給台中站,還有一台電腦 c0002 給新竹。
我快睡著了...眼睛越來越重...晚上世傑要來搬他的電腦,我得跟良澤談一下房租的事情。
再來一次
[root@dns01 SPECS]# rpmbuild -ba mysql-4.1.11.spec
還是錯誤
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
error: Bad exit status from /var/tmp/rpm-tmp.9131 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.9131 (%build)
看來是 gcc-c++ 沒裝
yum install gcc-c++
活在有 yum/apt 的時代,真的蠻幸福的,缺什麼就給它 yum 一下就有了。
再來一次
[root@dns01 SPECS]# rpmbuild -ba mysql-4.1.11.spec
22:02 這次跑比較久,可能會成功哦!
22:07 希望下班前能跑完。
22:09 今天覺得自己在處理 End User 的問題時,自己蠻白痴的,都不知道該怎麼做,我好像退化了
不過好在我 Server 端的問題,越來越得心應手。
22:11 Linux 就是因為太過於彈性了,所以入門,真的不太容易,不過我學到現在,有種倒吃甘蔗的感覺。
22:13 vi 用習慣了,今天因為工作的關係,用了一下 pe2 ,不小心連 vi 的操作方法也帶過去,當然 pe2
是不會理你的啦!
22:15 玩 Linux 的意外收獲,常去讀英文吧!另外也養成了福爾摩斯的精神,去尋找問題點。
22:30 如果下班前還沒跑完,就先放著囉!
22:31 rpmbuild 好像蠻吃系統資源的,重新編譯也難怪啦。
22:34 今天騎腳踏車回到家,可能都要十二點了吧!
22:40 想不到我第一次 rpmbuild 是 build MySQL。
When issuing this command you may encounter some failed dependancies, install the requisite rpms and re-issue the above command.
Once the rpmbuild is in full swing, it takes a while for it all to compile....
However, anything around an hour the new rpms are ready to install. These can be found in the following directory /usr/src/redhat/RPMS/i386 and consist of the following:
mysql-bench-4.1.7-0FC2.i386.rpm
mysql-embedded-4.1.7-0FC2.i386.rpm
mysql-client-4.1.7-0FC2.i386.rpm
mysql-Max-4.1.7-0FC2.i386.rpm
mysql-debuginfo-4.1.7-0FC2.i386.rpm
mysql-server-4.1.7-0FC2.i386.rpm
mysql-devel-4..1.7-0FC2.i386.rpm
mysql-shared-4.1.7-0FC2.i386.rpm
You will also find that you now have your very own custom built source rpm in /usr/src/redhat/SRPMS
mysql-4.1.7-0FC2.src.rpm.
Step 4. Prevent Breaking Dependancies
Attempting to install these newly created RPMs at the momoent will prove troublesome hitting a number of failed dependancies such as php-mysql, qt-mysql .... etc. One option would be to install mysql-4.1, and then re-compile all the failed dependancies, and re-install the dependancies. However there is a far better method, for which thanks is owed to Kenneth Porter for pointing out, and supplying the MySQL-shared-compat.spec file.
To use this spec file, we need to obtain the standard mysql-3.23.58-9.i386.rpm NOT the source rpm. This rpm needs to be copied to /usr/src/redhat/SOURCES and MySQL-shared-compat.spec should be copied to /usr/src/redhat/SPECS
Once the above files have been copied to the correct locations simply build the mysql-shared-compat-3.23.58-9.i386.rpm by issuing the command shown below:
rpmbuild -ba MySQL-shared-compat.spec [ENTER]
This command should be entered when in the directory
/usr/src/redhat/SPECS
This rpm only takes a short while to be created, the mysql-shared-compat-3.23.58-9.i386.rpm rpm is created in the directory
/usr/src/redhat/RPMS/i386
Step 5. Install The RPM(S)
To install your new rpm(s) change directory to, /usr/src/redhat/RPMS/i386 the first time we are installing these we need to force the installation, due to file confilcts between mysql-shared-compat-3.23.58-9.i386.rpm and the currently installed standard rpm. Also the mysql-shared-compat-3.23.58-9.i386.rpm rpm will only be required the once, and will not need to be recompiled for any further subsequent updates. Simply install your required rpms as shown below:
rpm -Uvh --force mysql-shared-compat-3.23.58-9.i386.rpm mysql-server-4.1.7-0FC2.i386.rpm [ENTER]
Step 6. Post Install
Currently the mysql-shared-compat-3.23.58-9.i386.rpm does not update the file
/etc/ld.so.conf so this has to accomplished manually. Add the following line to /etc/ld.so.conf
/usr/lib/mysql
Then execute the command ldconfig as shown below:
ldconfig [ENTER]
To start the mysql daemon simply enter the command:
service mysqld start [ENTER]
Note, if this is a completely new install of MySQL, then the first time that you run the service, MySQL will be initailized.
However, if this is an upgrade from MySQL version 3 then to take advantage of the new priviledge/security features follow the instructions set out at the following address
http://www.mysql.com/doc/en/Upgrading-from-3.23.html
Pros and Cons
Pros:
Latest stable production version of MySQL
Enhanced features of MySQL 4, such as union joins, primary, foreign key relations, improved security...
Using mysql-shared-compat-3.23.58-9.i386.rpm standard updates for applications such as php will work without the need to recompile.
Cons:
Not part of the standard Fedora/RedHat distribution.
來源(再加上一些我實作的心得):
http://fedoranews.org/contributors/tony_smith/mysql/
As you know the version of MySQL that is supplied by default with Fedora and the Red Hat Enterprise Linux versions is 3.23-58 whereas the current stable production version is 4.1.7-0. With the prospect that we aren't likely to provided with rpms for this current version from Red Hat for the foreseeable future, how do we upgrade, whilst maintaing the format we are familiar with Fedora/Red Hat.
Step 1. Obtain the source
Obtain the source rpm from MySQL from http://dev.mysql.com/downloads/mysql/4.1.html.
source rpm 在網頁的最下方哦!
Step 2. Extract The Source
Once the source rpm has been downloaded, extract it using rpm -ivh as shown below:
rpm -ivh MySQL-4.1.7-0.src.rpm [ENTER]
This will extract the source tar file to /usr/src/redhat/SOURCES.
如沒有這個目錄,請自行建立,建立好,再 rpm -ivh MySQL*.src.rpm 一次囉!
Now download the files mysql.init and my.cnf-def to /usr/src/redhat/SOURCES
http://fedoranews.org/contributors/tony_smith/mysql/mysql.init
http://fedoranews.org/contributors/tony_smith/mysql/my.cnf-def
Step 3. Build the rpms
Now we will build a new set of rpms, however we will not use the supplied spec file from MySQL, but instead we will use a customized version.
Download the file mysql4.1.spec to /usr/src/redhat/SPECS
http://fedoranews.org/contributors/tony_smith/mysql/mysql4.1.spec
We are now in the position to build our brand new mysql rpms. To do this change directory to /usr/src/redhat/SPECS
Now issue the command
rpmbuild -ba mysql4.1.spec [ENTER]
我做到這裡時,才發現沒有裝 rpmbuild
所以用 yum --list rpm* 找一下該套件名稱
rpm.i386 4.3.2-21 installed
rpm-libs.i386 4.3.2-21 installed
rpm-python.i386 4.3.2-21 installed
Available Packages
rpm-build.i386 4.3.2-21 base
rpm-devel.i386 4.3.2-21 base
rpmdb-fedora.i386 1:3-0.20041103 base
rpmlint.noarch 0.61-0.1.fc3.fr freshrpms
另外也發現 rpm 相關的一些套件沒裝,執行以下指令來安裝囉!
yum install rpm-build rpm-devel
又發現錯誤
rpmbuild -ba mysql4.1.spec
error: File /usr/src/redhat/SOURCES/mysql-4.1.9.tar.gz: No such file or directory
原來是 mysql4.1.spec 中的版本不一樣
vi mysql4.1.spec
因為我下載的 src.rpm 是 4.1.11 的版本
而該網站提供的 mysql4.1.spec 是 4.1.9 的,請改成 4.1.11 即可
改好後,再執行一次,又有錯誤,原因是我的 Fedora Core 3 是最小安裝,所以有一些套件都沒有
[root@dns01 SPECS]# rpmbuild -ba mysql4.1.spec
error: Failed build dependencies:
compat-gcc is needed by mysql-4.1.11-0RH_FC.i386
compat-gcc-c++ is needed by mysql-4.1.11-0RH_FC.i386
automake is needed by mysql-4.1.11-0RH_FC.i386
autoconf is needed by mysql-4.1.11-0RH_FC.i386
奇怪的是無法一次安裝,所以就分兩次囉!
yum install compat-gcc compat-gcc-c++
會發現更多的相依套件要裝...
yum install automake autoconf
安裝好相關套件後,再執行一次,就可以 Run 了...
[root@dns01 SPECS]# rpmbuild -ba mysql4.1.spec
但...又出現錯誤
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
error: Bad exit status from /var/tmp/rpm-tmp.14234 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.14234 (%build)
我再試著 rpmbuild 另外一個檔(好像是自動產生的)
[root@dns01 SPECS]# rpmbuild -ba mysql-4.1.11.spec
error: Failed build dependencies:
ncurses-devel is needed by MySQL-4.1.11-0.i386
yum install ncurses-devel
[root@dns01 SPECS]# rpmbuild -ba mysql-4.1.11.spec
還是有錯誤
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
error: Bad exit status from /var/tmp/rpm-tmp.87625 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.87625 (%build)
我猜測是 gcc 沒裝
yum install gcc
離下班還有大約一個小時十分鐘,剛剛寄了一條電源線給台中站,還有一台電腦 c0002 給新竹。
我快睡著了...眼睛越來越重...晚上世傑要來搬他的電腦,我得跟良澤談一下房租的事情。
再來一次
[root@dns01 SPECS]# rpmbuild -ba mysql-4.1.11.spec
還是錯誤
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
error: Bad exit status from /var/tmp/rpm-tmp.9131 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.9131 (%build)
看來是 gcc-c++ 沒裝
yum install gcc-c++
活在有 yum/apt 的時代,真的蠻幸福的,缺什麼就給它 yum 一下就有了。
再來一次
[root@dns01 SPECS]# rpmbuild -ba mysql-4.1.11.spec
22:02 這次跑比較久,可能會成功哦!
22:07 希望下班前能跑完。
22:09 今天覺得自己在處理 End User 的問題時,自己蠻白痴的,都不知道該怎麼做,我好像退化了
不過好在我 Server 端的問題,越來越得心應手。
22:11 Linux 就是因為太過於彈性了,所以入門,真的不太容易,不過我學到現在,有種倒吃甘蔗的感覺。
22:13 vi 用習慣了,今天因為工作的關係,用了一下 pe2 ,不小心連 vi 的操作方法也帶過去,當然 pe2
是不會理你的啦!
22:15 玩 Linux 的意外收獲,常去讀英文吧!另外也養成了福爾摩斯的精神,去尋找問題點。
22:30 如果下班前還沒跑完,就先放著囉!
22:31 rpmbuild 好像蠻吃系統資源的,重新編譯也難怪啦。
22:34 今天騎腳踏車回到家,可能都要十二點了吧!
22:40 想不到我第一次 rpmbuild 是 build MySQL。
When issuing this command you may encounter some failed dependancies, install the requisite rpms and re-issue the above command.
Once the rpmbuild is in full swing, it takes a while for it all to compile....
However, anything around an hour the new rpms are ready to install. These can be found in the following directory /usr/src/redhat/RPMS/i386 and consist of the following:
mysql-bench-4.1.7-0FC2.i386.rpm
mysql-embedded-4.1.7-0FC2.i386.rpm
mysql-client-4.1.7-0FC2.i386.rpm
mysql-Max-4.1.7-0FC2.i386.rpm
mysql-debuginfo-4.1.7-0FC2.i386.rpm
mysql-server-4.1.7-0FC2.i386.rpm
mysql-devel-4..1.7-0FC2.i386.rpm
mysql-shared-4.1.7-0FC2.i386.rpm
You will also find that you now have your very own custom built source rpm in /usr/src/redhat/SRPMS
mysql-4.1.7-0FC2.src.rpm.
Step 4. Prevent Breaking Dependancies
Attempting to install these newly created RPMs at the momoent will prove troublesome hitting a number of failed dependancies such as php-mysql, qt-mysql .... etc. One option would be to install mysql-4.1, and then re-compile all the failed dependancies, and re-install the dependancies. However there is a far better method, for which thanks is owed to Kenneth Porter for pointing out, and supplying the MySQL-shared-compat.spec file.
To use this spec file, we need to obtain the standard mysql-3.23.58-9.i386.rpm NOT the source rpm. This rpm needs to be copied to /usr/src/redhat/SOURCES and MySQL-shared-compat.spec should be copied to /usr/src/redhat/SPECS
Once the above files have been copied to the correct locations simply build the mysql-shared-compat-3.23.58-9.i386.rpm by issuing the command shown below:
rpmbuild -ba MySQL-shared-compat.spec [ENTER]
This command should be entered when in the directory
/usr/src/redhat/SPECS
This rpm only takes a short while to be created, the mysql-shared-compat-3.23.58-9.i386.rpm rpm is created in the directory
/usr/src/redhat/RPMS/i386
Step 5. Install The RPM(S)
To install your new rpm(s) change directory to, /usr/src/redhat/RPMS/i386 the first time we are installing these we need to force the installation, due to file confilcts between mysql-shared-compat-3.23.58-9.i386.rpm and the currently installed standard rpm. Also the mysql-shared-compat-3.23.58-9.i386.rpm rpm will only be required the once, and will not need to be recompiled for any further subsequent updates. Simply install your required rpms as shown below:
rpm -Uvh --force mysql-shared-compat-3.23.58-9.i386.rpm mysql-server-4.1.7-0FC2.i386.rpm [ENTER]
Step 6. Post Install
Currently the mysql-shared-compat-3.23.58-9.i386.rpm does not update the file
/etc/ld.so.conf so this has to accomplished manually. Add the following line to /etc/ld.so.conf
/usr/lib/mysql
Then execute the command ldconfig as shown below:
ldconfig [ENTER]
To start the mysql daemon simply enter the command:
service mysqld start [ENTER]
Note, if this is a completely new install of MySQL, then the first time that you run the service, MySQL will be initailized.
However, if this is an upgrade from MySQL version 3 then to take advantage of the new priviledge/security features follow the instructions set out at the following address
http://www.mysql.com/doc/en/Upgrading-from-3.23.html
Pros and Cons
Pros:
Latest stable production version of MySQL
Enhanced features of MySQL 4, such as union joins, primary, foreign key relations, improved security...
Using mysql-shared-compat-3.23.58-9.i386.rpm standard updates for applications such as php will work without the need to recompile.
Cons:
Not part of the standard Fedora/RedHat distribution.
來源(再加上一些我實作的心得):
http://fedoranews.org/contributors/tony_smith/mysql/
全站熱搜
留言列表