centos下安装etherpad

来源:互联网 发布:南风知我意2七微 编辑:程序博客网 时间:2024/06/05 07:52

..
声明:
本博客欢迎转发,但请保留原作者信息!
博客地址:http://blog.csdn.net/liujiong63
新浪微博:@Jeremy____Liu
内容系本人学习、研究和总结,如有雷同,实属荣幸!


环境:CentOS Linux release 7.2.1511 (Core)

安装工具包

yum install curl vim gcc-c++ make git

安装数据库

yum install mariadb-server

启动数据库服务

systemctl start mariadb.servicesystemctl enable mariadb.service

数据库初始化

mysql_secure_installation

注意:为数据库root用户设置合适的密码

初始化etherpad数据库及配置

mysql -uroot -p<your-password>MariaDB [(none)]> CREATE DATABASE etherpad;MariaDB [(none)]> GRANT ALL PRIVILEGES ON etherpad.* TO 'etherpad'@'localhost' IDENTIFIED BY 'etherpad';MariaDB [(none)]> FLUSH PRIVILEGES;MariaDB [(none)]> \q

创建出数据库etherpad,用户名etherpad,密码etherpad

安装Node.js

# curl -sL https://rpm.nodesource.com/setup | sudo bash -# yum install nodejs查看nodejs版本:# node --version

创建系统用户

etherpad可以以root用户运行,但建议创建一个普通用户。

# adduser --home /opt/etherpad --shell /bin/bash etherpad# install -d -m 755 -o etherpad -g etherpad /opt/etherpadsu - etherpad

安装并配置etherpad

git clone https://github.com/ether/etherpad-litecp ~/etherpad-lite/settings.json.template ~/etherpad-lite/settings.json

编辑settings.json文件,vim ~/etherpad-lite/settings.json,配置以下内容

  "dbType" : "mysql",  "dbSettings" : {               "user" : "etherpad",               "host" : "localhost",               "password": "etherpad",               "database": "etherpad"             },  "users": {    "admin": {      "password": "admin",      "is_admin": true    },  },

如果使用nginx作为反向代理,需要对该配置文件额外设置:

"ip": "127.0.0.1""trustProxy" : true

安装依赖

~/etherpad-lite/bin/installDeps.sh

启动etherpad

~/etherpad-lite/bin/run.sh

如果以root用户运行该脚本,需添加一个参数:–root

将etherpad作为系统服务进行启动

如果想将etherpad以服务方式运行,需手动编写对应的服务启动文件。
新建etherpad服务启动文件etherpad.service,内容如下

[Unit]Description=etherpad[Service]ExecStart=/opt/etherpad/etherpad-lite/bin/run.sh --rootExecReload=/bin/kill -HUP $MAINPID# supress to log debug and error output also to /var/log/messagesStandardOutput=nullStandardError=null

将该文件拷贝到/usr/lib/systemd/system目录下,并执行

systemctl daemon-reloadsystemctl start etherpad.service

配置nginx反向代理

vim /etc/nginx/conf.d/default.conf 添加如下配置:

    # etherpad    location ^~ /etherpad/ {    proxy_pass http://127.0.0.1:9001/;    proxy_set_header X-Real-IP  $remote_addr;    proxy_set_header X-Forwarded-For $remote_addr;    proxy_set_header Host $host;}

配置网络访问

防火墙中开放9001端口
如果发现浏览器中无法访问etherpad,可能需要关掉selinux

访问etherpad

浏览器访问http://<your-ip>:9001或设置的nginx反向代理地址(http://<your-ip>/etherpad)即可访问etherpad

原创粉丝点击