安装Chevereto

安装准备

官网
按照要求,上传index.php到服务器,得到下面的信息:

Your websever lacks some requirements that must be fixed to install Chevereto.

Please check:

Enable curl, mbstring and PDO_MYSQL PHP extensions
Enable ZipArchive PHP class
No PHP 1 permission in /var/www/chevereto/
No PHP 1 permission in /var/www/chevereto/index.php
Enable PHP cURL

需要安装:
sudo apt install php-curl php-mbstring php-mysql php-zip

出现以下错误:
The requested URL /install was not found on this server.

根据作者解答, 需要:

Apache: Check if mod_rewrite is loaded and configured properly (allowOverride).
Nginx: Make sure to add the rules that you will find in the download package.

解决方案:

在这个讨论里,提到了.htaccess 文件。
经过搜索,apache官网推荐在<Directory> 中指定htaccess的内容,因此,修改/etc/apache2/apache2.conf的内容为:

  0  <Directory /media/sata1/www/>
  1     Options Indexes FollowSymLinks MultiViews
  2     AllowOverride All
  3     Require all granted
  4     #Order allow,deny
  5     #Allow from all
  6 # Disable server signature
  7     ServerSignature Off
  8 
  9 
 10 
 11 # Disable directory listing (-indexes), Multiviews (-MultiViews) and enable Follow system links (+FollowSymLinks)
 12 Options -Indexes
 13 Options -MultiViews
 14 Options +FollowSymLinks
 15 
 16 <IfModule mod_rewrite.c>
 17 
 18     RewriteEngine On
 19 
 20     # If you have problems with the rewrite rules remove the "#" from the following RewriteBase line
 21     # You will also have to change the path to reflect the path to your Chevereto installation
 22     # If you are using alias is most likely that you will need this.
 23     #RewriteBase /
 24 
 25     # 404 images
 26     # If you want to have your own fancy "image not found" image remove the "#" from RewriteCond and RewriteRule lines
 27     # Make sure to apply the correct paths to reflect your current installation
 28     RewriteCond %{REQUEST_FILENAME} !-f
 29     RewriteRule images/.+\.(gif|jpe?g|png|bmp) - [NC,L,R=404]
 30     #RewriteRule images/.+\.(gif|jpe?g|png|bmp) content/images/system/default/404.gif [NC,L]
 31 
 32     RewriteCond %{REQUEST_FILENAME} !-f
 33     RewriteCond %{REQUEST_FILENAME} !-d
 34     RewriteCond %{REQUEST_URI} !\.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|
 35     RewriteRule . index.php [L]
 36 
 37 </IfModule>
 38 </Directory>

以上内容来自于讨论中的htaccess文件。

配置数据库

使用的是Mariadb数据库,这是一个替代mysql的数据库。

设置root密码:

  1. 以root身份在终端登陆,必须
  2. 输入 mysqladmin -u root -p password root
    后面的 root 是要设置的密码
  3. 回车后出现 Enter password
    输入就密码,如果没有,直接回车

创建用户

  1. 以root登录数据库:mysql -u root -p
  2. SHOW DATABASES 可以查看数据库
  3. use mysql 使用这个数据库
  4. SHOW TABLES 查看其中的表,里面user这个存放的是用户名
  5. SELECT User,Host,Password FROM mysql.user; 可以查看当前的用户名和密码
  6. insert into mysql.user(Host,User,Password) values("localhost","admin",password("admin")); 创建新用户
  7. flush privileges; 刷新系统权限表

以上就完成了新用户的创建。

更改安全权限

使用mysql_secure_installation命令更改安全权限。
主要是回答以下问题:

Set root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

修改mariadb默认存储位置

参考这个
其中,复制这一步可以使用rsync:
sudo rsync -av /var/lib/mysql ./mysql-data/

在修改datadir,socket属性的时候,要注意,在ubuntu中,需要修改/etc/mysql/mariadb.cnf ,但是其中声明了几个cnf文件的顺序,并且指出重复的变量以后出现的为准,因此需要将后面出现的datadir及Socket属性注释掉。

创建数据库

参照这个
CREATE DATABASE cheveretodb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON cheveretodb.* TO 'chevereto'@'localhost' IDENTIFIED BY 'password';
以上设置用户名为chevereto,密码为password,在后续设置是会使用。

连接数据库

php需要连接数据库,因此需要修改php.ini中的pdo_mysql.default_socket的值为mariadb.cnf 中的sock文件的路径。
然后重启apach2即可。
否则会报错:
sqlstate[hy000] [2002] No such file or directory in

小结

至此就完成了chevereto的安装。后续使用可以摸索一下api文档。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值