apt list にphalconが出てこないときの対処法 

# 背景
- 自宅のWSL環境にphalcon入れようとしたら詰まったのでメモ
- どちらかというと、aptリポジトリのお話

# 環境

- Windwos 10 バージョン1903
- WSL2
- Pengwin （Debianベースのディストリビューション）
    - pengwin-setupでLAMPインストール済み
    - その各バージョンは以下の通り

```
$ php -v
PHP 7.3.10-1+b1 (cli) (built: Oct 13 2019 23:50:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.10, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.10-1+b1, Copyright (c) 1999-2018, by Zend Technologies
```
```
$ apache2 -v
Server version: Apache/2.4.41 (Debian)
Server built:   2019-08-14T04:42:29
```
```
$ mysql -V
mysql  Ver 15.1 Distrib 10.3.20-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
```


# phalconの[公式サイト](https://packagecloud.io/phalcon/stable/install)通りインストール

```
$ curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
```

# なぜか404になる
```
$ sudo apt update
Ign:1 https://packagecloud.io/phalcon/stable/debian bullseye InRelease
Hit:5 https://packagecloud.io/whitewaterfoundry/pengwin-base/debian buster InRelease
Hit:2 https://cdn-aws.deb.debian.org/debian testing InRelease
Hit:7 https://packagecloud.io/whitewaterfoundry/pengwin-setup/debian buster InRelease
Hit:3 https://cdn-aws.deb.debian.org/debian testing-updates InRelease
Hit:4 https://cdn-aws.deb.debian.org/debian-security testing-security InRelease
Err:9 https://packagecloud.io/phalcon/stable/debian bullseye Release
  404  Not Found [IP: 2600:1f1c:2e5:6901:8932:291c:94fc:4a4e 443]
Hit:8 https://packagecloud.io/whitewaterfoundry/wslu/debian buster InRelease
Hit:6 https://cdn-aws.deb.debian.org/debian unstable InRelease
Reading package lists... Done
E: The repository 'https://packagecloud.io/phalcon/stable/debian bullseye Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
```

# 公式サイトのパッケージリストに「buster」があったので変更

```
$ sudo vi /etc/apt/sources.list.d/phalcon_stable.list

deb https://packagecloud.io/phalcon/stable/debian/ buster main       # busterへ変更
deb-src https://packagecloud.io/phalcon/stable/debian/ buster main   # busterへ変更
```

# もう一度、updateすると404はでない
```
$ sudo apt update
Hit:2 https://cdn-aws.deb.debian.org/debian testing InRelease
Hit:3 https://cdn-aws.deb.debian.org/debian testing-updates InRelease
Hit:4 https://cdn-aws.deb.debian.org/debian-security testing-security InRelease
Hit:6 https://cdn-aws.deb.debian.org/debian unstable InRelease
Get:1 https://packagecloud.io/phalcon/stable/debian buster InRelease [23.3 kB]
Hit:5 https://packagecloud.io/whitewaterfoundry/pengwin-base/debian buster InRelease
Hit:7 https://packagecloud.io/whitewaterfoundry/pengwin-setup/debian buster InRelease
Hit:8 https://packagecloud.io/whitewaterfoundry/wslu/debian buster InRelease
Get:9 https://packagecloud.io/phalcon/stable/debian buster/main Sources [1,118 B]
Get:10 https://packagecloud.io/phalcon/stable/debian buster/main amd64 Packages [1,515 B]
Fetched 25.9 kB in 8s (3,128 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
12 packages can be upgraded. Run 'apt list --upgradable' to see them.
```

# 出てきた！
```
$ sudo apt search phalcon
Sorting... Done
Full Text Search... Done
php7.3-phalcon/buster 3.4.5-1+php7.3 amd64
  High performance PHP framework

php7.3-phalcon-dbgsym/buster 3.4.5-1+php7.3 amd64
  Debug symbols for php7.3-phalcon
```

# PHPのバージョンに合わせてインストール
- phalcon.iniも作ってくれるので便利

```
$ sudo apt install php7.3-phalcon
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  php7.3-sqlite3 php7.3-pgsql php7.3-memcached
The following NEW packages will be installed:
  php7.3-phalcon
0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
Need to get 1,201 kB of archives.
After this operation, 4,925 kB of additional disk space will be used.
Get:1 https://packagecloud.io/phalcon/stable/debian buster/main amd64 php7.3-phalcon amd64 3.4.5-1+php7.3 [1,201 kB]
Fetched 1,201 kB in 1s (1,059 kB/s)
Selecting previously unselected package php7.3-phalcon.
(Reading database ... 22455 files and directories currently installed.)
Preparing to unpack .../php7.3-phalcon_3.4.5-1+php7.3_amd64.deb ...
Unpacking php7.3-phalcon (3.4.5-1+php7.3) ...
Setting up php7.3-phalcon (3.4.5-1+php7.3) ...

Creating config file /etc/php/7.3/mods-available/phalcon.ini with new version
```