Docker中手工安装onlyoffice

来自ling
跳转至: 导航搜索
docker pull registry.cn-hangzhou.aliyuncs.com/ling/ubuntu:latest

todo

  • msttcore-fonts-installer-2.6-1.noarch.rpm需要重新安装
  • yum install onlyoffice-documentserver 速度太慢,需要重新安装

迅雷离线下载 docker cp /backup/soft/onlyoffice-documentserver.x86_64.rpm onlyoffice_centos:/

yum install onlyoffice-documentserver.x86_64.rpm

使用centos 安装docserver

[1]

安装依赖

docker run -i -t --name onlyoffice_centos registry.cn-hangzhou.aliyuncs.com/ling/centos:latest /bin/bash
docker run -i -t -d  --privileged --name onlyoffice_centos centos:7.3.1611 /usr/sbin/init
yum -y install epel-release net-tools vim wget

貌似已经在最新images的镜像列表中,无需再执行下面步骤

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
yum update
docker start onlyoffice_centos 
docker exec -it onlyoffice_centos  bash
curl -sL https://rpm.nodesource.com/setup_6.x | bash -
yum install -y nodejs
yum install -y gcc-c++ make

使能运行service服务,但用systemctl代替

yum install initscripts
docker commit -m="centos base" -a="bo.wang" 0b2616b0e5a8 docker.ling2.cn/centos:latest

安装nginx

vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
yum install epel-release

安装msttcore-fonts-installer-2.6-1.noarch.rpm

yum install https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm

安装onlyoffice

rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x8320CA65CB2DE8E5"

vi /etc/yum.repos.d/onlyoffice.repo

[onlyoffice]
name=onlyoffice repo
baseurl=http://download.onlyoffice.com/repo/centos/main/noarch/
gpgcheck=1
enabled=1
yum install onlyoffice-documentserver
docker cp /alidata/backup/soft/onlyoffice-documentserver.x86_64.rpm onlyoffice_centos:/
yum install onlyoffice-documentserver.x86_64.rpm
sudo service supervisord start
sudo systemctl enable supervisord
sudo service nginx start
sudo systemctl enable nginx


systemctl start supervisord 
systemctl enable supervisord
systemctl start nginx 
systemctl enable nginx

documentserver-configure.sh

bash documentserver-configure.sh
  • 因为PostgreSQL端口问题 使用www.ling2.cn上提供的PostgreSQL,Redis,RabbitMQ服务

制作和使用镜像

docker commit -m="onlyoffice document server" -a="bo.wang" 0b2616b0e5a8 docker.ling2.cn/onlyoffice-docserver:latest

启动容器

docker run --net onlyoffice -i -t -d --privileged --name onlyoffice-document-server -p 59:80 docker.ling2.cn/onlyoffice-docserver /usr/sbin/init

需要手工启动

docker exec -it onlyoffice-document-server bash
systemctl start supervisord 
systemctl start nginx

Onlyoffice-docserver1.PNG Onlyoffice-docserver2.PNG

其他

  • Add a firewall exception
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
  • Disable SELinux

Open the /etc/selinux/config file using any text editor, replace the SELINUX=enforcing or SELINUX=permissive string with the SELINUX=disabled one and save the changes.

Reboot your server for the changes to take effect.

使用centos安装community server

http://helpcenter.onlyoffice.com/server/linux/community/index.aspx http://helpcenter.onlyoffice.com/server/linux/community/linux-installation.aspx

Community Server uses Mono (version 3.2 or later), NGINX and mysql-server as database. Dependencies found in the system repository will be installed automatically at Community Server installation using the yum install command.

启动docker

docker run -i -t -d --privileged --name onlyoffice-community docker.ling2.cn/centos /usr/sbin/init
docker exec -it  onlyoffice-community bash

安装

  • mono
rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
  • mysql
wget http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm 

添加选择yum源:

yum localinstall mysql57-community-release-el7-7.noarch.rpm 
yum repolist all | grep mysql 

把需要安装的启用,其他的禁用

vi /etc/yum.repos.d/mysql-community.repo

把5.7的设置为启用 http://www.cnblogs.com/weiok/p/5373270.html

  • onlyoffice
rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x8320CA65CB2DE8E5"
vi /etc/yum.repos.d/onlyoffice.repo
[onlyoffice]
name=onlyoffice repo
baseurl=http://download.onlyoffice.com/repo/centos/main/noarch/
gpgcheck=1
enabled=1
yum makecache
yum update
yum install onlyoffice-communityserver
bash communityserver-configure.sh
systemctl  restart monoserve
Restarting services... 
monoserve.service 
monoserveApiSystem.service 
nginx.service 
onlyofficeBackup.service 
onlyofficeFeed.service 
onlyofficeJabber.service 
onlyofficeIndex.service 
onlyofficeNotify.service 
onlyofficeMailAggregator.service 
onlyofficeMailWatchdog.service 
OK

制作镜像

docker commit -m="onlyoffice community server" -a="bo.wang" 0b2616b0e5a8 docker.ling2.cn/onlyoffice-community:latest
docker run --net onlyoffice -i -t -d --privileged -p 60:80 -p 5222:5222 -p 1443:443 --name onlyoffice-community-server docker.ling2.cn/onlyoffice-community /usr/sbin/init

问题解决

清理

yum clean all

Failed to get D-Bus connection: Operation not permitted

以下方式未能解决问题

sudo docker run -i -t --privileged --name centos_test centos:7.3.1611 /bin/bash

此能解决

sudo docker run -i -t --privileged --name centos_test centos:7.3.1611 /usr/sbin/init 
sudo docker exec -it centos_test bash

备份

docker run -i -t centos /bin/bash
docker exec -it [container_id] /bin/bash
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


sudo apt-get remove vim-common
sudo apt-get install vim
yum -y install epel-release net-tools vim

yum makecache
yum update
yum clean all

Requires: mysql-server >= 5.7.0

使用ubantu

docker run -i -t --name onlyoffice_ubuntu registry.cn-hangzhou.aliyuncs.com/ling/ubuntu:latest /bin/bash
apt-get update
apt-get upgrade
apt-get install curl libcurl3 libxml2 supervisor fonts-dejavu fonts-liberation ttf-mscorefonts-installer fonts-crosextra-carlito fonts-takao-gothic fonts-opensymbol
echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" |  tee -a /etc/apt/sources.list
curl -sL https://deb.nodesource.com/setup_6.x |  bash -

安装onlyoffice

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
sudo echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list
sudo apt-get update
apt-get install -y nodejs
sudo apt-get install onlyoffice-documentserver

初始化postgres

sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"

清理

rm -rf /var/lib/apt/lists/*
apt-get clean all