原链接:http://blog.pcwuyu.com/2013/349.html

原分类: 网站建设, Linux


因为我的vps上已经部署了LNMP的环境,所以,我只需要将Tiny Tiny RSS的网站源码上传到网站根目录,配置下数据库和域名就可以使用了。以下是我的步骤。

  • 第一步:先到DNS商那里添加个二级域名,我这里用的A记录,指向我的vps。我用的是DNSPod的服务,所以,我先去dnspod那里添加我为rss网站设定的二级域名——rss.pcwuyu.com。
  • 第二步:在vps的lnmp下新建一个nginx的虚拟机,添加一个名为rss/的目录作为rss网站的根目录,这个根据自己的情况设定。然后将这个网站根目录与刚才添加的二级域名(即rss.pcwuyu.com)绑定好。
  • 第三步:新建一个数据库,tiny tiny rss支持两种数据库:mysql和postgresql。我用的是mysql,我这里新建一个叫做rss的数据库。创建的方法大家自己选,不熟悉的可以用phpmyadmin,熟悉的就直接用mysql命令吧,
    Mysql> CREATE DATABASE rss //在登陆mysql后输入一下命令创建数据库
    注意:其实,tiny rss 不一定要单独创建一个数据库,他也可以和别的网站共享数据库,但是为了方便管理,我们最好单独创建一个,毕竟rss订阅的数据量还是很大的。
  • 第四步:到Tiny Tiny rss官网下载网站程序源码
    #wget –c https://github.com/gothfox/Tiny-Tiny-RSS/archive/1.9.tar.gz
    将下载的网站源码包Tiny-Tiny-RSS-1.X.X.tar.gz复制到网站的根目录,我这里就是我创建的rss/目录。

    • a. 解压网站源码包,命令如下:

    #tar zxfv Tiny-Tiny-RSS-1.X.X.tar.gz

    • b. 进入解压后的Tiny-Tiny-RSS-1.X.X/目录,将里面的所有文件拷贝到网站根目录,命令如下:

    #cd Tiny-Tiny-RSS-1.X.X/ //进入刚刚解压的Tiny-Tiny-RSS-1.X.X/目录
    #cp –Rp * rss/ //这里根据自己的根目录的绝对路径来写,我这里假设我的根目录就是rss/

    • c.用浏览器打开,rss.pcwuyu.com,就会看到网站的安装界面,要求你填入数据库名称,数据库用户名,数据库密码等。正确输入后,确认,就会自动安装。

    注意:安装的时候,会有部分文件的权限要求,比如说cache目录下的一些文件夹要求777权限,我们根据提示来设定就可以了。

    • d.会提示你是否初始化数据库,我这里选择是,然后一切都装好了。清除浏览器换从,重新打开rss.pcwuyu.com,然后就会看到网站的登陆界面,默认账号是:admin,密码是password。
    • f.然后进偏好设置(preference)里面修改一些设置,更具自己的需求来设置,比如,我们肯定要进行的操作就是修改管理员的密码,偏好设置里面有个user,里面可以增加和删除网站的用户,分配用户权限等。还有最重要的那就是导入你的opml文件。
  • 导入自己的rss文件后,最重要的一步就是设置让网站程序自己更新rss信息,方法如下:
    因为程序开发这为了安全,所以禁止以root身份运行update.php这个更新rss信息的php脚本,所以,我们要用非root身份来设置crontab计划任务。
    #useradd ksharpdabu //新建一个叫ksharpdabu的用户
    #su ksharpdabu //切换账号到ksharpdabu
    $crontab -e //新建crontab计划任务

    • 将下面的代码粘贴到crontab 文件里面

    */30 * * * * /usr/bin/php /home/rss/update.php --feeds --quiet //这里设置的每隔30分钟更新一次rss信息

注意:
/usr/bin/php :这里是php绝对路径,为了安全才这么写的。如果你嫌麻烦,可以直接写成下面的形式:
*/30 * * * * php /home/rss/update.php --feeds --quiet
/home/rss/update.php : 指的是网站根目录下的update.php文件,这里一定要写这个文件的绝对路径。

至于rss的更新时间频率,自己可以修改,就是crontab的命令使用,大家自己谷歌,我这里就不详细讲解了。

