Ubuntu に php7.0-gdをインストールする

Linux
この記事は約13分で読めます。

 

Ubuntuにphp7.0-gdをインストールする手順です。

 

通常通りにインストールしようとするとパッケージを見つけられません。

$ sudo apt-get install php7.0-gd
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
E: パッケージ php7.0-gd が見つかりません
E: 'php7.0-gd' に一致するパッケージは見つかりませんでした
E: 正規表現 'php7.0-gd' ではパッケージは見つかりませんでした

 

 

                 

環境

 

  • Ubuntu 20.04.3 LTS
    $ cat /etc/os-release 
    NAME="Ubuntu"
    VERSION="20.04.3 LTS (Focal Fossa)"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 20.04.3 LTS"
    VERSION_ID="20.04"
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    VERSION_CODENAME=focal
    UBUNTU_CODENAME=focal

インストール手順

 

  1. レポジトリを追加する

    $ sudo add-apt-repository ppa:ondrej/php
    
    #実行結果↓
     Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
    
    Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
    
    You can get more information about the packages at https://deb.sury.org
    
    IMPORTANT: The -backports is now required on older Ubuntu releases.
    
    BUGS&FEATURES: This PPA now has a issue tracker:
    
    
    DEB.SURY.ORG
    Debian and Ubuntu packaging
    CAVEATS: 1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman 2. If you are using apache2, you are advised to add ppa:ondrej/apache2 3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline ???or ppa:ondrej/nginx PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/ WARNING: add-apt-repository is broken with non-UTF-8 locales, see
    Unable to add PPA Key · Issue #56 · oerdnj/deb.sury.org
    Hey, Trying to add the PPA key but it seems to always fail due to the your name in the PPA Key. gpg:...
    for workaround: # LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php 詳しい情報: https://launchpad.net/~ondrej/+archive/ubuntu/php [ENTER] を押すと続行します。Ctrl-c で追加をキャンセルできます。 ヒット:1 http://jp.archive.ubuntu.com/ubuntu focal InRelease 取得:2 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] ヒット:3 http://dl.google.com/linux/chrome/deb stable InRelease 取得:4 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB] ヒット:5 http://security.ubuntu.com/ubuntu focal-security InRelease 取得:6 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease [23.9 kB] 取得:7 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages [96.0 kB] 取得:8 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main i386 Packages [33.8 kB] 取得:9 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main Translation-en [32.6 kB] 401 kB を 6秒 で取得しました (71.2 kB/s) パッケージリストを読み込んでいます... 完了




  2. アップデート

    $ sudo apt-get update
    
    # 実行結果↓
    ヒット:1 http://jp.archive.ubuntu.com/ubuntu focal InRelease
    取得:2 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]                                                                                                                                                                                                                                                   ヒット:3 http://dl.google.com/linux/chrome/deb stable InRelease
    取得:4 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]                                                                                              
    ヒット:5 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease                                                                                               
    ヒット:6 http://security.ubuntu.com/ubuntu focal-security InRelease                                
    214 kB を 3秒 で取得しました (81.7 kB/s)
    パッケージリストを読み込んでいます... 完了



  3. インストール
    $ sudo apt-get install php7.0-gd
    
    # 実行結果↓
    パッケージリストを読み込んでいます... 完了
    依存関係ツリーを作成しています                
    状態情報を読み取っています... 完了
    以下の追加パッケージがインストールされます:
      php-common php7.0-common
    以下のパッケージが新たにインストールされます:
      php-common php7.0-common php7.0-gd
    アップグレード: 0 個、新規インストール: 3 個、削除: 0 個、保留: 8 個。
    957 kB のアーカイブを取得する必要があります。
    この操作後に追加で 5,079 kB のディスク容量が消費されます。
    続行しますか? [Y/n] y
    取得:1 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php-common all 2:84+ubuntu20.04.1+deb.sury.org+1 [16.3 kB]
    取得:2 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php7.0-common amd64 7.0.33-54+ubuntu20.04.1+deb.sury.org+1 [913 kB]
    取得:3 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php7.0-gd amd64 7.0.33-54+ubuntu20.04.1+deb.sury.org+1 [28.2 kB]
    957 kB を 4秒 で取得しました (267 kB/s)
    以前に未選択のパッケージ php-common を選択しています。
    (データベースを読み込んでいます ... 現在 187333 個のファイルとディレクトリがインストールされています。)
    .../php-common_2%3a84+ubuntu20.04.1+deb.sury.org+1_all.deb を展開する準備をしています ...
    php-common (2:84+ubuntu20.04.1+deb.sury.org+1) を展開しています...
    以前に未選択のパッケージ php7.0-common を選択しています。
    .../php7.0-common_7.0.33-54+ubuntu20.04.1+deb.sury.org+1_amd64.deb を展開する準備をしています ...
    php7.0-common (7.0.33-54+ubuntu20.04.1+deb.sury.org+1) を展開しています...
    以前に未選択のパッケージ php7.0-gd を選択しています。
    .../php7.0-gd_7.0.33-54+ubuntu20.04.1+deb.sury.org+1_amd64.deb を展開する準備をしています ...
    php7.0-gd (7.0.33-54+ubuntu20.04.1+deb.sury.org+1) を展開しています...
    php-common (2:84+ubuntu20.04.1+deb.sury.org+1) を設定しています ...
    Created symlink /etc/systemd/system/timers.target.wants/phpsessionclean.timer → /lib/systemd/system/phpsessionclean.timer.
    php7.0-common (7.0.33-54+ubuntu20.04.1+deb.sury.org+1) を設定しています ...
    
    Creating config file /etc/php/7.0/mods-available/calendar.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/ctype.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/exif.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/fileinfo.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/ftp.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/gettext.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/iconv.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/pdo.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/phar.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/posix.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/shmop.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/sockets.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/sysvmsg.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/sysvsem.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/sysvshm.ini with new version
    
    Creating config file /etc/php/7.0/mods-available/tokenizer.ini with new version
    php7.0-gd (7.0.33-54+ubuntu20.04.1+deb.sury.org+1) を設定しています ...
    
    Creating config file /etc/php/7.0/mods-available/gd.ini with new version




  4. インストール確認

    $ sudo apt list --installed | grep php
    
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    
    php-common/focal,focal,now 2:84+ubuntu20.04.1+deb.sury.org+1 all [インストール済み、自動]
    php7.0-common/focal,now 7.0.33-54+ubuntu20.04.1+deb.sury.org+1 amd64 [インストール済み、自動]
    php7.0-gd/focal,now 7.0.33-54+ubuntu20.04.1+deb.sury.org+1 amd64 [インストール済み]


以上です。

                 
Linux
                 
シェアする

コメント

タイトルとURLをコピーしました