{"id":3232,"date":"2014-04-26T07:37:05","date_gmt":"2014-04-26T07:37:05","guid":{"rendered":"http:\/\/ubuntuhandbook.org\/?p=3232"},"modified":"2014-04-26T07:37:05","modified_gmt":"2014-04-26T07:37:05","slug":"install-set-up-wordpress-ubuntu-14-04","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2014\/04\/install-set-up-wordpress-ubuntu-14-04\/","title":{"rendered":"Install and Set up WordPress in Ubuntu 14.04 Server"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/wordpress-logo-simplified.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/wordpress-logo-simplified.png\" alt=\"install wordpress ubuntu 14.04\" width=\"220\" height=\"220\" class=\"aligncenter size-full wp-image-2068\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/wordpress-logo-simplified.png 220w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/wordpress-logo-simplified-150x150.png 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/a><\/p>\n<p>Already installed <a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2014\/04\/install-nginx-with-php5-mysql-lemp-in-ubuntu-14-04-server\/\" title=\"Install Nginx web server with mysql, php5 in Ubuntu\" target=\"_blank\">LEMP<\/a> or <a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2013\/10\/install-lamp-ubuntu-13-10-server\/\" title=\"Install Apache web server with Php, Mysql\" target=\"_blank\">LAMP<\/a> on your Ubuntu server? Well, now it&#8217;s time to install wordpress CMS and get your site running!<\/p>\n<p>As you may know, wordPress is a popular blogging tool and a content management system (CMS) based on PHP and MySQL. It&#8217;s free and open-source. <b>In the steps below the lines that the user needs to enter or customize will be in <span style=\"color:red;\">red<\/span> in this tutorial!<\/b><\/p>\n<h3>1. Setup Mysql Database for WordPress<\/h3>\n<p><b>For LEMP (Ubuntu, Nginx, Mysql, Php) without phpmyadmin installed:<\/b><\/p>\n<p>Database name: <span style=\"color:red;\">wordpress_db<\/span>; user name: <span style=\"color:red;\">ubuntuhandbook<\/span>; password: <span style=\"color:red;\">12345678<\/span>; Change them in the code below.<\/p>\n<blockquote><p>Step 1 &#8211; Run command in Ubuntu Server to log into MySQL Shell with MySQL root password:<\/p>\n<pre style=\"border:none;\">mysql -u root -p<\/pre>\n<p>Step 2 &#8211; Create database, here I named it wordpress_db:<\/p>\n<pre style=\"border:none;\">CREATE DATABASE <span style=\"color:red;\">wordpress_db;<\/span><\/pre>\n<p>Step 3 &#8211; Create a new user named ubuntuhandbook:<\/p>\n<pre style=\"border:none;\">CREATE USER <span style=\"color:red;\">ubuntuhandbook<\/span>@localhost;<\/pre>\n<p>Step 4 &#8211; Set a password for this user:<\/p>\n<pre style=\"border:none;\">SET PASSWORD FOR <span style=\"color:red;\">ubuntuhandbook<\/span>@localhost= PASSWORD(\"<span style=\"color:red;\">12345678<\/span>\");<\/pre>\n<p>Step 5 &#8211; Grant all privileges to the new user:<\/p>\n<pre style=\"border:none;\">GRANT ALL PRIVILEGES ON <span style=\"color:red;\">wordpress_db<\/span>.* TO <span style=\"color:red;\">ubuntuhandbook<\/span>@localhost IDENTIFIED BY '<span style=\"color:red;\">12345678<\/span>';<\/pre>\n<p>Step 6 &#8211; Refresh MySQL:<\/p>\n<pre style=\"border:none;\">FLUSH PRIVILEGES;<\/pre>\n<p>Exit MySQL shell:<\/p>\n<pre style=\"border:none;\">exit<\/pre>\n<\/blockquote>\n<p><b>For LAMP (Apache2, Mysql, Php, Ubuntu Linux):<\/b><\/p>\n<p>If you&#8217;ve installed LEMP and want to use PhpMyadmin to manage database, click the link in the top of this tutorial.<\/p>\n<p>1. Install Phpmyadmin:<\/p>\n<pre style=\"border:none;\">sudo apt-get install phpmyadmin<\/pre>\n<p>Choose <b>apache2<\/b> webserver during the installing process and say <b>NO<\/b> to &#8220;Configure database for phpmyadmin with dbconfig-common?&#8221;<\/p>\n<p>Once installed, run commands below to get it working:<\/p>\n<pre style=\"border:none;\">sudo sh -c 'echo \"Include \/etc\/phpmyadmin\/apache.conf\" >> \/etc\/apache2\/apache2.conf' &#038;&#038; sudo service apache2 restart<\/pre>\n<p>Now, go to <u>http:\/\/UBUNTUSERVERIP\/phpmyadmin\/<\/u> in your client&#8217;s browser and type in <b>root<\/b> and the password you set when MySQL was installed to login.<\/p>\n<div id=\"attachment_2069\" class=\"wp-caption aligncenter\" style=\"width: 530px\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/phpmyadmin-login.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/phpmyadmin-login.jpg\" alt=\"phpmyadmin login\" width=\"520\" height=\"313\" class=\"size-full wp-image-2069\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/phpmyadmin-login.jpg 520w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/phpmyadmin-login-300x180.jpg 300w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">phpmyadmin login<\/p>\n<\/div>\n<p>2. Follow the below steps to create database and user with same name.<\/p>\n<blockquote><p>Step 1 &#8211; Click on <b>Users<\/b> then click <b>Add User<\/b>.<br \/>\nStep 2 &#8211; Type in your desired <b>User name<\/b> (wordpress is a good one) and ensure <b>Use text field<\/b> is selected. Ensure <b>Host<\/b> is set to <b>Local<\/b> from the drop down list and the text box will change to <b>localhost<\/b> and enter a <b>Password<\/b> and then confirm it in the <b>Re-type<\/b> box. Ensure the Password Use text field is also selected.<br \/>\nStep 3 &#8211; Check the box that says <b>Create database with same name and grant all priviliges.<\/b><br \/>\nStep 4 &#8211; Click on <b>Go<\/b>.<\/p>\n<\/blockquote>\n<div id=\"attachment_2070\" class=\"wp-caption aligncenter\" style=\"width: 590px\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/phpmyadmin-create-user.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/phpmyadmin-create-user.jpg\" alt=\"phpmyadmin create user and database\" width=\"580\" height=\"328\" class=\"size-full wp-image-2070\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/phpmyadmin-create-user.jpg 580w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/phpmyadmin-create-user-300x169.jpg 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">phpmyadmin create user and database<\/p>\n<\/div>\n<h3>2. Download &#038; Config WordPress:<\/h3>\n<p>Download the latest wordpress from its official website:<\/p>\n<pre style=\"border:none;\">cd && wget http:\/\/wordpress.org\/latest.tar.gz<\/pre>\n<p>Decompress the package:<\/p>\n<pre style=\"border:none;\">tar -xzvf latest.tar.gz <\/pre>\n<p>Go to the result folder and create the configuration file by copying the sample file:<\/p>\n<pre style=\"border:none;\">cd wordpress\/ && cp wp-config-sample.php wp-config.php<\/pre>\n<p>Edit the wordpress configuration file via vi editor:<\/p>\n<pre style=\"border:none;\">vi wp-config.php<\/pre>\n<p>Find the section that contains the field below and substitute in the correct name for your database, username, and password:<\/p>\n<blockquote><p>\/\/ ** MySQL settings &#8211; You can get this info from your web host ** \/\/<br \/>\n\/** The name of the database for WordPress *\/<br \/>\ndefine(&#8216;DB_NAME&#8217;, &#8216;<span style=\"color:red;\">DATABASE_NAME_HERE<\/span>&#8216;);<\/p>\n<p>\/** MySQL database username *\/<br \/>\ndefine(&#8216;DB_USER&#8217;, &#8216;<span style=\"color:red;\">USER_NAME_HERE<\/span>&#8216;);<\/p>\n<p>\/** MySQL database password *\/<br \/>\ndefine(&#8216;DB_PASSWORD&#8217;, &#8216;<span style=\"color:red;\">PASSWORD_HERE<\/span>&#8216;);<\/p>\n<\/blockquote>\n<p>Press <b>i<\/b> to start editing, and <b>Esc<\/b> to end editing. Finally press <b>Shift+:<\/b> followed by <b>wq<\/b> and Enter to save and exit the file.<\/p>\n<h3>3. Copy Files and Set Ownership:<\/h3>\n<p>Now move WordPress files to webserver root directory:<\/p>\n<blockquote><p>For LAMP:<\/p>\n<pre style=\"border:none;\">cd &#038;&#038; sudo rsync -avP wordpress\/ \/var\/www\/<\/pre>\n<p>For LNMP:<\/p>\n<pre style=\"border:none;\">cd &#038;&#038; sudo rsync -avP wordpress\/ \/usr\/share\/nginx\/html\/<\/pre>\n<\/blockquote>\n<p>Set ownership of the root directory:<\/p>\n<pre style=\"border:none;\">cd \/var\/www\/  ###For nginx: cd \/usr\/share\/nginx\/html\/\n\nsudo chown www-data:www-data * -R \n\nsudo usermod -a -G www-data www-data<\/pre>\n<h3>4. Install WordPress:<\/h3>\n<p>Finally in your client&#8217;s web browser go to <u>http:\/\/UBUNTUSERVERIP\/wp-admin\/install.php<\/u> and install your wordpress site:<\/p>\n<div id=\"attachment_2071\" class=\"wp-caption aligncenter\" style=\"width: 530px\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/installing-wordpress-ubuntu1310.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/installing-wordpress-ubuntu1310.jpg\" alt=\"installing wordpress\" width=\"520\" height=\"312\" class=\"size-full wp-image-2071\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/installing-wordpress-ubuntu1310.jpg 520w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/installing-wordpress-ubuntu1310-300x179.jpg 300w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">installing wordpress<\/p>\n<\/div>\n<p>Once done, if you still get &#8220;It Works!&#8221; Apache page. Run command below to edit dir.conf:<\/p>\n<pre style=\"border:none;\">sudo vi \/etc\/apache2\/mods-enabled\/dir.conf<\/pre>\n<p>You will see a line of index files (index.html, index.php, index.cgi, etc) under the DirectoryIndex setting. Add <b>index.php<\/b> as the first item in the list.<\/p>\n<p>After that, restart Apache server by:<\/p>\n<pre style=\"border:none;\">sudo service apache2 restart<\/pre>\n<p>Now you can access your new website:<\/p>\n<div id=\"attachment_2072\" class=\"wp-caption aligncenter\" style=\"width: 590px\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/install-wordpress-finish.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/install-wordpress-finish.jpg\" alt=\"wordpress site \" width=\"580\" height=\"358\" class=\"size-full wp-image-2072\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/install-wordpress-finish.jpg 580w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/install-wordpress-finish-300x185.jpg 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">wordpress site<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Already installed LEMP or LAMP on your Ubuntu server? Well, now it&#8217;s time to install wordpress CMS and get your site running! As you may know, wordPress is a popular blogging tool and a content management system (CMS) based on PHP and MySQL. It&#8217;s free and open-source. In the steps below the lines that the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[855,158],"class_list":["post-3232","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-ubuntu-14-04","tag-wordpress"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/3232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=3232"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/3232\/revisions"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=3232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=3232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=3232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}