Ubuntu系统部署程序:修改IP、部署docker、nginx、Redis、onlyoffice、java
-
记录一次Ubuntu系统的程序部署
-
修改IP
-
#修改IP vim /etc/network/interfaces auto ens33 iface ens33 inet static address 192.?.?.? netmask 255.255.255.0 gateway 192.?.?.? #修改DNS vim /etc/systemd/resolved.conf 或 vi /etc/resolv.conf nameserver 192.?.?.? #重启网络 service networking restart
-
-
安装docker
-
#先复制docker运行程序文件 cp ./docker/* /usr/bin #编辑docker.service vi /usr/lib/systemd/system/docker.service [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service Wants=network-online.target [Service] Type=notify ExecStart=/usr/bin/dockerd ExecReload=/bin/kill -s HUP $MAINPID LimitNOFILE=infinity LimitNPROC=infinity TimeoutStartSec=0 Delegate=yes KillMode=process Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target #配置docker-compose cp ./docker-compose /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose #重启相关服务 systemctl daemon-reload systemctl start docker systemctl enable docker
-
-
安装java,此处为安装包部署,容器就不用说了,没啥意思
-
vim /etc/profile export JAVA_HOME=/usr/local/java/java8(java程序所在的目录) export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH source /etc/profile
-
-
安装Redis
-
docker run -d --name redis -p 6379:6379 --restart unless-stopped -v /usr/local/redis/data:/data -v /usr/local/redis/conf/redis.conf:/etc/redis/redis.conf redis redis-server /etc/redis/redis.conf --appendonly yes #修改配置文件 vim /usr/local/redis/conf/redis.conf appendonly yes protected-mode no bind 0.0.0.0
-
-
安装nginx
-
#创建nginx容器,并将nginx目录映射到宿主机 mkdir -p /usr/local/nginx/conf mkdir -p /usr/local/nginx/log # 将容器nginx.conf文件复制到宿主机 docker run --name nginxconfig -p 9999:80 -d nginx docker cp nginxconfig:/etc/nginx/nginx.conf /usr/local/nginx/conf/nginx.conf # 将容器conf.d文件夹下内容复制到宿主机 docker cp nginxconfig:/etc/nginx/conf.d /usr/local/nginx/conf/conf.d # 将容器中的html文件夹复制到宿主机 docker cp nginxconfig:/usr/share/nginx/html /usr/local/nginx docker run -p 88:80 --restart unless-stopped --name nginx -v /usr/local/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /usr/local/nginx/conf/conf.d:/etc/nginx/conf.d -v /usr/local/nginx/log:/var/log/nginx -v /usr/local/nginx/html:/usr/share/nginx/html -d nginx
-
-
部署onlyoffice,data目录要给权限,不然可能会启动有问题,从日志里面可以查看报错
-
docker run -i -t -d -p 80:80 --restart=always --privileged=true -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql -e JWT_SECRET=aj-report onlyoffice/documentserver:latest
-
-