配置简单的lnmp安装owncloud

FCLAMP 2020-05-20

安装nginx

yum -y install wget
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum -y install nginx

安装mysqld8.0

官方下载rpm包:https://dev.mysql.com/downloads/repo/yum/

rpm -ivh mysql80-community-release-el7-3.noarch.rpm
yum repolist enabled | grep "mysql.-community."
yum install mysql-community-server
grep ‘temporary password‘ /var/log/mysqld.log2020-05-19T06:35:24.068115Z 6 [Note] [MY-010454] [Server] A temporary password is generated for : %*nDqhxZx2>:

使用上面密码进入修改密码

mysql -uroot -p
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;

设置远程登录

use mysql;
update user set host = ‘%‘ where user = ‘root‘;
可以通过如下命令降低密码强度
SET GLOBAL validate_password.policy=LOW; 
SET GLOBAL validate_password.length=4;
mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password,
解决问题方法有两种,一种是升级navicat驱动,一种是把mysql用户登录密码加密规则还原成mysql_native_password.
ALTER USER ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ PASSWORD EXPIRE NEVER;
ALTER USER ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘123456‘;flush privileges;
完成以上操作,则可以远程连接上。
set sql_mode=‘NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES‘;
或者/etc/my.cnf文件最后加上
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
安装php7.3
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum clean all
yum makecache
yum install yum-utils && yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xml  php73-php-imagick php73-php-common php73-php-curl php73-php-gd php73-php-imap php73-php-intl php73-php-json php73-php-mbstring php73-php-mysql  php73-php-ssh2 php73-php-xml php73-php-zip php73-php-apcu php73-php-redis redis-serveryum -y install  bzip2 rsync curl jq  php73-php-smbclient coreutils php73-php-ldap  samba-client  
systemctl enable php73-php-fpm
systemctl start php73-php-fpm
设置 PHP
查找安装包:
[ src]# rpm -qa | grep ‘php‘
php73-php-json-7.3.18-1.el7.remi.x86_64
php73-php-mbstring-7.3.18-1.el7.remi.x86_64
php73-php-snmp-7.3.18-1.el7.remi.x86_64
php73-php-pecl-mcrypt-1.0.3-1.el7.remi.x86_64
php73-php-gd-7.3.18-1.el7.remi.x86_64
php73-php-common-7.3.18-1.el7.remi.x86_64
php73-php-mysqlnd-7.3.18-1.el7.remi.x86_64
php73-php-pecl-crypto-0.3.1-5.el7.remi.x86_64
php73-php-cli-7.3.18-1.el7.remi.x86_64
php73-php-pdo-7.3.18-1.el7.remi.x86_64
php73-php-recode-7.3.18-1.el7.remi.x86_64
php73-php-pecl-geoip-1.1.1-6.el7.remi.x86_64
php73-php-fpm-7.3.18-1.el7.remi.x86_64
php73-php-xml-7.3.18-1.el7.remi.x86_64
php73-runtime-2.0-1.el7.remi.x86_64
php73-php-opcache-7.3.18-1.el7.remi.x86_64
php73-php-soap-7.3.18-1.el7.remi.x86_64
php73-php-bcmath-7.3.18-1.el7.remi.x86_64
[ src]# rpm -ql php73-php-fpm-7.3.18-1.el7.remi.x86_64
/etc/logrotate.d/php73-php-fpm
/etc/opt/remi/php73/php-fpm.conf
/etc/opt/remi/php73/php-fpm.d
/etc/opt/remi/php73/php-fpm.d/www.conf
/etc/opt/remi/php73/sysconfig/php-fpm
/etc/systemd/system/php73-php-fpm.service.d
/opt/remi/php73/root/usr/sbin/php-fpm
/opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.18
/opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.18/php-fpm.conf.default
/opt/remi/php73/root/usr/share/doc/php73-php-fpm-7.3.18/www.conf.default
/opt/remi/php73/root/usr/share/fpm
/opt/remi/php73/root/usr/share/fpm/status.html
/opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.18
/opt/remi/php73/root/usr/share/licenses/php73-php-fpm-7.3.18/fpm_LICENSE
/opt/remi/php73/root/usr/share/man/man8/php-fpm.8.gz
/usr/lib/systemd/system/php73-php-fpm.service
/var/opt/remi/php73/lib/php/opcache
/var/opt/remi/php73/lib/php/session
/var/opt/remi/php73/lib/php/wsdlcache
/var/opt/remi/php73/log/php-fpm
/var/opt/remi/php73/run/php-fpm
编辑/etc/opt/remi/php73/php.ini替换换 ;cgi.fix_pathinfo=1 为 cgi.fix_pathinfo=0 快捷命令检查php版本
[ src]# find /etc/opt/remi/php73 -name php.ini
/etc/opt/remi/php73/php.ini
[ src]# sed -i ‘s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/‘ /etc/opt/remi/php73/php.ini
[ src]# systemctl restart php73-php-fpm
[ src]# php73 -v
PHP 7.3.18 (cli) (built: May 12 2020 08:04:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.18, Copyright (c) 1999-2018, by Zend Technologies
验证:LNMP环境
编辑nginx配置文件
[ src]# cd /etc/nginx/conf.d/[ conf.d]# vim owncloud.conf
upstream php-handler { 
  server 127.0.0.1:9000; 
  } 
server { 
  listen 80; 
  server_name www.owncloud.com; 

  # Path to the root of your installation 
  root /var/www/html/owncloud/;

  # set max upload size 
  client_max_body_size 10G;
  fastcgi_buffers 64 4K; 

  # Disable gzip to avoid the removal of the ETag header 
  gzip off;
 
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){ 
    deny all; 
    } 

location ~ \.php(?:$|/) { 
  fastcgi_split_path_info ^(.+\.php)(/.+)$; 
  include fastcgi_params; 
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
  fastcgi_param PATH_INFO $fastcgi_path_info; 
  fastcgi_pass php-handler; 
  } 

  # Optional: set long EXPIRES header on static assets 
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { 
      expires 30d; 
      # Optional: Don‘t log access to assets 
        access_log off; 
  } 
  }
