这里安装使用的是root权限,可根据自己情况添加sudo前缀

第一步 安装LAMP环境

这里使用https://lamp.sh的一键安装脚本

首先安装git

yum -y install git

获取最新脚本并授予权限

git clone https://github.com/teddysun/lamp.git
cd lamp
chmod 755 *.sh

安装

./lamp.sh

前几步直接回车确认,到安装软件这里选择一下

第一个是询问是否安装phpMyAdmin数据库管理工具

第二个是询问是否安装可道云

这里根据自己需求选择安装,不影响功能使用。建议安装phpMyAdmin

-------------------------- phpmyadmin setting ---------------------------

1. phpMyAdmin-4.9.0.1-all-languages
2. do_not_install

which phpmyadmin you'd select (default phpMyAdmin-4.9.0.1-all-languages): 

your selection: phpMyAdmin-4.9.0.1-all-languages

-------------------------- kodexplorer setting ---------------------------

1. kodexplorer-4.35
2. do_not_install

which kodexplorer you'd select (default kodfile-4.35): 

出现这一界面后回车开始安装

------------------------- Install Overview --------------------------

Apache: httpd-2.4.39
Apache Location: /usr/local/apache

Database: mysql-5.7.27
MySQL Location: /usr/local/mysql
MySQL Data Location: /usr/local/mysql/data
MySQL Root Password: lamp.sh

PHP: php-7.2.21
PHP Location: /usr/local/php

phpMyAdmin: phpMyAdmin-4.9.0.1-all-languages
phpMyAdmin Location: /data/www/default/phpmyadmin

KodExplorer: do_not_install

---------------------------------------------------------------------

Press any key to start...or Press Ctrl+C to cancel

根据服务器配置可能需要安装几十分钟到几个小时

第二步 安装OwnCloud

官网复制最新版OwnCloud的下载地址

下载软件包

wget https://download.owncloud.org/community/owncloud-10.2.1.tar.bz2 //后面的地址替换为你获取的地址

创建站点

lamp add
Please enter server names(example: lamp.sh www.lamp.sh): 此处输入网站域名(一个或多个)
Please enter website root directory(default:/data/www/网站域名): 此处输入网站根目录路径,默认回车即可
website root directory: 此处显示上一步输入的网站根目录路径
Please enter Administrator Email address: 此处输入管理员邮箱地址
Administrator Email address: 此处显示上一步输入的邮箱地址
Do you want to create a database and mysql user with same name? [y/n]: 此处输入 y 或 n,表示创建或不创建数据库(输入 y)
Virtual host [网站域名] has been created
Website root directory is: 网站根目录路径
Database [数据库名] and mysql user [数据库用户名] has been created
Reloading the apache config file...
Syntax OK
Reload succeed
Do you want to add a SSL certificate? [y/n]: 此处输入 y 或 n,表示添加或不添加证书(输入 y)
1. Use your own SSL Certificate and Key
2. Use Let's Encrypt CA to create SSL Certificate and Key
3. Use Buypass.com CA to create SSL Certificate and Key
Please enter 1 or 2 or 3: 此处输入 1,2 或 3。1 表示使用自己的证书;2 使用 Let's Encrypt 签发免费证书(推荐);3 使用 Buypass.com 签发免费证书。
You chosen Let's Encrypt CA, and it will be processed automatically
Do you want force redirection from HTTP to HTTPS? [y/n]:此处输入 y 或 n,询问是否强制 http 转 https
You chosen force redirection from HTTP to HTTPS, and it will be processed automatically

Starting create Let's Encrypt SSL Certificate...
此处开始安装 certbot 运行所需的依赖库等
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for 网站域名
Using the webroot path /data/www/网站域名 for all unmatched domains.
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/网站域名/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/网站域名/privkey.pem
   Your cert will expire on 证书过期日. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Let's encrypt crontab renew rule is not exist, create it!
Create Let's Encrypt SSL Certificate successfully
Reloading the apache config file...
Syntax OK
Reload succeed

All done

解压owncloud-X.X.X.tar.bz2到上一步创建好的目录下

tar -xvf owncloud-X.X.X.tar.bz2 -C /data/www/你的域名

切换到/data/www/你的域名目录下将owncloud中的全部内容提上一级

mv /data/www/你的域名/owncloud/* /data/www/cloud.tedran.com

如果出现PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible.

修改opcache.ini, 修改 opcache.enable_cli=0  然后加上 opcache.enable=0

vim /usr/local/php/php.d/opcache.ini

第三步 配置owncloud

配置数据库为Mysql

第四步 Enjoy it!

发表回复