实现功能:私有云盘+Office文档在线浏览
环境:纯净崭新的 Ubuntu 16.04
0x00 前期工作
个人习惯vim,先安装一个vim:
sudo apt install vim
更换源为国内的源:
sudo vim /etc/apt/sources.list
文件中的内容没删,直接注释掉了,下面贴了几个阿里云的:
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
更新apt索引:
sudo apt-get update
安装docker依赖:
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
添加docker密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg| sudo apt-key add -
设置stable存储库:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
再次更新apt包索引:
sudo apt-get update
安装最新版本的Docker CE:
sudo apt-get install -y docker-ce
0x01 安装OnlyOffice
添加秘钥:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
增加OnlyOffice下载源:
sudo vim /etc/apt/sources.list deb http://download.onlyoffice.com/repo/debian squeeze main
再次更新apt包索引:
sudo apt-get update
docker安装onlyoffice:
sudo docker pull onlyoffice/documentserver
启动onlyoffice:
sudo docker run -i -t -d -p 9000:80 onlyoffice/documentserver
0x02 安装环境
安装mysql,中途需要输入一次root账户的密码:
sudo apt-get install mysql-server mysql-client
安装Apache:
sudo apt-get install apache2
其他依赖:
sudo apt-get install php php-xml php-zip php-mysql php-gd php-curl libapache2-mod-php
下载dzzoffice的安装包:
https://github.com/zyx0814/dzzoffice/releases/
解压,切换到dzzoffice的目录,把东西一股脑复制到/var/www/html下:
sudo cp -r * /var/www/html/
访问,http://127.0.0.1,进行安装:
0x03 排除错误
^^当然了,本踩坑小能手每次搭环境都绝对不可能那么丝滑。
我的解决方法是php版本先7→5干掉前两个报错,后面缺的那两个再安就好了。
添加 PHP PPA:
sudo add-apt-repository ppa:ondrej/php
更新缓存:
sudo apt-get update
安装PHP 5.6
sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml libapache2-mod-php5.6
禁用 Apache 中的 PHP7:
sudo a2dismod php7.0
启用 PHP5.6:
sudo a2enmod php5.6
重启 Apache:
sudo systemctl restart apache2.service
切换 CLI:
sudo update-alternatives --set php /usr/bin/php7.0
安装php-curl:
sudo apt-get install php5.6-curl
安装:
sudo apt-get install zip unzip php5.6-zip
重启Apache:
sudo /etc/init.d/apache2 restart
解决:
接下来解决不可写的问题:
先安装chmod命令:
apt-get install coreutils
然后赋予每个文件夹777权限,完美解决。
sudo chmod 777 -R /var/www/html/
0x04 安装插件
安装完毕后进入DzzOffice,在应用中心下载onlyoffice,配置如下:
点击启用,效果如下: