WordPress is the most popular blogging system in use on the web. Here are the steps I followed to install it on my server.
This post was published quite some time ago and likely contains out of date information.
After the initial setup of my new server, installation of a basic WordPress blog was simple. Create the database, configure Nginx, download, install and configure WordPress itself.
Database Creation
Create an account and a database for WordPress:
mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5340 to server version: 3.23.54 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE DATABASE illallangi_com; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON illallangi_com.* TO "illallangi_com"@"localhost" -> IDENTIFIED BY "password"; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) mysql> EXIT Bye
Nginx Configuration
I created the /etc/nginx/conf.d/illallangi.com.conf file:
server { listen 80; server_name illallangi.com; client_max_body_size 64M; index index.php index.html; include /etc/nginx/default.d/*.conf; root /var/www/illallangi.com/wordpress; location / { try_files $uri $uri/ /index.php?q=$request_uri; } }
Restart the nginx service:
systemctl restart nginx
WordPress Install
Firstly I created a new directory for the site:
mkdir -p /var/www/illallangi.com
Then I downloaded and extracted the latest version of WordPress:
curl https://wordpress.org/wordpress-4.2.2.tar.gz | tar -zx --directory /var/www/illallangi.com/
WordPress Configuration
Create the wp-config.php file and configured it, stealing some code from a gist I found to do it on the command line (rather than editing the file in nano):
cp /var/www/illallangi.com/wordpress/wp-config-sample.php /var/www/illallangi.com/wordpress/wp-config.php perl -pi -e "s/database_name_here/illallangi_com/g" /var/www/illallangi.com/wordpress/wp-config.php perl -pi -e "s/username_here/illallangi_com/g" /var/www/illallangi.com/wordpress/wp-config.php perl -pi -e "s/password_here/password/g" /var/www/illallangi.com/wordpress/wp-config.php perl -i -pe' BEGIN { @chars = ("a" .. "z", "A" .. "Z", 0 .. 9); sub salt { join "", map $chars[ rand @chars ], 1 .. 64 } } s/put your unique phrase here/salt()/ge ' /var/www/illallangi.com/wordpress/wp-config.php
Themes and Plugins
All of these steps could have been completed through the WordPress web interface, but I like being able to do things on a command line, especially if I plan to script it later.
First I downloaded and installed my chosen theme, Tracks by Complete Themes:
curl -o /tmp/tracks.zip https://downloads.wordpress.org/theme/tracks.1.37.1.zip unzip /tmp/tracks.zip -d /var/www/illallangi.com/wordpress/wp-content/themes
The default WordPress install includes two plugins, Akismet for comment spam protection and Hello Dolly as an example plugin. I remove unwanted plugins and themes to keep my install uncluttered. Manually upgrading the Akismet plugin to the latest version required a manual uninstall as well.
Removed old version of Akismet plugin and the Hello Dolly plugin:
rm -rf /var/www/illallangi.com/wordpress/wp-content/plugins/akismet rm -f /var/www/illallangi.com/wordpress/wp-content/plugins/hello.php
Download and install akismet plugin:
curl -o /tmp/akismet.zip https://downloads.wordpress.org/plugin/akismet.3.1.3.zip unzip /tmp/akismet.zip -d /var/www/illallangi.com/wordpress/wp-content/plugins
Download and install SyntaxHighlighter Evolved plugin:
curl -o /tmp/syntaxhighlighter.zip https://downloads.wordpress.org/plugin/syntaxhighlighter.zip unzip /tmp/syntaxhighlighter.zip -d /var/www/illallangi.com/wordpress/wp-content/plugins
File and Directory Permissions
Set permissions on files:
find /var/www/illallangi.com/wordpress/ -type f -exec chmod 664 {} + find /var/www/illallangi.com/wordpress/ -type d -exec chmod 775 {} + chmod 660 /var/www/illallangi.com/wordpress/wp-config.php chown -R apache.nobody /var/www/illallangi.com/wordpress
Next Steps
At this point the WordPress installation was complete. I pointed DNS for illallangi.com to the new server and browsed to it in Chrome. WordPress presented a final installation wizard, which created the initial database entries.
I could also have restored my database from backup at this point.
Be First to Comment