WordPress 4.1.1 installation on Ubuntu 14.04: Difference between revisions

add the instruction to set up the database
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
* ''Tested on Ubuntu 14.04.2 LTS, Apache/2.4.9, PHP 5.5.15RC1, git 2.0.2, MySQL 5.5.41-0ubuntu0.14.04.1 / easy /  
* ''Tested on Ubuntu 14.04.2 LTS, Apache/2.4.9, PHP 5.5.15RC1, git 2.0.2, MySQL 5.5.41-0ubuntu0.14.04.1 / easy / less than 10 minutes


There is the [http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install Famous 5-Minute Install instruction] so these are just my personal notes if I have to install other instances on a similar environment.
There is the [http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install Famous 5-Minute Install instruction] so these are just my personal notes if I have to install other instances on a similar environment.


== Unpacking the files ==
== Unpack the files ==


WordPress devs have decided on, what I consider as outdated, SVN, however they have been kind to put up a GitHub repo. This makes it easier to pull or merge latest updates even though the [http://codex.wordpress.org/Upgrading_WordPress update] is supposed to be much simpler.
WordPress devs have decided on, what I consider as outdated, SVN, however they have been kind to put up a GitHub repo. This makes it easier to pull or merge latest updates even though the [http://codex.wordpress.org/Upgrading_WordPress update] is supposed to be much simpler.


<div class="cli">
<div class="cli">
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span>
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span><span style="color:blue;">/srv/www/blog</span><span style="color:#cccccc;">
<span style="color:blue;">/srv/www/blog</span><span style="color:#cccccc;">
$ <b class="color:white;">git clone <nowiki>https://github.com/WordPress/WordPress.git</nowiki> .</b>
$ <b class="color:white;">git clone <nowiki>https://github.com/WordPress/WordPress.git</nowiki> .</b>
</span>
</span><pre class="output">Cloning into '.'...
<br><span style="color:#cccccc">Cloning into '.'...<br>
remote: Counting objects: 196601, done.
remote: Counting objects: 196601, done.<br>
remote: Compressing objects: 100% (43/43), done.
remote: Compressing objects: 100% (43/43), done.<br>
remote: Total 196601 (delta 28), reused 0 (delta 0), pack-reused 196558
remote: Total 196601 (delta 28), reused 0 (delta 0), pack-reused 196558<br>
Receiving objects: 100% (196601/196601), 116.49 MiB | 9.94 MiB/s, done.
Receiving objects: 100% (196601/196601), 116.49 MiB | 9.94 MiB/s, done.<br>
Resolving deltas: 100% (154751/154751), done.
Resolving deltas: 100% (154751/154751), done.<br>
Checking connectivity... done.
Checking connectivity... done.<br>
Checking out files: 100% (1424/1424), done.<br></pre>
Checking out files: 100% (1424/1424), done.<br></span>
</div>
</div>


Line 27: Line 25:


<div class="cli">
<div class="cli">
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span>
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span><span style="color:blue;">/srv/www/blog</span><span style="color:#cccccc;">
<span style="color:blue;">/srv/www/blog</span><span style="color:#cccccc;">
$ <b class="color:white;">mysql -uroot -p</b>
$ <b class="color:white;">mysql -uroot -p</b>
</span>
</span>
Line 45: Line 42:


mysql> create database wp_michael;
mysql> create database wp_michael;
Query OK, 1 row affected (0.02 sec)</pre>
Query OK, 1 row affected (0.02 sec)
 
mysql> grant all on wp_michael.* to 'webacc'@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)
 
mysql> exit
Bye</pre>
</div>
</div>
== Update the wp-config.php file ==
We'll use the default as a starting point. Let's first make a copy of the sample config file.
<div class="cli">
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span><span style="color:blue;">/srv/www/blog</span><span style="color:#cccccc;">
$ <b class="color:white;">cp -p wp-config-sample.php wp-config.php</b>
</span></div>
This doesn't add to the security, but I usually keep original files with an extension of .dist (short for distribution).
<div class="cli">
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span><span style="color:blue;">/srv/www/blog</span><span style="color:#cccccc;">
$ <b class="color:white;">mv wp-config-sample.php wp-config-sample.php.dist</b>
</span></div>
Make updates to the config file. The lines for salts can be obtained at https://api.wordpress.org/secret-key/1.1/salt/. The following diff shows you the changes I've made.
<source lang="diff">
19c19
< define('DB_NAME', 'database_name_here');
---
> define('DB_NAME', 'wp_michael');
22c22
< define('DB_USER', 'username_here');
---
> define('DB_USER', 'webacc');
25c25
< define('DB_PASSWORD', 'password_here');
---
> define('DB_PASSWORD', 'password');
45,53c45,52
< define('AUTH_KEY',        'put your unique phrase here');
< define('SECURE_AUTH_KEY',  'put your unique phrase here');
< define('LOGGED_IN_KEY',    'put your unique phrase here');
< define('NONCE_KEY',        'put your unique phrase here');
< define('AUTH_SALT',        'put your unique phrase here');
< define('SECURE_AUTH_SALT', 'put your unique phrase here');
< define('LOGGED_IN_SALT',  'put your unique phrase here');
< define('NONCE_SALT',      'put your unique phrase here');
<
---
> define('AUTH_KEY',        'xSiS5fsJx&c6x-1Xd^xv8<IK|Fp2#]jjyxfH7|XRr -sRrH2O]&gS=U7jp:ikj$j');
> define('SECURE_AUTH_KEY',  ';)[9IiH)=]^ca[sYbSrSX!-8Ou?3_B7TN#47^tI#R/l8MaSnc^>|C]Yb9pJBoW/d');
> define('LOGGED_IN_KEY',    '9]&k)u#m;n#40-j4<~X*!}E`RjE]Se[nxa,D}+]b~zu`1+$*L7H4}&C]=4dr]+H8');
> define('NONCE_KEY',        'k3i|O O4 ls_lcaamI-aza)zp|/h4G-KAnOGlQD.Z1k0Pgjc!a fcOXs+B^?6Jus');
> define('AUTH_SALT',        ':SrSJn+FH2.K>udlBa+)a8|wt#l%P*#gQ{bv;{S*Sn+>-GUA~]re`BqL043j7Hlp');
> define('SECURE_AUTH_SALT', 'GpRr[xCm:ECIo$z+-<S{)>W*[QnWagNyD.z|1(6)-+v{5z4GiK7}4Co03,W]Htr~');
> define('LOGGED_IN_SALT',  '_jbNqHC(GT=i|!T?+KFRL>4|S|d:-<..#@NnCb9@m e_nKZomo>W-Da&UEnr)w`j');
> define('NONCE_SALT',      'Sq+|7M++P>BFh6]-aw ja/aRlf(v0!<Q#7DIiun|)G0yJ$0&LknmTVAAY?~-tDon');
</source>
== Set up the web services ==
I'm using Apache here, and this is how my config file looks like.
<source lang="apache">
<VirtualHost *:80>
        ServerName michael.blog.com
        ServerAdmin webmaster@server.com
        ServerSignature off
        DocumentRoot /srv/www/blog
        <Directory /srv/www/blog>
                Options -Indexes +FollowSymLinks -MultiViews
                AllowOverride All
                Require all granted
                <IfModule mod_rewrite.c>
                        RewriteEngine On
                        RewriteBase /
                        RewriteRule ^index\.php$ - [L]
                        RewriteCond %{REQUEST_FILENAME} !-f
                        RewriteCond %{REQUEST_FILENAME} !-d
                        RewriteRule . /index.php [L]
                </IfModule>
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>d
</source>
== Correct the permissions ==
Before the set up:
<syntaxhighlight lang="bash">
$ chown -R www-data:www-data *  # Change ownership to web server
$ find . -type d -exec chmod 755 {} \;  # directory permissions = rwxr-xr-x
$ find . -type f -exec chmod 644 {} \;  # file permissions = rw-r--r--
</syntaxhighlight>
<span class="shell">wp-content</span> folder needs to be writable by the web server after the setup.
<syntaxhighlight lang="bash">
$ chown -R mhan:mhan *
$ chown -R www-data:www-data wp-content
</syntaxhighlight>
== Complete the installation ==
This is the final step which doesn't involve any CLI commands. Go to the site URL and it should take you through the rest of the installation process. In the example I used above, it would be <nowiki>http://michael.blog.com</nowiki>. Enjoy.