Installing Wordpress on Saturday 26th September 2015 ____________________________________________________ annedawson.net/wordpress.txt ad4.ca/wordpress.txt Last updated: Sat 26th September 2015, 17:12 AD https://en.wikipedia.org/wiki/WordPress Installing Wordpress Requirements --------------------------------- Mine is a Ubuntu LAMP server installation, so includes Linux Apache MySQL and PHP by default. https://wordpress.org/about/requirements/ On the server machine, check the server version: # lsb_release -a Ubuntu Server 14.04.2 LTS trusty (AD4=ad4.ca) # php -v gives PHP version of 5.5.9 # mysql -V gives MySQL version of 5.5.44 I need to make sure I have the latest software so do a server upgrade... # apt-get update (see below if update URLs not found and update fails) updates only the package lists. To actually upgrade the packages you have to run: sudo apt-get upgrade or sudo apt-get dist-upgrade If URLs are not found when update starts - could be internet is not connected - or if it is connected, there is a DNS problem. This worked for me on server AD4: // *** Make sure DNS works first for updates: *** # echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null # a silent response means all OK Reference - read this below: http://askubuntu.com/questions/91543/apt-get-update-fails-to-fetch-files-temporary-failure-resolving-error -------------------------------------------- How to upgrade from PHP version 5.5.9 to 5.6 -------------------------------------------- https://www.digitalocean.com/community/questions/how-to-upgrade-from-php-v-5-5-9-to-v-5-6 http://askubuntu.com/questions/565784/how-to-upgrade-php-version-to-the-latest-stable-released-version-lets-say-how To upgrade to a newer version of PHP 5.6 on Ubuntu 14.04, you can use Ondrej Sury's PPA. He is one of the Debian maintainers of the php5 package. To add the PPA and upgrade your packages, run: sudo apt-get install software-properties-common (I did an auto remove of all old packages when prompted at end of this install (above) - there was a message about the grub boot file so I did a reboot (# reboot), but then when I issued the next command (sudo add-apt-repository ppa:ondrej/php5-5.6) - it could not find the ppa, so I redid this command to fix the DNS problem: # echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null and then when I issued the next command, all was well again) sudo add-apt-repository ppa:ondrej/php5-5.6 sudo apt-get update sudo apt-get upgrade (then did an apt-get autoremove) sudo apt-get install php5 php -v (now shows version 2.6) # lsb_release -a (gets the Ubuntu version) Ubuntu Server 14.04.3 LTS trusty (AD4=ad4.ca) Now I check that PHP is working correctly with my existing PHP code: http://www.annedawson.net/LAMP.html Everything is fine. mysql -V (gives distribution 5.5.44) To run WordPress we recommend your host supports: PHP version 5.6 or greater MySQL version 5.5 or greater https://en.wikipedia.org/wiki/MySQL#Versions So Wordpress requirements on my server are now met. ____________________ Installing Wordpress ____________________ http://codex.wordpress.org/Installing_WordPress Because I would like to install Wordpress to the /var/www/html (root) directory for the website, I must first do a backup of all directories and files in that folder first: So if my installation of Wordpress overwrites them, I can reinstate them. But according to this page: https://wordpress.org/support/topic/will-wordpress-installation-overwrite-files-in-my-main-directory you can have folders unrelated to wordpress in the root folder and they will be safe. But to be doubly safe - back them up to another folder first: Backup existing data -------------------- E.g. copy an entire directory, its subdirectories, and files: cp -R dirtocopy/ newdir/ e.g. cp -R data/ /var/www/data (data is created in /var/www) # cp -R /var/www/html /var/www/html_before_wordpress Download WordPress ------------------ https://wordpress.org/download/ At the date of this download (Sat 26 Sept 2015) the current version of WordPress is WordPress 4.3.1 and the archive file for Linux is wordpress-4.3.1.tar.gz (6.2 MB). This file was downloaded to my local machine and then I used FileZilla to transfer the file to /var/www/html on the AD4 server. I connected to the server using Putty from my laptop, and when connected switched to root user: sudo -s cd /var/www/html Unzip /var/www/html/wordpress-4.3.1.tar.gz ------------------------------------------ cd /var/www/html Then unzip the package using: tar -xzvf wordpress-4.3.1.tar.gz a wordpress directory is created within /var/www/html with 14 .php files, a text file an html file and 3 directories. Create the database and a user ------------------------------ See: http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install under the heading "Using the MySQL Client" $ mysql -u root -p mysql> CREATE DATABASE wordpress; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON wordpress.* TO "anne"@"localhost" IDENTIFIED BY "type anne's password here"; Query OK, 1 row affected (0.00 sec) (anne has already been set up as a MySQL user when the Ubuntu Linux server was originally installed) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> EXIT Bye $ Update the wp-config.php file with the database information set in the previous section --------------------------------------------------------------------------------------- # cd /var/www/html/wordpress # cp wp-config-sample.php wp-config.php # vi wp-config.php (update as per instructions here: http://codex.wordpress.org/Editing_wp-config.php#Configure_Database_Settings) // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wordpress' ); /** MySQL database username */ define( 'DB_USER', 'anne' ); /** MySQL database password */ define( 'DB_PASSWORD', 'put_password_here' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' ); enter security keys into wp-config.php as explained here: http://codex.wordpress.org/Editing_wp-config.php#Security_Keys I used the online generator to generate the random keys - see the link in the page above. http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install Step 4. Upload the files Move all files and directories from under /var/www/html/wordpress to /var/www/html # cd /var/www/html/wordpress cp -R * /var/www/html (that seemed to work :-) ) Run the Install Script ---------------------- http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install Step 5: Run the Install Script Point a web browser to start the installation script. http://174.1.132.246/wp-admin/install.php brings up the installation window. see email 26 Sept 2015 (wordpress label) Installation was a success, logged in successfully, then started customizing - tried to upload favicon.ico, and got this message: "Unable to create directory wp-content/uploads/2015/09. Is its parent directory writable by the server?" so of course I need to make the wp-content directory in /var/www/html with correct permissions for user anne. at present it is: drwxr-xr-x root root So: # cd /var/www/html # chown -R anne wp-content actually changing permissions didn't work. I found this: https://codex.wordpress.org/Changing_File_Permissions tried this: # adduser anne root didn't help See: https://codex.wordpress.org/Changing_File_Permissions "Some plugins require the /wp-content/ folder be made writeable, " tried this: cd /var/www/html chmod ugo+x wp-content Worked! now when in the WordPress Dashboard I can upload the favicon.ico file. Not sure if this is secure! When I go to a browser and go to ad4.ca - it goes to the default Apache index.html file and not to wordpress's index.php file. So I went to /var/www/html and renamed index.html as index.html.safe, and now when I go to ad4.ca, the browser displays my ad4.ca wordpress main page index.php. After doing all the above I found this: https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04 It goes into detail about permissions. Check it out before doing anything else! It talks about www-data www-data is used by wordpress - see here: http://askubuntu.com/questions/365087/grant-a-user-permissions-on-www-data-owned-var-www Here at Sat 26th September 2015, 17:12 AD