<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>おいぬま日報 &#187; Debian</title>
	<atom:link href="http://tech.lampetty.net/tech/index.php/archives/category/debian/feed" rel="self" type="application/rss+xml" />
	<link>http://tech.lampetty.net/tech</link>
	<description>Apache, MySQL, Perl, WordPressあたり</description>
	<lastBuildDate>Sun, 18 Jul 2010 19:00:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/category/debian/feed" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>MySQL 5.1の最新のソースからdebを作成する</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/360</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/360#comments</comments>
		<pubDate>Sun, 03 Jan 2010 09:06:08 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=360</guid>
		<description><![CDATA[以前というエントリを書いたのですが、Ubuntuの最新の開発版パッケージではなく、MySQLが出している最新のMySQLのソースをビルドしてdebパッケージを作成する方法を見つけたのでメモしておきます。ちなみにMySQL [...]]]></description>
			<content:encoded><![CDATA[<p>以前<a href="http://tech.lampetty.net/tech/index.php/archives/331" class="permalinker_link">MySQL 5.1の最新版のdebパッケージを作成する方法</a>というエントリを書いたのですが、Ubuntuの最新の開発版パッケージではなく、MySQLが出している最新のMySQLのソースをビルドしてdebパッケージを作成する方法を見つけたのでメモしておきます。ちなみにMySQL以外にもperlとかのパッケージもこの方法で最新にすることが出来ると思います。</p>
<h3>debを作成するための準備</h3>
<p>まずはビルドする人間のメールアドレスと名前を環境変数で設定しておきます。適当に自分のものに置き換えて下さい。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DEBEMAIL</span>=<span style="color: #ff0000;">&quot;hogehoge@foo.com&quot;</span>
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DEBFULLNAME</span>=<span style="color: #ff0000;">&quot;Your Name&quot;</span></pre></div></div>

<p>次にパッケージをビルドするために必要なものをインストールします。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> dh-make devscripts debhelper fakeroot lintian <span style="color: #c20cb9; font-weight: bold;">sudo</span> pbuilder piuparts dpatch build-essential
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> build-dep mysql-server-<span style="color: #000000;">5.1</span></pre></div></div>

<h3>ソースの取得</h3>
<p>Ubuntuのdebを作成するのに使われているソースを取得します。ソースはカレントディレクトリに展開されるので、必要があれば適当なディレクトリに cd しておいてください。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #7a0874; font-weight: bold;">source</span> mysql-server-<span style="color: #000000;">5.1</span></pre></div></div>

<p>次に最新のMySQLのソースを<a href="http://dev.mysql.com/downloads/mysql/5.1.html#source">mysql.com</a>より取得します。&#8221;Select Platform&#8221;というプルダウンで&#8221;Source Code&#8221;を選択し、&#8221;Generic Linux (Architecture Independent), Compressed TAR Archive&#8221;をダウンロードして下さい。現在の最新版は5.1.42になるので、mysql-5.1.42.tar.gz としてダウンロードしています。</p>
<h3>ビルド</h3>
<p>ではビルドを始めます。uupdate というコマンドを使うと、自動的に引数で指定した最新のソースパッケージを展開しそこにDebianのパッケージを作成するためのファイルが生成されます。(つーか<br />
uupdate便利過ぎ！)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> mysql-dfsg-<span style="color: #000000;">5.1</span>-5.1.37
$ uupdate ..<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.42.tar.gz</pre></div></div>

<p>&#8220;cd ../mysql-dfsg-5.1-5.1.42 しろ&#8221;と言われるので、cd してパッケージをビルドします。(私はAthlon X2 5050eの環境で約2.5時間かかりました)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ dpkg-buildpackage <span style="color: #660033;">-uc</span> <span style="color: #660033;">-us</span> <span style="color: #660033;">-rfakeroot</span></pre></div></div>

<h3>インストール</h3>
<p>ビルドが完了すると .deb パッケージがソースパッケージのディレクトリに作成されているので、必要なものをdpkg -iしてインストールします。ただし、依存関係が若干複雑なのでエラーが出たら依存しているものを先にインストールすると良いでしょう。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> \
libmysqlclient16_5.1.42-0ubuntu1_amd64.deb \
libmysqlclient-dev_5.1.42-0ubuntu1_amd64.deb \
libmysqlclient16-dev_5.1.42-0ubuntu1_all.deb \
mysql-common_5.1.42-0ubuntu1_all.deb \
mysql-client-<span style="color: #000000;">5.1</span>_5.1.42-0ubuntu1_amd64.deb \
mysql-client_5.1.42-0ubuntu1_all.deb \
mysql-server-<span style="color: #000000;">5.1</span>_5.1.42-0ubuntu1_amd64.deb \
mysql-server-core-<span style="color: #000000;">5.1</span>_5.1.42-0ubuntu1_amd64.deb \
mysql-server_5.1.42-0ubuntu1_all.deb \
libmysqld-dev_5.1.42-0ubuntu1_amd64.deb \
libmysqld-pic_5.1.42-0ubuntu1_amd64.deb</pre></div></div>

<p>無事にインストールできれば、これでmysql-server-5.1が最新版になっています。mysqlコマンドでSQLを発行して動作を確認してみて下さい。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ mysql <span style="color: #660033;">-uroot</span> <span style="color: #660033;">-pxxxxx</span>
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection <span style="color: #c20cb9; font-weight: bold;">id</span> is <span style="color: #000000;">72</span>
Server version: 5.1.42-0ubuntu1-log <span style="color: #7a0874; font-weight: bold;">&#40;</span>Ubuntu<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/360/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/360" />
	</item>
		<item>
		<title>MySQL 5.1の最新版のdebパッケージを作成する方法</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/331</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/331#comments</comments>
		<pubDate>Sat, 29 Aug 2009 23:28:23 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=331</guid>
		<description><![CDATA[Ubuntu 9.04にはMySQL 5.1のパッケージが用意されているのですが、バージョンが5.1.31であり最新ではないので(現時点で最新は5.1.37)、最新版のdebパッケージを作成する方法を紹介します。debを [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu 9.04にはMySQL 5.1のパッケージが用意されているのですが、バージョンが5.1.31であり最新ではないので(現時点で最新は5.1.37)、最新版のdebパッケージを作成する方法を紹介します。debを作成するといっても、開発中のUbuntuに入っているmysql-server-5.1のソースを持ってきてビルドするだけなので、比較的お手軽にできます。</p>
<h3>debを作成するための準備</h3>
<p>まずはビルドする人間のメールアドレスと名前を環境変数で設定しておきます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DEBEMAIL</span>=<span style="color: #ff0000;">&quot;hogehoge@foo.com&quot;</span>
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DEBFULLNAME</span>=<span style="color: #ff0000;">&quot;Your Name&quot;</span></pre></div></div>

<p>次にパッケージをビルドするために必要なものをインストールします。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> dh-make devscripts debhelper fakeroot lintian <span style="color: #c20cb9; font-weight: bold;">sudo</span> pbuilder piuparts dpatch</pre></div></div>

<h3>ソースの取得</h3>
<p><a href="https://launchpad.net/ubuntu/+source/mysql-dfsg-5.1">“mysql-dfsg-5.1” source package in Ubuntu</a>よりdevelopmentのkarmicの方のリンクをクリックして、その先の画面で以下の3つのファイルをダウンロードします。</p>
<ul>
<li>mysql-dfsg-5.1_5.1.37.orig.tar.gz &#8211; ソースtarボール</li>
<li>mysql-dfsg-5.1_5.1.37-1ubuntu2.diff.gz &#8211; debを作成するためのdiff</li>
<li>mysql-dfsg-5.1_5.1.37-1ubuntu2.dsc &#8211; パッケージングのルールを記載したファイル</li>
</ul>
<p>今回は ~/deb というディレクトリを作成してその中で作業するので、debディレクトリにダウンロードしておきます。</p>
<h3>mysql-dfsg-5.1のビルド</h3>
<p>mysql-dfsg-5.1のビルドに必要なパッケージをインストールしておきます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> build-dep mysql-server-<span style="color: #000000;">5.1</span></pre></div></div>

<p>次にソースを展開します。dpkg-source -x を実行するとソースを展開するだけはなく、パッチも自動的に当ててくれます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ dpkg-source <span style="color: #660033;">-x</span> mysql-dfsg-<span style="color: #000000;">5.1</span>_5.1.37-1ubuntu2.dsc
dpkg-source: warning: extracting unsigned <span style="color: #7a0874; font-weight: bold;">source</span> package <span style="color: #7a0874; font-weight: bold;">&#40;</span>mysql-dfsg-<span style="color: #000000;">5.1</span>_5.1.37-1ubuntu2.dsc<span style="color: #7a0874; font-weight: bold;">&#41;</span>
dpkg-source: extracting mysql-dfsg-<span style="color: #000000;">5.1</span> <span style="color: #000000; font-weight: bold;">in</span> mysql-dfsg-<span style="color: #000000;">5.1</span>-5.1.37
dpkg-source: info: unpacking mysql-dfsg-<span style="color: #000000;">5.1</span>_5.1.37.orig.tar.gz
dpkg-source: info: applying mysql-dfsg-<span style="color: #000000;">5.1</span>_5.1.37-1ubuntu2.diff.gz</pre></div></div>

<p>そしていよいよビルドです。(私はAthlon X2 5050eの環境で約2時間かかりました)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> mysql-dfsg-<span style="color: #000000;">5.1</span>-5.1.37
$ debuild <span style="color: #660033;">-us</span> <span style="color: #660033;">-uc</span></pre></div></div>

<p>場合によっては「&#8221;hardening-wrapper&#8221;というパッケージがないよ」というエラーになってビルドできないかもしれないので、このパッケージをaptitudeでインストールしておきます。</p>
<p>完了すると .deb パッケージが~/deb/配下に作成されているので、必要なものをdpkg -iしてインストールします。ただし、依存関係が若干複雑なのでエラーが出たら依存しているものを先にインストールすると良いでしょう。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> mysql-common_5.1.37-1ubuntu2_all.deb ¥ 
 libmysqlclient16_5.1.37-1ubuntu2_amd64.deb ¥
 mysql-client_5.1.37-1ubuntu2_all.deb ¥
 mysql-client-<span style="color: #000000;">5.1</span>_5.1.37-1ubuntu2_amd64.deb
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> mysql-server-core-<span style="color: #000000;">5.1</span>_5.1.37-1ubuntu2_amd64.deb ¥
 mysql-server-<span style="color: #000000;">5.1</span>_5.1.37-1ubuntu2_amd64.deb ¥
 mysql-server-<span style="color: #000000;">5.1</span>_5.1.37-1ubuntu2_amd64.deb</pre></div></div>

<p>なお、5.0から5.1にアップグレードするような場合、my.cnfに使えなくなったオプションを書いていたりするとmysqldの起動に失敗するので、エラーログを見て適切に対処しましょう。例えば私の場合は &#8211;skip-bdb というオプションが使えなくなっていてエラーになっていました。</p>
<p>無事にインストールできれば、これでmysql-server-5.1が最新版になっています。mysqlコマンドでSQLを発行して動作を確認してみて下さい。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ mysql <span style="color: #660033;">-uroot</span> <span style="color: #660033;">-pxxxxx</span>
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection <span style="color: #c20cb9; font-weight: bold;">id</span> is <span style="color: #000000;">68</span>
Server version: 5.1.37-1ubuntu2-log <span style="color: #7a0874; font-weight: bold;">&#40;</span>Ubuntu<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<h3>補足</h3>
<p>今回はUbuntu 9.04で試しましたが、Debianでも同じ手順でパッケージを作成することができるはずです。また、debパッケージの作成にあたって<a href="http://wiki.debian.org/HidekiYamane?action=AttachFile&#038;do=get&#038;target=20080916_ylug_upload.pdf">Debianパッケージ60分クッキング(PDF)</a>を参考にさせて頂きました。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/331/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/331" />
	</item>
		<item>
		<title>Debianではapt-getじゃなくてaptitudeを推奨</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/301</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/301#comments</comments>
		<pubDate>Thu, 30 Apr 2009 15:42:25 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=301</guid>
		<description><![CDATA[ここを読んでて知ったのですが、Debianではetchからパッケージ管理のフロントエンドとして apt-get じゃなくて aptitude を推奨するようになっていたのですね。依存関係がなくなった時点でパッケージを削除 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jp.debian.org/releases/stable/i386/release-notes/ch-whats-new.ja.html#pkgmgmt">ここ</a>を読んでて知ったのですが、Debianではetchからパッケージ管理のフロントエンドとして apt-get じゃなくて aptitude を推奨するようになっていたのですね。依存関係がなくなった時点でパッケージを削除したり、推奨レベルのパッケージを一緒にインストールすることができるのが理由っぽい。</p>
<p>しばらくDebianの情報集めをしていなかったので、すっかり浦島太郎状態です&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/301/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/301" />
	</item>
	</channel>
</rss>
