プログラミング、フリーダイビング、ブロックチェーンのブログ

プログラミング道場

私がオススメするプログラミング教材です

私がおすすめするプログラミング教材のまとめ【書籍】

目次1 これからエンジニアになりたい人へ向けた本2 プログラミング言語3 アプリ開発4 サーバー、インフラ、セキュリティなど5 機械学習系6 ゲーム開発7 データベース8 デザイン9 組織作り10 自作シリーズ11 その他12 おまけ これ ...

続きを見る

Elastic BeanstalkでLD_LIBRARY_PATHを通す方法

投稿日:

記事の内容


この記事では、Elastic Beanstalkを使ってLD_LIBRARY_PATHを通す方法を紹介します。

LD_LIBRARY_PATHを通す方法

例えば、Oracleをインストールしたいとします。

commands:
  command block:
    command: |
      curl -o oracle-instantclient18.3-basic-18.3.0.0.0-3.x86_64.rpm http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient18.3-basic-18.3.0.0.0-3.x86_64.rpm
      curl -o oracle-instantclient18.3-sqlplus-18.3.0.0.0-3.x86_64.rpm http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient18.3-sqlplus-18.3.0.0.0-3.x86_64.rpm
      sudo yum -y localinstall oracle-instantclient18.3-basic-18.3.0.0.0-3.x86_64.rpm
      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/custom/path/
    cwd: "~"

これは上手くいきません。
Oracleのインストールはできるのですが、LD_LIBRARY_PATHは更新されません。
では、どうしたらいいのか?

そこで、.ebextensionsに以下のファイルを作成します。

files:
 "/etc/ld.so.conf.d/oracle-18.3.conf":
    mode: "000644"
    owner: root
    group: root
    content: |
     /usr/lib/oracle/18.3/client64/lib

commands:
  command block:
    command: ldconfig

「/etc/ld.so.conf.d」配下に新しいファイルを作成することで、LD_LIBRARY_PATHを更新するのと同じ効果が得られます。
ファイルを置いた後は、ldconfigでライブラリ情報を更新しましょう。

最後に以下のコマンドを打って、Pathが通っているのか確認します。

ldconfig -p | grep oracle

-Linux, プログラミング

Copyright© プログラミング道場 , 2024 All Rights Reserved Powered by AFFINGER4.