さくらのVPS512のCentOSに RPMforge/EPEL/Remi リポジトリを追加

AdditionalResources/Repositories/RPMForge – CentOS Wiki」の記事を参考にして、さくらインターネットさんの「さくらのVPS512」に RPMforge/EPEL/Remi リポジトリを追加しました。

以下、私が行った手順です

RPMforgeリポジトリの追加

  • x86_64用のパッケージ(rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm)をダウンロードしました。)
    $ su -
    # cd ~
    # mkdir ./work
    # cd work
    # wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
    
  • GPG keyをインストールしました。
    # rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
    
  • ダウンロードした「rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm」をチェックしました。
    # rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
    rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm: (sha1) dsa sha1 md5 gpg OK
    
  • 「rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm」をインストールしました。
    # rpm -ivh rpmforge-release-0.5.2-2.el5.rf.*.rpm
    

EPELリポジトリの追加

  • x86_64用のパッケージ(epel-release-5-4.noarch.rpm)をダウンロードしました。)
    $ su -
    # cd ~
    # mkdir ./work
    # cd work
    # wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
    
  • GPG keyをインストールしました。
    # rpm --import http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL
    
    /
  • ダウンロードした「epel-release-5-4.noarch.rpm」をチェックしました。
    # rpm -K epel-release-5-4.noarch.rpm
    epel-release-5-4.noarch.rpm: (sha1) dsa sha1 md5 gpg OK
    
  • 「epel-release-5-4.noarch.rpm」をインストールしました。
    # rpm -ivh epel-release-5-4.noarch.rpm
    

Remiリポジトリの追加

  • x86_64用のパッケージ(remi-release-5-8.el5.remi.noarch.rpm)をダウンロードしました。)
    $ su -
    # cd ~
    # mkdir ./work
    # cd work
    # wget http://rpms.famillecollet.com/enterprise/5/remi/x86_64/remi-release-5-8.el5.remi.noarch.rpm
    
  • GPG keyをインストールしました。
    # rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
    
    /
  • ダウンロードした「remi-release-5-8.el5.remi.noarch.rpm」をチェックしました。
    # rpm -K remi-release-5-8.el5.remi.noarch.rpm
    remi-release-5-8.el5.remi.noarch.rpm: (sha1) dsa sha1 md5 gpg OK
    
  • 「remi-release-5-8.el5.remi.noarch.rpm」をインストールしました。
    # rpm -ivh remi-release-5-8.el5.remi.noarch.rpm
    

yum-prioritiesの導入

  • yum-prioritiesをインストールしました。
    # yum install yum-priorities
    
  • RPMforge/EPEL/Remi のrepoファイルを編集して、リポジトリを無効化しました。
    # cd /etc/yum.repos.d/
    # ls
    CentOS-Base.repo       epel-testing.repo	mirrors-rpmforge-testing
    CentOS-Debuginfo.repo  epel.repo		remi.repo
    CentOS-Media.repo      mirrors-rpmforge		rpmforge.repo
    CentOS-Vault.repo      mirrors-rpmforge-extras
    #
    
    • rpmforge.repoを編集して「enabled = 0」にしました。
      # nano rpmforge.repo
      
    • epel.repoを編集して「enabled = 0」にしました。
      # nano epel.repo
      
    • remi.repoを編集しての記載が「enabled = 0」であることを確認しました。
      # nano remi.repo
      
  • RPMforge/EPEL/Remi リポジトリからパッケージを探す場合は、「–enablerepo=rpmforge」「–enablerepo=epel」「–enablerepo=remi」オプションを指定してhogehogeを「search」します。
    # yum --enablerepo=rpmforge search hogehoge
    # yum --enablerepo=epel search hogehoge
    # yum --enablerepo=remi search hogehoge
    
  • [RPMforge/EPEL/Remi]リポジトリからのパッケージをインストールする場合は、「–enablerepo=rpmforge」オプションを指定してhogehogeを「install」します。
    # yum --enablerepo=rpmforge install hogehoge
    # yum --enablerepo=epel install hogehoge
    # yum --enablerepo=remi install hogehoge
    