--feeds --quiet :这个是update.php的参数,想知道update.php有哪些参数,可以使用下面的命令(不能用root身份运行):
$php /home/rss/update.php

提示可用参数如下:
Options:
--feeds - update feeds
--feedbrowser - update feedbrowser
--daemon - start single-process update daemon
--task N - create lockfile using this task id
--cleanup-tags - perform tags table maintenance
--quiet - don't output messages to stdout
--log FILE - log messages to FILE
--indexes - recreate missing schema indexes
--update-schema - update database schema
--convert-filters - convert type1 filters to type2
--force-update - force update of all feeds
--list-plugins - list all available plugins
--help - show this help
Plugin options:
--update_self - update tt-rss installation to latest version

  • 1.插件地址:http://tt-rss.org/redmine/projects/tt-rss/wiki/Plugins
  • 2.tiny tiny rss 主题下载安装教程地址:http://tt-rss.org/redmine/projects/tt-rss/wiki/Themes
  • 3.升级tiny tiny rss:(升级网站程序的时候,建议禁止第三方的主题)
    Upgrading Tiny Tiny RSS
    It is highly recommended to temporarily disable any third party themes and user CSS customizations before upgrading. Don't forget to empty your browser cache if you experience weird bugs right after upgrading.
    Note that you should upgrade to the latest version available, installing intermediate releases sequentially is not needed.
    In-place upgrading
    The recommended way is in-place upgrading using the updater plugin. There are several specific requirements for updater to work: the user you run updater as should have writable access both to tt-rss and tt-rss parent directories on your web server.
    For example, if tt-rss is installed at /var/www/tt-rss, both /var/www and /var/www/tt-rss need to be writable by the updater user.
    In case of web updater, the user is whatever your site runs PHP under (for example, www-data). In case of CLI updating, you can easily run the plugin as an arbitrary user.
    Please note that updater renames your old tt-rss directory and replaces it with a pristine new one. You will need to copy all locally modified files (e.g. plugins, CSS themes, modified templates, .htaccess files) back from the previous installation (it will be renamed as tt-rssXXXXX in a parent directory). The only exception to this are feed icons and config.php which are copied into the new directory automatically.
    Warning: Third party plugins you have been using might not be compatible with the newer tt-rss version. If you experience crashes right after upgrading, start with disabling all third party plugins to see if that resolves it.
    Warning: In 1.7.6 in-place updater requires CURL. It will fail with RC=2 when CURL functions are not present in PHP.
    Warning: Do not copy cache/ directories from your old tt-rss directory after upgrading.
    You will need to enable the updater plugin by adding it to PLUGINS directive in config.php if it's not enabled yet.
    Afterwards, go to Preferences -> Update Tiny Tiny RSS and follow instructions.
    You can also update from the command line if you have PHP CLI access by running update.php --update_self.
    Proceed to section 3.
    Manual upgrading
    If, for some reason, you are unable to use the in-place updater or updating from an older version which doesn't have it yet, proceed with manual upgrade.
    Download the new archive from tt-rss.org. Unpack it. Replace your old tt-rss directory with a newer one, optionally copying config.php, contents feed-icons, and your other modified files - plugins, CSS files, etc.
    Warning: Third party plugins you have been using might not be compatible with the newer tt-rss version. If you experience crashes right after upgrading, start with disabling all third party plugins to see if that resolves it.
    Proceed to the next section.
    Merging new config.php directives and updating the database
    After the files have been upgraded by newer versions, open tt-rss. It may complain about missing directives in config.php. If that happens, you will need to either merge new stuff from config.php-dist to your config.php or remove config.php and rerun the installer (take note to copy previous value of FEED_CRYPT_KEY if you have feeds with authentication enabled).
    Warning: DO NOT INITIALIZE DATABASE when upgrading. This will remove ALL your tt-rss data.
    Afterwards, you may be redirected to the database updater. Log in with admin credentials and follow instructions.
    Finishing that, you should be able to use tt-rss normally by logging in with your normal account.
    Post-upgrade tasks
  • You might need to clear your browser cache if you experience CSS or script-related issues, older scripts might have stuck in it.
  • Do not copy cache directories from your old tt-rss version, it is unnecessary and potentially creates problems if you don't preserve file modification times.
  • If you are using an accelerator like php-apc you might need to restart apache if older cached versions of PHP files got stuck in cache (this happens rarely, but is a possibility).