How to set up a local Wordpress site?
I want to create a site based on Wordpress that is only accessible from my own machine (localhost). In other words, I do not want my computer to be a server. I just want it to have all the files necessary for a website in /var/www/
, so that I can later copy-paste those files an another machine which will be a server.
Therefore I installed the wordpress package and I am about to install a graphical interface to manage the files. What should I do? Do I need somthing called LAMP?
I have seen this question on WordPress Answers, but I wonder if someone could provide instructions that are more Ubuntu specific or easier to follow, especially if they are relevant to the Unity interface.
Solution 1:
You can use sudo tasksel
to install a local LAMP server.
After selecting LAMP you can install it (you may need to scroll down the list to find the 'OK' button) and while installing, tasksel will ask you for the password for the MySQL installation (which is very important not to forget!).
Then you can open your browser and type http://localhost
and you should see It works.
Solution 2:
2016 solution
A very good guide can be found from mentioned urls at the bottom. Here is a breakdown for you,
install mysql
sudo apt-get install mysql-server php5-mysql
Install Apache
sudo apt-get install apache2 libapache2-mod-php5
after installing mysql and apache you should get localhost up and running. Try to check/verify from browser by typing localhost
as a URL. Now, lets get started with WordPress installation.
Installing WordPress
cd /var/www/html
sudo wget http://wordpress.org/latest.tar.gz
sudo tar zxvf latest.tar.gz –strip-components=1
(use sudo) if required.
Then using the sudo command set the permissions so you will be able to modify the files and allow the web server to access them as well like this:
sudo chown -R www-data *
sudo chgrp -R www-data *
After all of this, It's time to create database in mysql, i will show a short way to do it ;)
mysql -u root -p
mysql> CREATE DATABASE wordpress;
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO “wordpress”@”localhost” IDENTIFIED BY “foopassword”;
mysql> FLUSH PRIVILEGES;
mysql> EXIT
Don't forget to do necessary changes such as username and database name change according to your desire. After doing mysql thing, Rename the wp-config-sample.php file to wp-config.php from your wordpress folder and using your favorite text editor you will need to add the name of your database, mysql username and password to the config file.
If you had follow the instructions correctly, then its your lucky day :)
you can now simply browser your wp site by navigating to localhost/yourfoldername
Reference Urls:
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04
http://linoxide.com/ubuntu-how-to/ubuntu-apache-php-mysql-wordpress/
Solution 3:
First install XAMPP, then unzip wordpress.zip and change permissions. It should be made writable. Do not edit config-sample.php
file.
Create a database using PHPMyAdmin, then move the unzipped folder to xampp directory. Start XAMPP, open up your web browser and type localhost/xampp/wordpress/wp-admin/install.php
.
Follow the instructions. Leave the password field empty and database prefix empty.