注記)EPELリポジトリをインストールした後にRemiリポジトリをインストールしないと、エラーになりました。

    epel-release >= 5 は remi-release-5-8.el5.remi.noarch に必要とされています

Tags:

Ubuntu11.10 にPEARのServices_Amazonをインストール

PEAR(PHPで利用する事ができるライブラリ)のServices_Amazonを使用するとProduct Advertising APIを使用したPHPプログラムが簡単に作成出来るので、Ubuntu11.10 にPEARのServices_Amazonをインストールーしました。以下、私が行った手順です。

Ubuntu11.10 にPEARのServices_Amazonをインストール

  • apt-getコマンドで、php-pearをインストールしました。
    $ sudo apt-get install php-pear
    $ which pear
    /usr/bin/pear
    
  • pearコマンドで、services_amazon-betaをインストールしました。
    $ sudo pear install --alldeps services_amazon-beta
    $ pear list
    Installed packages, channel pear.php.net:
    =========================================
    Package          Version State
    Archive_Tar      1.3.7   stable
    Cache            1.5.6   stable
    Console_Getopt   1.3.0   stable
    HTTP_Request     1.4.4   stable
    Net_Socket       1.0.10  stable
    Net_URL          1.0.15  stable
    PEAR             1.9.2   stable
    Services_Amazon  0.8.0   beta
    Structures_Graph 1.0.4   stable
    XML_Parser       1.3.4   stable
    XML_Serializer   0.20.2  beta
    XML_Util         1.2.1   stable
    
  • ついでにPEAR::PagerとPEAR::Var_Dumpもインストールしました。
    $ sudo pear install Pager
    $ sudo pear install Var_Dump
    $ pear list
    Installed packages, channel pear.php.net:
    =========================================
    Package          Version State
    Archive_Tar      1.3.7   stable
    Cache            1.5.6   stable
    Console_Getopt   1.3.0   stable
    HTTP_Request     1.4.4   stable
    Net_Socket       1.0.10  stable
    Net_URL          1.0.15  stable
    PEAR             1.9.2   stable
    Pager            2.4.8   stable
    Services_Amazon  0.8.0   beta
    Structures_Graph 1.0.4   stable
    Var_Dump         1.0.4   stable
    XML_Parser       1.3.4   stable
    XML_Serializer   0.20.2  beta
    XML_Util         1.2.1   stable
    

インストール後、実際に簡単なプログラムを作成して、PEAR::Services_Amazonの動作確認を行いました。作成したプログラムは、以下に示す「PEAR::Services_Amazonを使用して、ISBNに該当する本を探す」プログラムです。PEAR::Services_Amazonを使用した検索結果は、配列に格納されるので、PEAR::Var_Dumpを使用して、検索結果を見易くして表示しています。

<?php
// PEAR::Services_Amazonを使用して、ISBNに該当する本を探す
// インクルードファイル
require_once("Services/Amazon.php");
require_once("Var_Dump.php");
// 定数
define("ACCESSKEY_ID", "xxxxxxxxxxxxxxxxxxxx");
define("SECRET_ACCESSKEY", "xxxxxxxxxxxxxxxxxxxx");
define("ASSOCIATE_ID", "xxxxxxxxxx-22");
define("ECS_VERSION","2009-01-06");
define("RESPONSE_GROUP','Small");
// 変数
$id_type='ISBN';
$id_isbn='4062171260';
$search_index='Books';
// Services_Amazonの呼び出し
$amazon = new Services_Amazon(ACCESSKEY_ID,SECRET_ACCESSKEY,ASSOCIATE_ID);
$amazon->setLocale('JP');
$options = array();
$options['ResponseGroup'] = RESPONSE_GROUP;
$options['SearchIndex'] = $search_index;
$options['IdType'] = $id_type;
//検索結果を配列に格納
$ret = $amazon->ItemLookup($id_isbn, $options);
//検索結果の表示
Var_Dump::display($ret);
?>

上記プログラムの実行結果は、下記のようになります。

