在Debian 9上,如何安装InvoicePlane
杨和超
・7 分钟阅读
使用不同的系统?
invoicePlane是免费的开放源码发票应用程序,它的源代码在github ,本指南将向你展示,如何在新的Debian9实例上安装InvoicePlane 。
要求
- Nginx
- MySQL版本5.5或更高版本,或MariaDB的等效版本,本文将使用MariaDB
- PHP版本7.0或更高版本
- 必须安装并激活以下PHP扩展:
php-gd
php-hash
php-json
php-mbstring
php-mcrypt
php-mysqli
php-openssl
php-recode
php-xmlrpc
php-zlib
开始之前
查看Debian版本。
lsb_release -ds
# Debian GNU/Linux 9.4 (stretch)
确保你的系统是最新的。
apt update && apt upgrade -y
安装sudo
,build-essential
和unzip
软件包。
apt install -y sudo build-essential unzip
使用sudo
访问创建一个新的非root用户帐户,并且切换到它。
adduser johndoe --gecos"John Doe"
usermod -aG sudo johndoe
su - johndoe
注:将johndoe
替换为你的用户名。
设置时区。
sudo dpkg-reconfigure tzdata
安装PHP和所需的PHP扩展
安装PHP和必要的PHP扩展。
sudo apt install -y php7.0 php7.0-cli php7.0-fpm php7.0-gd php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-xmlrpc php7.0-common php7.0-recode
检查版本。
php -v
安装MariaDB
安装MariaDB 。
sudo apt install -y mariadb-server
检查版本。
mysql --version
运行mysql_secure installation
脚本以提高MariaDB安全性。
sudo mysql_secure_installation
将MariaDB shell作为root用户连接到。
sudo mysql -u root -p
# Enter password:
为InvoicePlane创建一个空的MariaDB数据库和用户,并记住凭据。
CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
退出MariaDB 。
exit
安装Nginx
安装Nginx 。
sudo apt install -y nginx
检查版本。
sudo nginx -v
为InvoicePlane配置Nginx ,运行 sudo vim /etc/nginx/sites-available/invoiceplane.conf
并使用以下配置填充文件。
server {
listen 80;
listen [::]:80;
server_name example.com;
root /var/www/invoiceplane;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
fastcgi_index index.php;
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
通过将文件链接到sites-enabled
目录来激活新的invoiceplane.conf
配置。
sudo ln -s /etc/nginx/sites-available/invoiceplane.conf /etc/nginx/sites-enabled/
测试配置。
sudo nginx -t
重新加载Nginx 。
sudo systemctl reload nginx.service
安装InvoicePlane
下载发票平面的最新稳定版本,并且提取存档文件。
cd /var/www/
sudo curl -O -J -L https://invoiceplane.com/download/v1.5.9
sudo unzip v1.5.9.zip
sudo rm v1.5.9.zip
sudo mv ip invoiceplane
导航到/var/www/invoiceplane
文件夹。
cd /var/www/invoiceplane
创建ipconfig.php.example
文件的副本,并且重命名复制ipconfig.php
。
sudo cp ipconfig.php.example ipconfig.php
打开ipconfig.php
文件并将你的URL添加到它。
sudo vim ipconfig.php
# Something like this
IP_URL=http://example.com
注意:不要忘记用你自己的URL替换http://example.com
URL 。
将/var/www/invoiceplane
目录的所有权更改为www-data
。
sudo chown -R www-data:www-data /var/www/invoiceplane
从你的浏览器运行InvoicePlane安装程序,并且按照以下说明操作。
http://your-domain.com/index.php/setup
安装完成后,你可以使用安装过程中填写的电子邮件地址和密码登录到InvoicePlane 。
如果要保护安装,你可以禁用安装程序,为此,请在ipconfig.php
文件中用DISABLE_SETUP=true
替换行DISABLE_SETUP=false
。