{"id":1221,"date":"2014-11-10T18:09:40","date_gmt":"2014-11-10T10:09:40","guid":{"rendered":"https:\/\/cowmanchiang.me\/wp\/?p=1221"},"modified":"2023-10-31T15:44:47","modified_gmt":"2023-10-31T07:44:47","slug":"etherpad-lite-in-ubuntu-14-04-x64-server","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1221","title":{"rendered":"Etherpad-lite in Ubuntu 14.04 x64 server"},"content":{"rendered":"<p><a title=\"etherpad\" href=\"https:\/\/github.com\/ether\/etherpad-lite\">etherpad<\/a><\/p>\n<ol>\n<li>\u5b89\u88dd\u57fa\u672c\u5957\u4ef6\u9700\u6c42<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo apt-get install gzip git-core curl python libssl-dev pkg-config build-essential\n<\/pre>\n<ol>\n<li>\u66f4\u65b0\u5b89\u88ddnodejs\u7684\u4f86\u6e90<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo curl -sL https:\/\/deb.nodesource.com\/setup | sudo bash -\n<\/pre>\n<ol>\n<li>\u5b89\u88ddnodejs<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo apt-get install nodejs\n<\/pre>\n<ol>\n<li>\u65b0\u589eetherpad\u7684\u4f7f\u7528\u8005<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo useradd etherpad -m -s \/bin\/bash -r\nsudo passwd etherpad\n<\/pre>\n<ol>\n<li>\u5c07etherpad\u4f7f\u7528\u8005\u52a0\u5165sudoers\u4e2d<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo usermod -a -G sudo etherpad\n<\/pre>\n<ol>\n<li>\u5207\u63db\u5230etherpad\u4f7f\u7528\u8005<\/li>\n<\/ol>\n<pre lang=\"bash\">su - etherpad\n<\/pre>\n<ol>\n<li>\u4e0b\u8f09etherpad\u6a94\u6848<\/li>\n<\/ol>\n<pre lang=\"bash\">wget https:\/\/github.com\/ether\/etherpad-lite\/zipball\/master\n<\/pre>\n<ol>\n<li>\u5b89\u88ddunzip<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo apt-get install unzip\n<\/pre>\n<ol>\n<li>\u89e3\u58d3\u7e2eetherpad\u58d3\u7e2e\u6a94<\/li>\n<\/ol>\n<pre lang=\"bash\">unzip master\n<\/pre>\n<ol>\n<li>\u5c07\u76ee\u9304\u540d\u7a31\u8b8a\u597d\u770b\u4e00\u9ede<\/li>\n<\/ol>\n<pre lang=\"bash\">mv ether-etherpad-lite-3ebcaad etherpad-lite\n<\/pre>\n<ol>\n<li>\u5207\u63db\u5230etherpad-lite\u76ee\u9304<\/li>\n<\/ol>\n<pre lang=\"bash\">cd etherpad-lite\n<\/pre>\n<ol>\n<li>\u8907\u88fd\u8a2d\u5b9a\u6a94\u7bc4\u672c<\/li>\n<\/ol>\n<pre lang=\"bash\">cp settings.json.template setting.json\n<\/pre>\n<ol>\n<li>\u8a2d\u5b9aetherpad\u57fa\u672c\u74b0\u5883<\/li>\n<\/ol>\n<pre lang=\"bash\">vim setting.json\n# \u627e\u5230\u4ee5\u4e0b\u7684\u8a2d\u5b9a\u52a0\u4ee5\u66ff\u63db\n   \"requireSession\" : false,\n   \"sessionNoPassword\" : false,\n   \"requireAuthentication\": false,\n   \"requireAuthorization\": true,\n   \"users\": {\n      \"admin\": {\n         \"password\": \"password\",\n         \"is_admin\": true\n      },\n      \"user\": {\n         \"password\": \"password\",\n         \"is_admin\": false\n      }\n   },\n<\/pre>\n<ol>\n<li>\u8a66\u57f7\u884c\uff0c\u53ef\u770b http:\/\/ip:9001 \u662f\u5426\u6b63\u5e38<\/li>\n<\/ol>\n<pre lang=\"bash\">.\/bin\/run.sh\n<\/pre>\n<ol>\n<li>\u5b89\u88ddmysql\u3001nginx<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo apt-get install mysql-server nginx\n<\/pre>\n<ol>\n<li>\u5efa\u7acbetherpad\u8cc7\u6599\u5eab\u3001\u8a2d\u5b9a\u4f7f\u7528\u8005\u6b0a\u9650<\/li>\n<\/ol>\n<pre lang=\"bash\">mysql -uroot -p\n&gt; create database etherpad;\n&gt; grant all privileges on etherpad.* to 'etherpad'@'localhost' identified by 'password';\n&gt; exit\n<\/pre>\n<ol>\n<li>\u8a2d\u5b9aetherpad\u8cc7\u6599\u5b58\u653e\u4f7f\u7528mysql<\/li>\n<\/ol>\n<pre lang=\"bash\">vim setting.json\n   # \u8a3b\u89e3\u4f7f\u7528dirty\u7684\u90e8\u5206\n   \/\/\"dbType\" : \"dirty\",\n   \/\/\"dbSettings\" : {\n   \/\/                 \"filename\" : \"var\/dirty.db\"\n   \/\/               },\n   # \u52a0\u5165\u4f7f\u7528mysql\u7684\u90e8\u5206\n   \"dbType\" : \"mysql\",\n   \"dbSettings\" : {\n                    \"user\"    : \"etherpad\",\n                    \"host\"    : \"localhost\",\n                    \"password\": \"password\",\n                    \"database\": \"etherpad\"\n                  },\n<\/pre>\n<ol>\n<li>\u8a66\u57f7\u884c\uff0c\u4e26\u8acb\u9023\u81f3 http:\/\/ip:9001 \u589e\u52a0\u5e7e\u7b46\u8cc7\u6599<\/li>\n<\/ol>\n<pre lang=\"bash\">.\/bin\/run.sh\n<\/pre>\n<ol>\n<li>\u8abf\u6574\u8cc7\u6599\u8868\u5c6c\u6027<\/li>\n<\/ol>\n<pre lang=\"bash\">mysql -uroot -p\n&gt; use etherpad;\n&gt; ALTER TABLE `store` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;\n&gt; ALTER DATABASE `etherpad` CHARACTER SET utf8 COLLATE utf8_bin;\n<\/pre>\n<ol>\n<li>\u8a2d\u5b9anginx proxy<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo vim \/etc\/nginx\/sites-enabled\/default\n# \u5168\u90e8\u5167\u5bb9\u4e0d\u7528\u7559\uff0c\u4ee5\u4e0b\u9762\u66ff\u63db\nserver {\n    listen       80;\n    access_log   \/var\/log\/nginx\/etherpad.log;\n    error_log    \/var\/log\/nginx\/etherpad.log;\n    location \/ {\n        proxy_pass        http:\/\/localhost:9001\/;\n        proxy_set_header  Host $host;\n        proxy_buffering   off;\n    }\n}\n<\/pre>\n<ol>\n<li>\u8a2d\u5b9aetherpad\u4fe1\u4efbproxy<\/li>\n<\/ol>\n<pre lang=\"bash\">vim setting.json\n   # \u627e\u5230\u4ee5\u4e0b\u7684\u8a2d\u5b9a\u52a0\u4ee5\u66ff\u63db\n   \"trustProxy\": true,\n<\/pre>\n<ol>\n<li>\u5275\u5efaetherpad\u4f7f\u7528\u4e4blog\u76ee\u9304<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo mkdir \/var\/log\/etherpad-lite\n<\/pre>\n<ol>\n<li>\u8abf\u6574\u6b0a\u9650<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo chown -R etherpad:etherpad \/var\/log\/etherpad-lite\n<\/pre>\n<ol>\n<li>\u5efa\u7acbetherpad\u7cfb\u7d71\u670d\u52d9\u8a2d\u5b9a<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo vim \/etc\/init\/etherpad.conf\n# \u52a0\u5165\u4ee5\u4e0b\u5167\u5bb9\ndescription \"etherpad\"\n\nstart on started networking\nstop on runlevel [!2345]\n\nenv EPHOME=\/home\/etherpad\/etherpad-lite\nenv EPLOGS=\/var\/log\/etherpad-lite\nenv EPUSER=etherpad\n\nrespawn\n\npre-start script\n    cd $EPHOME\n    mkdir $EPLOGS                              ||true\n    chown $EPUSER:admin $EPLOGS                ||true\n    chmod 0755 $EPLOGS                         ||true\n    chown -R $EPUSER:admin $EPHOME\/var         ||true\n    $EPHOME\/bin\/installDeps.sh &gt;&gt; $EPLOGS\/error.log || { stop; exit 1; }\nend script\n\nscript\n  cd $EPHOME\/\n  exec su -s \/bin\/sh -c 'exec \"$0\" \"$@\"' $EPUSER -- node node_modules\/ep_etherpad-lite\/node\/server.js \n                        &gt;&gt; $EPLOGS\/access.log \n                        2&gt;&gt; $EPLOGS\/error.log\nend script\n<\/pre>\n<ol>\n<li>\u4ee5\u7cfb\u7d71\u670d\u52d9\u555f\u52d5etherpad<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo start etherpad\n<\/pre>\n<ol>\n<li>\u91cd\u65b0\u8b80\u53d6nginx\u8a2d\u5b9a<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo service nginx reload\n<\/pre>\n<ol>\n<li>\u4fee\u6539npm\u6b0a\u9650\uff0c\u907f\u514d\/admin\u4e2d\u7121\u6cd5\u5b89\u88ddplugin<\/li>\n<\/ol>\n<pre lang=\"bash\">cd ~\/etherpad-lite\nsudo npm install -g express\nchown -R etherpad ~\/.npm\n<\/pre>\n<ol>\n<li>\u5275\u5efa\u4f7f\u7528\u8005\u7ba1\u7406\u7528\u4e4b\u8cc7\u6599\u8868<\/li>\n<\/ol>\n<pre lang=\"bash\">mysql -uroot -p\n&gt; use etherpad;\n&gt; CREATE TABLE IF NOT EXISTS GroupPads ( GroupID int(11) NOT NULL, PadName varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (GroupID, PadName) );\n&gt; CREATE TABLE IF NOT EXISTS User ( userID int(11) NOT NULL AUTO_INCREMENT, name varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', pwd varchar(255) COLLATE utf8_bin DEFAULT NULL, considered tinyint(11) DEFAULT NULL, SSO tinyint(4) DEFAULT NULL, FullName varchar(255) COLLATE utf8_bin DEFAULT NULL, considerationString varchar(50) COLLATE utf8_bin DEFAULT NULL, salt varchar(255) COLLATE utf8_bin DEFAULT NULL, active int(1) DEFAULT NULL, PRIMARY KEY (userID,name) );\n&gt; CREATE TABLE IF NOT EXISTS NotRegisteredUsersGroups (  email varchar(255) NOT NULL,  groupID int(11) NOT NULL  );\n&gt; CREATE TABLE IF NOT EXISTS UserGroup ( userID int(11) NOT NULL DEFAULT 0, groupID int(11) NOT NULL DEFAULT 0, Role int(11) DEFAULT NULL, PRIMARY KEY (userID,groupID) );\n&gt; CREATE TABLE IF NOT EXISTS Groups (  groupID int(11) NOT NULL AUTO_INCREMENT,  name varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',  PRIMARY KEY (groupID, name )  );\n&gt; exit\n<\/pre>\n<ol>\n<li>\u5b89\u88dd\u4f7f\u7528\u8005\u7ba1\u7406\u5957\u4ef6<\/li>\n<\/ol>\n<pre lang=\"bash\">cd ~\/etherpad-lite\nnpm install ep_user_pad\n<\/pre>\n<ol>\n<li>\u5b89\u88dd\u4f7f\u7528\u8005\u7ba1\u7406\u524d\u7aef\u4ecb\u9762<\/li>\n<\/ol>\n<pre lang=\"bash\">cd ~\/etherpad-lite\nnpm install ep_user_pad_frontend\n<\/pre>\n<ol>\n<li>\u4fee\u6b63email function\uff0c\u9019\u908a\u6539\u7528gmail\u70ba\u4f8b<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo vim node_modules\/ep_user_pad\/email.json\n    # \u627e\u5230\u4ee5\u4e0b\u7684\u8a2d\u5b9a\u52a0\u4ee5\u66ff\u63db\n    \"smtp\": \"true\",\n    \"user\": \"cowman.chiang@gmail.com\",\n    \"password\": \"password\",\n    \"host\": \"smtp.gmail.com\",\n    \"port\": \"465\",\n    \"tls\": \"true\",\n    \"ssl\": \"true\",\n<\/pre>\n<ol>\n<li>\u4fee\u6b63email function\uff0c\u9019\u908a\u6539\u7528gmail\u70ba\u4f8b<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo vim node_modules\/ep_user_pad_frontend\/email.json\n    # \u627e\u5230\u4ee5\u4e0b\u7684\u8a2d\u5b9a\u52a0\u4ee5\u66ff\u63db\n    \"smtp\": \"true\",\n    \"user\": \"cowman.chiang@gmail.com\",\n    \"password\": \"password\",\n    \"host\": \"smtp.gmail.com\",\n    \"port\": \"465\",\n    \"tls\": \"true\",\n    \"ssl\": \"true\",\n<\/pre>\n<ol>\n<li>\u4fee\u6b63hooks.js\uff0c\u4e0d\u7136\u6703\u767c\u751f\u932f\u8aa4<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo vim node_modules\/ep_user_pad\/hooks.js\n# \u8a3b\u89e3\u4e0b\u9762\u9019\u4e00\u884c\n\/\/settings.encryptPassword = function (password, salt, cb) {\n# \u4ee5\u4e0b\u9762\u9019\u4e00\u884c\u53d6\u4ee3\nvar encryptPassword = function (password, salt, cb) {\n<\/pre>\n<ol>\n<li>\n<p>\u5b89\u88dd\u986f\u793a\u4f5c\u8005\u540d\u7a31\u7684\u529f\u80fd<br \/>\ncd ~\/etherpad-lite<br \/>\nnpm install ep_authornames<\/p>\n<\/li>\n<li>\n<p>\u5efa\u8b70\u5b89\u88dd\u5957\u4ef6<br \/>\n(1) adminpads : \u5728\/admin\u4e2d\u53ef\u4ee5\u7ba1\u7406\u6240\u6709\u7684\u7b46\u8a18<br \/>\n(2) authornames: \u53ef\u4ee5\u5728\u7b46\u8a18\u5167\u5bb9\u4e2d\u986f\u793a\u7de8\u8f2f\u7684\u4f5c\u8005\u540d\u7a31<br \/>\n(3) colors : \u589e\u52a0\u7b46\u8a18\u7684\u984f\u8272\u529f\u80fd<br \/>\n(4) draw : \u63d0\u4f9b\u756b\u5716\u7684\u529f\u80fd<br \/>\n(5) headings : \u63d0\u4f9b\u4f7f\u7528\u6a19\u984c\u5b57\u578b\u7684\u529f\u80fd<br \/>\n(6) historicalsearch : \u63d0\u4f9b\u5728\u7b46\u8a18\u7de8\u8f2f\u6b77\u53f2\u4e2d\u641c\u5c0b\u7684\u529f\u80fd<br \/>\n(7) padlist : \u4ee5\/list\u986f\u793a\u6240\u6709\u7684\u7b46\u8a18<br \/>\n(8) user_pad : \u63d0\u4f9b\u4f7f\u7528\u8005\u3001\u7fa4\u7d44\u53ca\u6b0a\u9650\u7684\u7ba1\u7406\u65b9\u5f0f<br \/>\n(9) user_pad_forntend : user_pad\u7684\u4f7f\u7528\u8005\u4ecb\u9762<\/p>\n<\/li>\n<li>\n<p>\u4fee\u6b63\u5716\u6a94\u8def\u5f91\u554f\u984c<\/p>\n<\/li>\n<\/ol>\n<pre lang=\"bash\">vim node_modules\/ep_user_pad_frontend\/templates\/group.ejs \nvim node_modules\/ep_user_pad_frontend\/templates\/public_pad.ejs\nvim node_modules\/ep_user_pad_frontend\/templates\/public_pad_logged_in.ejs\nvim node_modules\/ep_user_pad_frontend\/templates\/pad.ejs \n# \u4e0a\u8ff0\u5169\u500b\u6a94\u6848\u662f\u4fee\u6b63\u4e0b\u9762\u9019\u90e8\u5206\nimg src=\".\/static\/plugins\/ep_user_pad_frontend\/static\/images\/pad-illustration-01.png\" alt=\"Etherpad\" \n# \u4fee\u6b63\u70ba\nimg src=\"..\/static\/plugins\/ep_user_pad_frontend\/static\/images\/pad-illustration-01.png\" alt=\"Etherpad\" \n<\/pre>\n<p>pre lang=&#8221;bash&#8221;>vim node_modules\/ep_user_pad_frontend\/static\/css\/styles.less<\/p>\n<h1>\u4e0a\u8ff0\u9019\u500b\u6a94\u6848\u662f\u4fee\u6b63\u4e0b\u9762\u9019\u90e8\u5206<\/h1>\n<p>.at2x(&#8216;images\/close-cyan-12.png&#8217;);<\/p>\n<h1>\u4fee\u6b63\u70ba<\/h1>\n<p>.at2x(&#8216;..\/images\/close-cyan-12.png&#8217;);<\/p>\n<h1>\u4e0b\u9762\u9019\u53e5<\/h1>\n<p>list-style-image: url(images\/users-cyan-16.png);<\/p>\n<h1>\u4fee\u6b63\u70ba<\/h1>\n<p>list-style-image: url(..\/images\/users-cyan-16.png\n<\/p>\n<ol>\n<li>\u8a2d\u5b9a Log rotation<\/li>\n<\/ol>\n<pre lang=\"bash\">sudo vim \/etc\/logrotate.d\/etherpad-lite\n# \u52a0\u5165\u4ee5\u4e0b\u5167\u5bb9\n\/var\/log\/etherpad-lite\/*.log\n{\n        rotate 4\n        weekly\n        missingok\n        notifempty\n        compress\n        delaycompress\n        sharedscripts\n        postrotate\n                restart etherpad-lite &gt;\/dev\/null 2&gt;&amp;1 || true\n        endscript\n}\n<\/pre>\n<ol>\n<li>\u52a0\u5165\u958b\u6a5f\u555f\u52d5<\/li>\n<\/ol>\n<pre lang=\"bash\">\nsudo vim \/etc\/rc.local\n# \u52a0\u5165\u4e0b\u9762\n\/sbin\/start etherpad start\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>etherpad \u5b89\u88dd\u57fa\u672c\u5957\u4ef6\u9700\u6c42 sudo apt-get install gzip git-core curl python libssl-dev pkg-config build-essential \u66f4\u65b0\u5b89\u88ddnodejs\u7684\u4f86\u6e90 sudo curl -sL https:\/\/deb.nodesource.com\/setup | sudo bash &#8211; \u5b89\u88ddnodejs sudo apt-get install nodejs \u65b0\u589eetherpad\u7684\u4f7f\u7528\u8005 sudo useradd etherpad -m -s \/bin\/bash -r sudo passwd etherpad \u5c07etherpad\u4f7f\u7528\u8005\u52a0\u5165sudoers\u4e2d sudo usermod &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=1221\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41,62,63,82],"tags":[],"class_list":["post-1221","post","type-post","status-publish","format-standard","hentry","category-etherpad","category-mysql","category-nagios","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1221"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1221\/revisions"}],"predecessor-version":[{"id":1982,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1221\/revisions\/1982"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}