array(2) {
  Request => array(2) {
    IsValid => string(4) True
    ItemLookupRequest => array(5) {
      IdType => string(4) ISBN
      ItemId => string(10) 4062171260
      ResponseGroup => array(1) {
        0 => string(5) Small
      }
      SearchIndex => string(5) Books
      VariationPage => string(3) All
    }
  }
  Item => array(1) {
    0 => array(4) {
      ASIN => string(10) 4062171260
      DetailPageURL => string(388) http://www.amazon.co.jp/%E3%82%B9%E3%83%86%E3%82%A3%E3%83%BC%E3%83%96%E3%83%BB%E3%82%B8%E3%83%A7%E3%83%96%E3%82%BA-I-%E3%82%A6%E3%82%A9%E3%83%AB%E3%82%BF%E3%83%BC%E3%83%BB%E3%82%A2%E3%82%A4%E3%82%B6%E3%83%83%E3%82%AF%E3%82%BD%E3%83%B3/dp/4062171260%3FSubscriptionId%3DAKIAJ5GZMV5ZNXB4GYUA%26tag%3Dohhappy0b-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4062171260
      ItemLinks => array(1) {
        ItemLink => array(4) {
          0 => array(2) {
            Description => string(15) Add To Wishlist
            URL => string(218) http://www.amazon.co.jp/gp/registry/wishlist/add-item.html%3Fasin.0%3D4062171260%26SubscriptionId%3DAKIAJ5GZMV5ZNXB4GYUA%26tag%3Dohhappy0b-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D5143%26creativeASIN%3D4062171260
          }
          1 => array(2) {
            Description => string(13) Tell A Friend
            URL => string(183) http://www.amazon.co.jp/gp/pdp/taf/4062171260%3FSubscriptionId%3DAKIAJ5GZMV5ZNXB4GYUA%26tag%3Dohhappy0b-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D5143%26creativeASIN%3D4062171260
          }
          2 => array(2) {
            Description => string(20) All Customer Reviews
            URL => string(187) http://www.amazon.co.jp/review/product/4062171260%3FSubscriptionId%3DAKIAJ5GZMV5ZNXB4GYUA%26tag%3Dohhappy0b-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D5143%26creativeASIN%3D4062171260
          }
          3 => array(2) {
            Description => string(10) All Offers
            URL => string(189) http://www.amazon.co.jp/gp/offer-listing/4062171260%3FSubscriptionId%3DAKIAJ5GZMV5ZNXB4GYUA%26tag%3Dohhappy0b-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D5143%26creativeASIN%3D4062171260
          }
        }
      }
      ItemAttributes => array(5) {
        Author => array(1) {
          0 => string(39) ウォルター・アイザックソン
        }
        Creator => array(1) {
          0 => array(2) {
            Role => string(6) 翻訳
            _content => string(13) 井口 耕二
          }
        }
        Manufacturer => string(9) 講談社
        ProductGroup => string(4) Book
        Title => string(32) スティーブ・ジョブズ I
      }
    }
  }
}

上記の【DetailPageURL】が検索したISBN番号が4062171260の「スティーブ・ジョブズ I」という本へのリンクURLになります。

 スティーブ・ジョブズ I
 【ウォルター・アイザックソン】
 講談社 より 2011-10-25 発売
 ロープライス ¥ 1,130 or 新品 ¥ 1,995
 

Ubuntu11.10のLAMP環境(Apache)でUserDirを有効にする

Ubuntu11.10でtaskselを使用して一発で構築したLAMP環境において、Apacheのデフォルト設定でUserDirが無効になっており、ユーザーのホームディレクトリに作成したpublic_html(Webサイト公開用ディレクトリ)にある内容をブラウザで参照出来ませんでした。

Ubuntu11.10でのuserdirの設定は、「/etc/apache2/mods-enabled/userdir.conf」に記載されており、a2enmodコマンドでuserdirモジュールを追加した後に、Apacheを再起動しすると設定が有効化になるようでした。