部署owncloud站点
下载地址:https://owncloud.org/install/#
wget https://download.owncloud.org/community/owncloud-10.4.1.tar.bz2
tar -xf owncloud-10.4.1.tar.bz2
mkdir /var/www/html -p
mv owncloud  /var/www/html/
chown -R nginx:nginx /var/www/html/
创建数据库
 mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS owncloud; GRANT ALL PRIVILEGES ON owncloud.* TO  IDENTIFIED BY ‘123456‘";
[ src]# /bin/cat <<EOM >$FILE
 #! /bin/bash
cd /var/www/html/owncloud/
sudo -u nginx /usr/bin/php73 /var/www/html/owncloud/occ "\"
EOMocc maintenance:install  --database "mysql" --database-name "owncloud" --database-user "owncloud" --database-pass "123456" --admin-user "admin" --admin-pass "admin"

passwd
#需要
ac5d1767129f308c7ef3294802e0747f
alter user ‘root‘@‘%‘ identified with mysql_native_password by ‘ac5d1767129f308c7ef3294802e0747f‘;
alter user ‘root‘@‘localhost‘ identified with mysql_native_password by ‘ac5d1767129f308c7ef3294802e0747f‘;
#安装certbot证书需要
sudo pip uninstall requests
sudo pip uninstall urllib3
sudo yum remove python-urllib3
sudo yum remove python-requests
(confirm that all those libraries have been removed)
sudo yum install python-urllib3
sudo yum install python-requests

UID: 5661486834282481
用户登录地址:https://signin-intl.aliyun.com/5661486834282481.onaliyun.com/login.htm
用户登录名称:5661486834282481.onaliyun.com
登录密码:GD7h#mnLLrExw9Ctg)KgMjD2%&1lPhGE
AccessKey ID:LTAI4Frupdae6yijuacasCmy
AccessKeySecret:nKnawxmmBCLUexGundxWTTBnzTHvRN
額度:US$3,000

新密码:@&!otA

key
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA0u1PPOx1SmBj5NDqPBAk7C9PsM48tUOQ4PvGXyIkQTLBz8s1
XkGK9jX6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