{"id":42,"date":"2016-10-09T02:43:41","date_gmt":"2016-10-09T02:43:41","guid":{"rendered":"http:\/\/blog.warbel.net\/?p=42"},"modified":"2016-10-09T02:44:43","modified_gmt":"2016-10-09T02:44:43","slug":"install-owncloud-on-ubuntu-server-16-04-with-a-mail-server","status":"publish","type":"post","link":"https:\/\/blog.warbel.net\/index.php\/2016\/10\/09\/install-owncloud-on-ubuntu-server-16-04-with-a-mail-server\/","title":{"rendered":"Install OwnCloud on Ubuntu Server 16.04 with a Mail Server"},"content":{"rendered":"<p>Setting up a mail server is covered in a previous post&#8230;<\/p>\n<p>Before starting I have created a copy of my VM to mitigate breaking everything and I recommend you do too, if you&#8217;re reading this.<\/p>\n<p>I have a unique installation &#8211; phpmyadmin is running on another server and I would like to enable access to the mysql server running on the mail server.<\/p>\n<p>On the mail server I commented out:<br \/>\nbind-address \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = 127.0.0.1<br \/>\nfrom the file \/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/p>\n<p>Then,\u00a0also\u00a0on the mail server entered the commands:<br \/>\n$ mysql -u root -h localhost -p<br \/>\nCREATE USER &#8216;myusername&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;mypassword&#8217;;<br \/>\nGRANT ALL PRIVILEGES ON *.* TO &#8216;myusername&#8217;@&#8217;localhost&#8217; WITH GRANT OPTION;<br \/>\nCREATE USER &#8216;myusername&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;mypassword&#8217;;<br \/>\nGRANT ALL PRIVILEGES ON *.* TO &#8216;myusername&#8217;@&#8217;%&#8217; WITH GRANT OPTION;<br \/>\nexit<\/p>\n<p>This created a new user with &#8216;myusernam&#8217; and &#8216;mypassword&#8217; that has remote access to the entire mysql installation.<\/p>\n<p>Back on the server, I edited the phpmyadmin config file\u00a0\/etc\/phpmyadmin\/config.inc.php and appended the following to the file (after backing up of course!):<\/p>\n<p>$i++;<br \/>\n$cfg[&#8216;Servers&#8217;][$i][&#8216;verbose&#8217;] = &#8216;Mail&#8217;;<br \/>\n$cfg[&#8216;Servers&#8217;][$i][&#8216;host&#8217;] = &#8216;mail.myhostname.net&#8217;;<br \/>\n$cfg[&#8216;Servers&#8217;][$i][&#8216;port&#8217;] = &#8221;;<br \/>\n$cfg[&#8216;Servers&#8217;][$i][&#8216;socket&#8217;] = &#8221;;<br \/>\n$cfg[&#8216;Servers&#8217;][$i][&#8216;connect_type&#8217;] = &#8216;tcp&#8217;;<br \/>\n$cfg[&#8216;Servers&#8217;][$i][&#8216;extension&#8217;] = &#8216;mysqli&#8217;;<br \/>\n$cfg[&#8216;Servers&#8217;][$i][&#8216;auth_type&#8217;] = &#8216;cookie&#8217;;<br \/>\n$cfg[&#8216;Servers&#8217;][$i][&#8216;AllowNoPassword&#8217;] = false;<\/p>\n<p>Then restarted the apache service on the server where phpmyadmin is running and voila! I can log into the remote mysql installation.<br \/>\nFrom there it was a simple matter of creating a new user for ownlcloud.\u00a0To do that I have been following the instructions I&#8217;ve found <a href=\"http:\/\/gabrielbeaver.me\/2015\/07\/owncloud-series-getting-started\/\">here<\/a>\u00a0and install instructions for Ubuntu 16.04 <a href=\"https:\/\/download.owncloud.org\/download\/repositories\/stable\/owncloud\/\">here<\/a>.<\/p>\n<p>To secure my installation and stop passwords from being sent in the clear, I forced ssl connections in owncloud. Googled and found instructions <a href=\"https:\/\/forum.owncloud.org\/viewtopic.php?t=3161\">here<\/a>.<br \/>\nIn short, edit the file \/var\/www\/owncloud\/.htaccess<br \/>\nIn the section &lt;IfModule mod_rewrite.c&gt; add two lines below ReWriteEngine on:<br \/>\nRewriteCond %{HTTPS} off<br \/>\nRewriteRule (.*) https:\/\/%{HTTP_HOST}%{REQUEST_URI}<\/p>\n<p>Restart apache and it should force you to use the https rather than http access.<\/p>\n<p>Configuration is not covered here. However you should be able to log in and continue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting up a mail server is covered in a previous post&#8230; Before starting I have created a copy of my VM to mitigate breaking everything and I recommend you do too, if you&#8217;re reading this. I have a unique installation &hellip; <a href=\"https:\/\/blog.warbel.net\/index.php\/2016\/10\/09\/install-owncloud-on-ubuntu-server-16-04-with-a-mail-server\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":2,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":45,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions\/45"}],"wp:attachment":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}