また、userdirモジュールを追加しただけでは、ユーザーのホームディレクトリに作成したpublic_html(Webサイト公開用ディレクトリ)でphpファイルの実行が出来ない設定になっていました。「/etc/apache2/mods-available/php5.conf」に記載されている「php_admin_value engine Off」をコメントアウト(#php_admin_value engine Off)すると、public_htmlでphpファイルの実行が出来るようになりました。以下、私が行った手順です。

Ubuntu11.10のLAMP環境(Apache)でUserDirを有効にする

  • a2enmodコマンドでuserdirモジュールを追加しました。
    $ sudo a2enmod userdir
    
  • 「/etc/apache2/mods-enabled/userdir.conf」エディタ(nano)で編集して、以下の内容に変更しました。
    $ cd /etc/apache2/mods-enabled/
    $ nano userdir.conf
    
    以下の「userdir.conf」の内容を
    <IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root
        <Directory /home/*/public_html>
            AllowOverride FileInfo AuthConfig Limit Indexes
            Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
            <Limit GET POST OPTIONS>
                Order allow,deny
                Allow from all
            </Limit>
            <LimitExcept GET POST OPTIONS>
                Order deny,allow
                Deny from all
            </LimitExcept>
            </Directory>
    </IfModule>
    
    以下に変更しました。
    <IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root
        <Directory /home/*/public_html>
            Options FollowSymLinks Includes ExecCGI
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    </IfModule>
    
  • Apacheを再起動しました。
    $ sudo servisce apache2 restart
    
  • テスト用のindex.htmlを作成し、ブラウザでユーザーのホームディレクトリーにアクセスして、テスト用index.htmlの内容が表示されることを確認しました。
    $ mkdir public_html
    $ chmod 755 public_html
    $ cd public_html
    $ nano index.html
    
    【テスト用のindex.html】
    <html lang="ja">
    <head> 
    <title>テスト用index.html</title>
    </head> 
    <body>
    <p>
    テスト用のindex.htmlです。
    </p>
    </body>
    </head>
    
  • PHPの動作テストを行うため、テスト用のPHPファイル(info.php)を作成し、ブラウザでユーザーのホームディレクトリーのテスト用のPHPファイル(info.php)にアクセスしたところ、ファイルの内容は表示されずに、ファイルをダウンロードするというダイアログが表示されてしまいました。(ubuntu11.10では、ユーザーのホームディレクトリに作成したpublic_html(Webサイト公開用ディレクトリ)で、phpの実行がデフォルトでは出来ない設定になっているようです。) 【info.php】
    <?php
    phpinfo();
    ?>
    
  • 「/etc/apache2/mods-available/php5.conf」をエディタ(nano)で編集して、記載されている「php_admin_value engine Off」をコメントアウト(#php_admin_value engine Off)しました。
    $ cd /etc/apache2/mods-available/
    $ sudo nano php5.conf
    
    【php5.conf】
    <IfModule mod_php5.c>
        <FilesMatch "\.ph(p3?|tml)$">
            SetHandler application/x-httpd-php
        </FilesMatch>
        <FilesMatch "\.phps$">
            SetHandler application/x-httpd-php-source
        </FilesMatch>
        # To re-enable php in user directories comment the following lines
        # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
        # prevents .htaccess files from disabling it.
        <IfModule mod_userdir.c>
            <Directory /home/*/public_html>
                #php_admin_value engine Off
            </Directory>
        </IfModule>
    </IfModule>
    
  • serviceコマンドでApache2を再起動しました。
    $ sudo service apache2 restart
     
  • PHPの動作テストを行うため、テスト用のPHPファイル(info.php)を作成し、ブラウザでユーザーのホームディレクトリーのテスト用のPHPファイル(info.php)にアクセスし、ファイルの内容が表示されることを確認しました。


Ubuntu11.10にEclipse(PDT)でPHP 開発環境を構築する

Ubuntu11.10にEclipseをインストールし、日本語化した後にPHP 開発ツール (PDT)をインストールしてPHP開発環境を構築しました。以下、私が行った手順です。

Eclipse(PDT)でPHP 開発環境を構築

  • Ubuntu11.10には、java1.6がプリインストールされていたので、Java環境の準備は、特に何もする必要は有りませんでした。
    $ java -version
    java version "1.6.0_23"
    OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5)
    OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
    $
    
  • UbuntuソフトウェアーセンターからEclipseを検索しインストールしました。
  • 次いで、UbuntuソフトウェアーセンターからPleiadesを検索してインストールしました。
  • ルートになった後、(必要に応じてeclipse.iniをコピーし、)「/usr/lib/eclipse/eclipse.ini」ファイルをエディタ(nano)で開きました。
    $ sudo -s
    #  cd /usr/lib/eclipse/
    (#  cp eclipse.ini eclipse.ini.org)
    # nano eclipse.ini
    # exit
    
  • 次いで、「/usr/lib/eclipse/eclipse.ini」の最後に以下の記述を追加し、ファイルを保存しました。
    -javaagent:/usr/lib/eclipse/plugins/jp.sourceforge.mergedoc.pleiades/pleiades.jar
    
  • 端末から以下のコマンド「eclipse -clean」でEclipseを起動すると、無事に日本語化出来ていました。
    $ eclipse -clean
    
  • PHP開発環境として、PDTをインストールしました。Eclipseの「ヘルプ 」→ 「新規ソフトウェアのインストール 」でプラグインのインストールダイアログを表示させました。
  • “使用可能なソフトウェア・サイト”のリンクをクリックし表示されたダイアログで、全てのロケーションにチェックを入れて、「OK」ボタンをクリックしました。
  • 次いで、作業対象のドロップダウンリストから「全ての使用可能なサイト」を選択し、名前の欄で、「プログラミング言語」 の 「PHP 開発ツール (PDT) SDK フィーチャー」にチェックを入れ「次へ」ボタンをクリックしました。
  • ライセンスに同意するとインストールが始まり、インストールが終了すると再起動を促されたので「今すぐ再起動」ボタンをクリックして再起動しました。
  • 新規プロジェクトでPHPプロジェクトが選択出来ることを確認し、インストールを終了しました。


Ubuntu11.10にTuxGuitarをインストール

窓の杜で紹介されていた「ギター用のタブ譜で入力できるギタリスト向けMIDIシーケンサー「TuxGuitar」」をiMacのVMWareFusionにインストールしたUbuntu11.10にインストールしたのですが、音が鳴りませんでした。Ubuntuには「ソフトウェアMIDI音源」が標準でインストールされていないために、標準インストールの状態では、TuxGuitarの音は鳴らないようです。フリーのシンセサイザー「fluidsynth」とその GUIである「qsynth」及び音色ライブラリ「fluid-soundfont-gm」をインストールしたところ、TuxGuitarで音が鳴るようになりました。以下、私が行った手順です

Ubuntu11.10にTuxGuitarをインストール

  • UnityメニューからUbuntuソフトウェアーセンターを起動しました。
  • UbuntuソフトウェアーセンターからTuxGuitarを検索してインストールしました。
  • Ubuntuソフトウェアーセンターからフリーのシンセサイザー「fluidsynth」を検索してインストールしました。
  • Ubuntuソフトウェアーセンターから「fluidsynth」のQt GUI インターフェースである「qsynth」を検索してインストールしました。
  • 「fluidsynth」の音色ライブラリ「fluid-soundfont-gm」と、拡張パックの「 fluid-soundfont-gs」を検索してインストールしました。
  • Dashホームのメディア関連ソフトから「qsynth」を探して起動しました。
  • 「qsynth」の「Setup」を押し、表示されたSetupダイアログの「Audio」タブにある「Audio Driver: 」を 「alsa 」に変更しました。
  • 「qsynth」のSetupダイアログで「Soundfonts」タブを開き、「Open」ボタンで「/usr/share/sounds/sf2/FluidR3_GM.sf2」を開きました。
  • Dashホームのメディア関連ソフトからTuxGuitarを起動して、メニューの「ツール」-「環境設定/Settings」の「サウンド」設定で。MIDIポートを「Synth inputport」に変更しました。

以上で、Ubuntu11.10にインストールしたTuxGuitarの音が鳴るようになりました。音も以外といい感じです。「Guitar Pro 6」には及ばないかもしれませんが、「ULTIMATE GUITAR TABS ARCHIVE」からTAB譜をダウンロードして再生したりなど色々楽しめそうです。