怎样在树莓派上安装 TT-RSS
RSS

> 
> 使用 Tiny Tiny RSS 来保护你阅读新闻馈送时的隐私。
> 
> 
> 


![](/data/attachment/album/202005/29/230337vmazkl65hh61l0qq.png)


[Tiny Tiny RSS](https://tt-rss.org/)（TT-RSS）是一个自由开源的基于 Web 的新闻<ruby> 馈送 <rt>  feed </rt></ruby>（RSS/Atom）阅读器和聚合工具。它非常适合那些注重隐私，并且仍然依赖 RSS 来获取日常新闻的人。TT-RSS 是自行托管的软件，因此你可以 100% 的掌控你的服务器、数据以及你的全部隐私。它还支持大量的插件、扩展和主题。你喜欢黑暗模式的界面？没问题。想基于关键词过滤发来的消息？TT-RSS 也能让你得偿所愿。


![Tiny Tiny RSS screenshot](/data/attachment/album/202005/29/230445qan6mdwmfn3fmxa5.jpg "Tiny Tiny RSS screenshot")


现在你知道 TT-RSS 是什么了，那么为什么你可能会想用它。我会讲述要把它安装到树莓派或 Debian 10 服务器上你需要了解的所有的东西。


### 安装和配置 TT-RSS


要把 TT-RSS 安装到树莓派上，你还需要安装和配置最新版本的 PHP（本文撰写时 PHP 最新版本是 7.3）、后端数据库 PostgreSQL、Nginx web 服务器、Git，最后才是 TT-RSS。


#### 1、安装 PHP 7


安装 PHP 7 是整个过程中最复杂的部分。幸运的是，它并不像看起来那样困难。从安装下面的支持包开始：



```
$ sudo apt install -y ca-certificates apt-transport-https
```

现在，添加存储库 PGP 密钥：



```
$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
```

下一步，把 PHP 库添加到你的 apt 源：



```
$ echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list
```

然后更新你的存储库索引：



```
$ sudo apt update
```

最后，安装 PHP 7.3（或最新版本）和一些通用组件：



```
$ sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-opcache php7.3-curl php7.3-mbstring php7.3-pgsql php7.3-zip php7.3-xml php7.3-gd php7.3-intl
```

上面的命令默认你使用的后端数据库是 PostgreSQL，会安装 `php7.3-pgsql`。如果你想用 MySQL 或 MariaDB，你可以把命令参数改为 `php7.3-mysql`。


下一步，确认 PHP 已安装并在你的树莓派上运行着：



```
$ php -v
```

现在是时候安装和配置 Web 服务器了。


#### 2、安装 Nginx


可以用下面的命令安装 Nginx：



```
$ sudo apt install -y nginx
```

修改默认的 Nginx 虚拟主机配置，这样 Web 服务器才能识别 PHP 文件以及知道如何处理它们。



```
$ sudo nano /etc/nginx/sites-available/default
```

你可以安全地删除原文件中的所有内容，用下面的内容替换：



```
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;
        index index.html index.htm index.php;
        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
          include snippets/fastcgi-php.conf;
          fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        }

}
```

按 `Ctrl+O` 保存修改后的配置文件，然后按 `Ctrl+X` 退出 Nano。你可以用下面的命令测试你的新配置文件：



```
$ nginx -t
```

如果没有报错，重启 Nginx 服务：



```
$ systemctl restart nginx
```

#### 3、安装 PostgreSQL


接下来是安装数据库服务器。在树莓派上安装 PostgreSQL 超级简单：



```
$ sudo apt install -y postgresql postgresql-client postgis
```

输入下面的命令看一下数据库服务器安装是否成功：



```
$ psql --version
```

#### 4、创建 Tiny Tiny RSS 数据库


在做其他事之前，你需要创建一个数数据库，用来给 TT-RSS 软件保存数据。首先，登录 PostgreSQL 服务器：



```
sudo -u postgres psql
```

下一步，新建一个用户，设置密码：



```
CREATE USER username WITH PASSWORD 'your_password' VALID UNTIL 'infinity';
```

然后创建一个给 TT-RSS 用的数据库：



```
CREATE DATABASE tinyrss;
```

最后，给新建的用户赋最高权限：



```
GRANT ALL PRIVILEGES ON DATABASE tinyrss to user_name;
```

这是安装数据库的步骤。你可以输入 `\q` 来退出 `psql` 程序。


#### 5、安装 Git


安装 TT-RSS 需要用 Git，所以输入下面的命令安装 Git：



```
$ sudo apt install git -y
```

现在，进入到 Nginx 服务器的根目录：



```
$ cd /var/www/html
```

下载 TT-RSS 最新源码：



```
$ git clone https://git.tt-rss.org/fox/tt-rss.git tt-rss
```

注意，这一步会创建一个 `tt-rss` 文件夹。


#### 6、安装和配置Tiny Tiny RSS


现在是安装和配置你的新 TT-RSS 服务器的最后时刻了。首先，确认下你在浏览器中能打开 `http://your.site/tt-rss/install/index.php`。如果浏览器显示 `403 Forbidden`，那么就证明 `/var/www/html` 文件夹的权限没有设置正确。下面的命令通常能解决这个问题：



```
$ chmod 755 /var/www/html/ -v
```

如果一切正常，你会看到 TT-RSS 安装页面，它会让你输入一些数据的信息。你只需要输入前面你创建的数据库用户名和密码；数据库名；主机名填 `localhost`；端口填 `5432`。


点击“Test Configuration”。如果一切正常，你会看到一个标记着“Initialize Database”的红色按钮。点击它来开始安装。结束后，你会看到一个配置文件，你可以把它复制到 TT-RSS 的目录，另存为 `config.php`。


安装过程结束后，浏览器输入 `http://yoursite/tt-rss/` 打开 TT-RSS，使用默认的凭证登录（用户名：`admin`，密码：`password`）。登录后系统会提示你修改密码。我强烈建议你尽快修改密码。


### 配置 TT-RSS


如果一切正常，你现在就可以开始使用 TT-RSS 了。建议你新建一个非管理员用户，使用新用户名登录，并开始导入你的馈送、订阅，按照你的意愿来配置它。


最后，并且是超级重要的事，不要忘了阅读 TT-RSS 维基上的 [Updating Feeds](https://tt-rss.org/wiki/UpdatingFeeds) 部分。它讲述了如何创建一个简单的 systemd 服务来更新馈送。如果你跳过了这一步，你的 RSS 馈送就不会自动更新。


### 总结


呵！工作量不小，但是你做完了！你现在有自己的 RSS 聚合服务器了。想了解 TT-RSS 更多的知识？我推荐你去看官方的 [FAQ](https://tt-rss.org/wiki/FAQ)、[支持](https://community.tt-rss.org/c/tiny-tiny-rss/support)论坛，和详细的[安装](https://tt-rss.org/wiki/InstallationNotes)笔记。如果你有任何问题，尽情地在下面评论吧。




---


via: <https://opensource.com/article/20/2/ttrss-raspberry-pi>


作者：[Patrick H. Mullins](https://opensource.com/users/pmullins) 选题：[lujun9972](https://github.com/lujun9972) 译者：[lxbwolf](https://github.com/lxbwolf) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
[Tiny Tiny RSS](https://tt-rss.org/) (TT-RSS) is a free and open source web-based news feed (RSS/Atom) reader and aggregator. It's ideally suited to those who are privacy-focused and still rely on RSS for their daily news. Tiny Tiny RSS is self-hosted software, so you have 100% control of the server, your data, and your overall privacy. It also supports a wide range of plugins, add-ons, and themes, Want a dark mode interface? No problem. Want to filter your incoming news based on keywords? TT-RSS has you covered there, as well.

![Tiny Tiny RSS screenshot Tiny Tiny RSS screenshot](https://opensource.com/sites/default/files/uploads/tt-rss.jpeg)

Now that you know what TT-RSS is and why you may want to use it, I'll explain everything you need to know about installing it on a Raspberry Pi or a Debian 10 server.

## Install and configure TT-RSS

To install TT-RSS on a Raspberry Pi, you must also install and configure the latest version of PHP (7.3 as of this writing), PostgreSQL for the database backend, the Nginx web server, Git, and finally, TT-RSS.

### 1. Install PHP 7

Installing PHP 7 is, by far, the most involved part of this process. Thankfully, it's not as difficult as it might appear. Start by installing the following support packages:

`$ sudo apt install -y ca-certificates apt-transport-https`


Now, add the repository PGP key:

`$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -`


Next, add the PHP repository to your apt sources:

`$ echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list`


Then update your repository index:

`$ sudo apt update`


Finally, install PHP 7.3 (or the latest version) and some common components:

`$ sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-opcache php7.3-curl php7.3-mbstring php7.3-pgsql php7.3-zip php7.3-xml php7.3-gd php7.3-intl`


The command above assumes you're using PostgreSQL as your database backend and installs **php7.3-pgsql**. If you'd rather use MySQL or MariaDB, you can easily change this to **php7.3-mysql**.

Next, verify that PHP is installed and running on your Raspberry Pi:

`$ php -v`


Now it's time to install and configure the webserver.

### 2. Install Nginx

Nginx can be installed via apt with:

`$ sudo apt install -y nginx`


Modify the default Nginx virtual host configuration so that the webserver will recognize PHP files and know what to do with them:

`$ sudo nano /etc/nginx/sites-available/default`


You can safely delete everything in the original file and replace it with:

```
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.php;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
}
```


Use **Ctrl+O** to save your new configuration file and then **Ctrl+X** to exit Nano. You can test your new configuration with:

`$ nginx -t`


If there are no errors, restart the Nginx service:

`$ systemctl restart nginx`


### 3. Install PostgreSQL

Next up is installing the database server. Installing PostgreSQL on the Raspberry Pi is super easy:

`$ sudo apt install -y postgresql postgresql-client postgis`


Check to see if the database server was successfully installed by entering:

`$ psql --version`


### 4. Create the Tiny Tiny RSS database

Before you can do anything else, you need to create a database that the TT-RSS software will use to store data. First, log into the PostgreSQL server:

`sudo -u postgres psql`


Next, create a new user and assign a password:

`CREATE USER username WITH PASSWORD 'your_password' VALID UNTIL 'infinity';`


Then create the database that will be used by TT-RSS:

`CREATE DATABASE tinyrss;`


Finally, grant full permissions to the new user:

`GRANT ALL PRIVILEGES ON DATABASE tinyrss to user_name;`


That's it for the database. You can exit the **psql** app by typing **\q**.

### 5. Install Git

Installing TT-RSS requires Git, so install Git with:

`$ sudo apt install git -y`


Now, change directory to wherever Nginx serves web pages:

`$ cd /var/www/html`


Then download the latest source for TT-RSS:

`$ git clone https://git.tt-rss.org/fox/tt-rss.git tt-rss`


Note that this process creates a new **tt-rss** folder.

### 6. Install and configure Tiny Tiny RSS

It's finally time to install and configure your new TT-RSS server. First, verify that you can open ** http://your.site/tt-rss/install/index.php** in a web browser. If you get a

**403 Forbidden**error, your permissions are not set properly on the

**/var/www/html**folder. The following will usually fix this issue:

`$ chmod 755 /var/www/html/ -v`


If everything goes as planned, you'll see the TT-RSS Installer page, and it will ask you for some database information. Just tell it the database username and password that you created earlier; the database name; **localhost** for the hostname; and **5432 **for the port.

Click **Test Configuration** to continue. If all went well, you should see a red button labeled **Initialize Database.** Click on it to begin the installation. Once finished, you'll have a configuration file that you can copy and save as **config.php** in the TT-RSS directory.

After finishing with the installer, open your TT-RSS installation at ** http://yoursite/tt-rss/** and log in with the default credentials (username:

**admin**, password:

**password**). The system will recommend that you change the admin password as soon as you log in. I highly recommend that you follow that advice and change it as soon as possible.

## Set up TT-RSS


If all went well, you can start using TT-RSS right away. It's recommended that you create a new non-admin user, log in as the new user, and start importing your feeds, subscribing, and configuring it as you see fit.

Finally, and this is super important, don't forget to read the [Updating Feeds](https://tt-rss.org/wiki/UpdatingFeeds) section on TT-RSS's wiki. It describes how to create a simple systemd service that will update your feeds. If you skip this step, your RSS feeds will not update automatically.

## Conclusion

Whew! That was a lot of work, but you did it! You now have your very own RSS aggregation server. Want to learn more about TT-RSS? I recommend checking out the official [FAQ](https://tt-rss.org/wiki/FAQ), the [support](https://community.tt-rss.org/c/tiny-tiny-rss/support) forum, and the detailed [installation](https://tt-rss.org/wiki/InstallationNotes) notes. Feel free to comment below if you have any questions or issues.

## Comments are closed.