Install WordPress under Ubuntu and enable automatic updates

Install MySQL and PHP5 MySQL extension:

sudo apt-get install mysql-server php5-mysql

Initialize the cluster and run a script to make MySQL more secure:

sudo mysql_install_db
sudo mysql_secure_installation

Enter MySQL console as root, create the DB, create the user and grant it the necessary permissions:

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost;
FLUSH PRIVILEGES;
exit

Install WordPress as usual, after that add the following two lines to wp-config.php:

define('FS_METHOD','direct');
define( 'WP_AUTO_UPDATE_CORE', true );

and set the permissions of the WordPress folder/files as following:

sudo find /path/to/wordpress/ -type f -exec chmod 664 {} \;
sudo find /path/to/wordpress/ -type d -exec chmod 775 {} \;
sudo chgrp -R www-data /path/to/wordpress/

To backup automatically the MySQL database, first create a .my.cnf and then chmod it to 600. The file must include:

[client]
user=mysqluser
password=mysqlpassword

Then add a CRON job as

mysqldump --defaults-file=/path/to/.my.cnf -u mysqluser databasename --add-drop-table -h host | bzip2 -c > /path/to/backupfile-`date +\%Y\%m\%d`.sql.bz2
Advertisements
Install WordPress under Ubuntu and enable automatic updates

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s