Step 1: Install apache2:
sudo apt-get install apache2
Step 2: Install mysql:
sudo apt-get install mysql-server-5.5
Step 3: Install php5
sudo apt-get install php5 libapache2-mod-php5
Step 4: Test installation:
Step 5: Install the MySQL Module for PHP
sudo apt-get install php5-mysql
Step 6: Create database workpress
Login mysql: mysql -u root –p
CREATE DATABASE wordpress;
CREATE USER wordpress_user;
SET PASSWORD FOR wordpress_user = PASSWORD(“wordpress_pass”);
Grant all privileges to access the database:
GRANT ALL PRIVILEGES ON wordpress.* TO wordpress_user@localhost IDENTIFIED BY ‘wordpress_pass’;
NOTE: To end command, you must be semicolon (;).
Step 7: Install wordpress.
Step 8: Configuration wordpress:
- open wp-config-sample.php file and modify such as:
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpress_user');
/** MySQL database password */
define('DB_PASSWORD', 'wordpress_pass');
- And then save it with name wp-config.php.
Step 9: Now, open web browser and browser to http://localhost/wordpress to see result.
If you see this error: Error Establishing a Database Connection. It means you have done something wrong.
DONE.
Source: install-wordpress-locally-on-ubuntu-desktop