{"id":23,"date":"2019-04-19T14:23:38","date_gmt":"2019-04-19T19:23:38","guid":{"rendered":"https:\/\/scythk.com\/?p=23"},"modified":"2019-04-19T17:34:41","modified_gmt":"2019-04-19T22:34:41","slug":"install-wordpress-on-lamp","status":"publish","type":"post","link":"https:\/\/scythk.com\/index.php\/2019\/04\/19\/install-wordpress-on-lamp\/","title":{"rendered":"Install WordPress on LAMP"},"content":{"rendered":"<p>After <a href=\"https:\/\/scythk.com\/index.php\/2019\/04\/19\/lamp-installation\/\">installing LAMP on your VPS<\/a>, you can now install WordPress to build your own website.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Setup_MySQL\"><\/span>Setup MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>First, create database and user for wordpress. Login to MySQL.<\/p>\n<pre><code class=\"language-bash\">sudo mysql -u root -p\n<\/code><\/pre>\n<p>Create a new database.<\/p>\n<pre><code class=\"language-sql\">CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;\n<\/code><\/pre>\n<p>Create a new user. Replace\n<em>wpuser<\/em> and <em>passwd<\/em> with your own.<\/p>\n<pre><code class=\"language-sql\">CREATE USER wpuser@localhost IDENTIFIED BY &#039;passwd&#039;;\nGRANT ALL PRIVILEGES ON wordpress.* TO wpuser@localhost;\n<\/code><\/pre>\n<p>Refresh privileges and quit.<\/p>\n<pre><code class=\"language-sql\">FLUSH PRIVILEGES;\nEXIT;\n<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Setup_WordPress\"><\/span>Setup WordPress<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Download the latest version of WordPress.<\/p>\n<pre><code class=\"language-bash\">cd ~\ncurl -O https:\/\/wordpress.org\/latest.tar.gz\n<\/code><\/pre>\n<p>Create a WordPress configuration by copying the sample one.<\/p>\n<pre><code class=\"language-bash\">cp -a wp-config-sample.php wp-config.php\nnano wp-config.php\n<\/code><\/pre>\n<p>Replace DB_NAME, DB_USER, DB_PASSWORD with what you&#8217;ve used in last step<\/p>\n<pre><code class=\"language-php\">define( &#039;DB_NAME&#039;, &#039;wordpress&#039; );\n\/** MySQL database username *\/\ndefine( &#039;DB_USER&#039;, &#039;wpuser&#039; );\n\/** MySQL database password *\/\ndefine( &#039;DB_PASSWORD&#039;, &#039;passwd&#039; );\n<\/code><\/pre>\n<p>Generate secret key from WordPress website.<\/p>\n<pre><code class=\"language-bash\">curl -s https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/\n<\/code><\/pre>\n<p>You&#8217;ll get something like that.<\/p>\n<pre><code class=\"language-php\">define(&#039;AUTH_KEY&#039;,         &#039;8%Q})6%~Kjb|)s|24PF r1+5&gt;&amp;X&lt;w{kJ3Kgq6|6cG4*AxX`&amp;FcO\/acj)&lt;meN7dte&#039;);\ndefine(&#039;SECURE_AUTH_KEY&#039;,  &#039;n=h$|JPp,8}nmqM+B7d }(Pl{3Sj`LiPbh(ulTpm.p[*5rOj,ju$hclOioJC6`J7&#039;);\ndefine(&#039;LOGGED_IN_KEY&#039;,    &#039;1&lt;2!I&lt;Y7Kj0G+|7+-]&gt;+Cgc&gt;1,xGK)HfLh3suL%a0|O9M{\/~HFM0wf{pU{aU!qd&amp;&#039;);\ndefine(&#039;NONCE_KEY&#039;,        &#039;&lt;6ZuCiM+C-9xjrb[[-[V_Wvk#LIj!] Uz{#sKB_~37LC=n|K7F6WNpide,(o;xJk&#039;);\ndefine(&#039;AUTH_SALT&#039;,        &#039;5m0&amp;wCfz(&gt;{494-i&gt;1sG9?oTBd]hD)g_##C7Q@%\/21ZYK2%S&gt;^`k#w&amp;&lt;X).8krbi&#039;);\ndefine(&#039;SECURE_AUTH_SALT&#039;, &#039;3)uP@J(|^#duOj+%Y1pCC)4MAR2XbJK.HzF{`gTrU kZruh1lp:=7bn&lt;nfe6kDo~&#039;);\ndefine(&#039;LOGGED_IN_SALT&#039;,   &#039;&amp;,F+qx22+&lt;oN$-|{AWko|HPp$t*DVc.Gylu[3|jYL96GPh]3%L$xjN7^|LJ$)b#O&#039;);\ndefine(&#039;NONCE_SALT&#039;,       &#039;mi;u+-:fp E!Qp5%uBAfZ|-.&gt;R Jg]U&amp;{miZa4#J*5EAIpJ0^xd+nj#0CXGL+`+-&#039;);\n<\/code><\/pre>\n<p>Replace the corresponding config in wp-config.php.<\/p>\n<p>Add<\/p>\n<pre><code class=\"language-php\">define(&#039;FS_METHOD&#039;, &#039;direct&#039;);\n<\/code><\/pre>\n<p>to the end of the file.<\/p>\n<p>Now copy all files to the website root.<\/p>\n<pre><code class=\"language-bash\">sudo cp -a ~\/wordpress\/* \/var\/www\/html\nsudo chown -R www-data \/var\/www\/html\n<\/code><\/pre>\n<p>Open your website in browser and follow the instruction. And now you are all set!<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Trouble_shooting\"><\/span>Trouble shooting<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Some possible reasons that you cannot reach your website.<\/p>\n<ul>\n<li>Check your firewall<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">ufw status\n<\/code><\/pre>\n<p>If there is no Apache, you can add it by<\/p>\n<pre><code class=\"language-bash\">sudo ufw allow apache\n<\/code><\/pre>\n<ul>\n<li>Check iptable<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Problem_that_I_still_havent_fixed\"><\/span>Problem that I still haven&#8217;t fixed<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>After editing the\n<strong>Permalink Settings<\/strong>, I was unable to publish new post. From Chrome dev tool I find out that there&#8217;re several errors and all \/wp-json could not be found. I&#8217;m still looking for the solution. So don&#8217;t change it unless you know how to fix the problem.<\/p>\n<p>The next post is about <a href=\"https:\/\/scythk.com\/index.php\/2019\/04\/19\/enable-ssl-for-wordpress\/\">Enable SSL<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"References\"><\/span>References<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"https:\/\/trafficmgr.net\/zh\/archives\/166\/\">Install LAMP Stack on Ubuntu Server<\/a><\/p>\n<p><a href=\"https:\/\/trafficmgr.net\/zh\/archives\/172\/\">Install WordPress on LAMP stack<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>After installing LAMP on your VPS, you can now install WordPress to build your own website. Setup MySQL First, create database and user for wordpress. Login to MySQL. sudo mysql -u root -p Create a new database. CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; Create a new user. Replace wpuser and passwd with [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paTSGz-n","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":4,"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":40,"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions\/40"}],"wp:attachment":[{"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scythk.com\/index.php\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}