Most of you have probably heard of WordPress, it is free, open source software that is widely used by bloggers all over the Internet.
Here is a tutorial to help you install WordPress on your Ubuntu machine, whether you want to have your own self-hosted website or you just want to setup WordPress for testing purposes.
The WordPress itself, since the version 3.2, requires PHP 5.2.4 or greater and MySQL 5.0 or greater and we will be running it on top of the Apache server.
Therefore the first thing we are going to install is the LAMP stack, by using the following command (notice: the caret (^) at the end of the package name is part of the name, not a typo):
sudo apt-get install lamp-server^
Type your password if asked for it and respond with Y when asked to continue
Next, you will be asked to set a password for the administrative “root” user in MySQL (notice: this is not the Linux root user, but a built-in MySQL user, you don’t have to type your Ubuntu user password, you create a password of your choice for a MySQL root user), which you can leave blank or set one. Remember the password you set, you will need it in the next step for phpMyAdmin.
After the LAMP itself is installed we are going to install additional PHP5 mods needed so the WordPress can work smoothly with the following command:
sudo apt-get install php5 php5-gd php5-mysql php5-curl php5-cli php5-cgi php5-dev
Respond with Y when asked to continue
Now we finish the LAMP part of the installation by installing phpMyAdmin, which is a free software tool written in PHP, intended to handle the administration of MySQL.
We will install it with the following command:
sudo apt-get install phpmyadmin
Respond with Y when asked to continue and select apache2 when asked:
Select Yes when asked to automatically configure the database for phpMyAdmin.
Enter the password of the MySQL root user you have setup earlier.
On the next screen provide a password for phpmyadmin to register with MySQL (you can leave this blank and leave a random password to be generated).
Congratulations, you have just installed a LAMP server.
After we have installed the LAMP we can go on to installing the WordPress itself. We install WordPress with the following command:
sudo apt-get install wordpress
This will install WordPress into the /usr/share/wordpress folder, and we will create a symbolic link to Apache /var/www/ folder with the following command:
sudo ln -s /usr/share/wordpress /var/www/wordpress
We then finish the install of the WordPress on localhost with the supplied script inside /usr/share/doc/wordpress/examples folder.
Run the following command:
sudo bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress localhost
Go to http://localhost/wordpress and start making your blog.
We have setup WordPress for an address http://localhost.
If you are trying to access it from an another machine by different site name like http://your.ip.address/wordpress or http://ubuntu_server_hostname/wordpress you will get an error page saying that there are no config files for that address. You either have to set up Virtual host on Apache with a different domain name and then rerun the setup-mysql script for a name different then localhost, like,
sudo bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress ubuntu_server_hostname
Or you can bypass that by putting the ip address of your Ubuntu server in the hosts file, as the localhost entry, on the client machine from which you are trying to connect to your WordPress server.
You might also like
Filed Under : UBUNTU HOWTO