In this article we will see how to install WordPress locally on your computer, especially with Windows operating system and package EasyPHP. In this way you will be able to develop and test your blog without having to access the Internet. Pre-requisites: On Linux platform, you must have already installed Ubuntu, the LAMP suite (or equivalent eg. XAMPP) and administration tool phpMyAdmin (already included in the packages above). We will follow two paths, the first for a new installation of wordpress, or without the presence of a legacy database and the second to export our existing wordpress blog, so with an existing database.
1 Clean installation of WordPress locally
First you need to grab WordPress. You can download the latest version from here.
At this point we must prepare the database for WordPress. To do this, make sure you have booted adi apache server and mysql in this order, and open a session of Firefox.
Therefore launching the tool phpmyadmin by typing the URL into the address bar http://localhost/phpmyadmin (or refer to the package installed, eg. EasyPHP if there is already prepared the link to click to start the tool should be of http://127.0.0.1/home/mysql/)
Now named “wordpress” your database and click Create: At this point we only have to install WordPress, after downloading the latest version is necessary to extract the contents of the zipped folder www, reached by following this path: C: \ Program Files \ EasyPHP 2.0b1 \ www done this, type the following address in the navigation bar of your browser: http://127.0.0.1/wordpress/wp-admin/setup-config.php?step=1 Fill form as shown in this image (leave the password field blank) and click Submit: You are now ready to proceed with the installation and perform your test: http://127.0.0.1/wordpress/wp-admin/install. php
2nd Installation of WordPress with the local export of a legacy database
Concerning the prerequisites are the same as the first method, which we have already installed a package lamp, type EasyPhp with Apache and Mysql assets.
Get to the most important (you should already performed with some regularity, at least for the database, which contains data that does not want to lose): The backup of WordPress.
This should already know how to do if you were you to install WordPress! Using the same program that you start your blog loads on the server (eg for Windows – and more recently, also for Linux and OS X, though still in beta, gFTP for Linux – Debian / Ubuntu , just the usual apt-get install gftp, and for Mac OS X), download the entire contents of the directory containing wordpress (including subdirectories) in a local directory.title=”Filezilla download page (scroll down to the Linux and Mac)” href=”http://sourceforge.net/project/showfiles.php?group_id=21558″>title=”Home page and download page of the project” href=”http://cyberduck.ch/”>
Database Backup (dump file)
You can use the web interface phpmyadmin (provided by whom we usually host) or, if our hosting service supports it, plugin for WordPress (which should overcome the limitation on the size of the backup file – or dump – imposed by phpmyadmin).
Simply copy the backup files in the Document Root in Apache and usually this is it:
- in / var / www / Linux I suggest you create, as root, a sub-directory, such as WordPress, and, again as root, give her permission to read and write to all users:
$ On (or sudo -s to Ubuntu) # cd / var / www # Mkdir wordpress # Chmod a + rw wordpress
This allows you to copy files under wordpress as normal user (I repeat, these instructions are only for personal use, not follow them if you need to set up a production server!). To access it from browser, type the address http://localhost/wordpress (but do so only at the end).
- in Applications / XAMPP / htdocs under Mac OS X, even here recommend creating a subdirectory wordpress. The address will http://localhost:8888/wordpress;
- in c: \ EasyPhp \ www \ under Windows, as above, copy the backup to a subdirectory (eg wordpress). The address will http://localhost:8888/wordpress.
Subdirectory under the document root, where you copied the backup, duplicate the file wp-config.php in wp-config.php_remoto and now changed the first lines of wp-config.php as follows:
define ( 'DB_NAME', 'insert-here-his-name'); / / The name of the local database (probably will call it as it is called remotely)
define ( 'DB_USER', 'root'); / / Your MySQL username
define ( 'DB_PASSWORD', 'root'); / / ... and password - it will probably be This is the root password, unless you are being asked during install mysql
define ( 'DB_HOST', 'localhost'), / / 99% chance you will not need to change this value
Save and then duplicate again the file wp-config.php in wp-config.php_locale (that way you can go from local to remote – and vice versa – simply by restoring the files _remoto and _locale). I recommend you to enter a password, many times the error of incorrect connection to your database depends on a mistaken reading of the blank password!
Import the database
Come to the last step before being able to access our local copy of the blog.
Edit the dump database
This is the most important part, which allows you to navigate the blog using the local area and not remote. With this step, for example, will not have to manually change the path to all images you’ve uploaded to your blog and then inserted into various places. It operates on the backup file, so it is important that this step precedes the actual import. First, if the dump is being downloaded in compressed format, you must unzip it, then, should be replaced with a text editor, all occurrences of the remote URL (eg http://techlog.netsons.org) with http://localhost/wordpress. Council to save the dump amended in another file, so as to still have a good backup if something goes wrong (Murphy is always listening! ). Note: The next recommendations are also valid in case you want to transfer your blog to a new hosting service, simply enter the new URL in place of the local.
Linux and Mac OS X
With Linux and OS X just one command! After having moved with the terminal (the OS X is located in Applications / Utilities) to the directory containing the dump file (for example, dump.sql), enter as normal user:
$ sed-e 's REMOTE_ADDRESS ^ ^ ^ LOCAL_ADDRESS g 'dump.sql> dump_local.sql Following the example so far, the command will be:
$ sed-e' s ^ ^ http://techlog.netsons.org http://localhost/wordpress ^ g 'dump.sql > dump_local.sql
You must use a text editor, so no Word or Wordpad (you can also use it, but you have to choose the format “text only” when you go to save). Usually, simply use the function Find / Replace editor. To replace strings on very large files (like it could be your dump file), you can use a text editor like Notepad + +
Import the dump file amended
Now just enter phpmyadmin on the local computer (usually in http://localhost/phpmyadmin – the address is different for Mac OS X), click Import and select the file dump_local.sql previously amended.
After restoring the backup, you must rebuild the structure of the permalinks for WordPress: just go to http://localhost/wordpress/wp-admin (add port: 8080 after localhost if you’re using OS X), navigate to Options / Permalinks and press the Update Permalink Structure (no need to change anything, the problem is resolved Permalink too). This obviously also applies if you are transferring from an old server WordPress to a new one. Finally your copy, fully working locally, on your blog!