Simple Steps To Installing And Configuring A Website Using WordPress And Ubuntu
In this tutorial we cover how to install and configure WordPress on a Ubuntu server. I will assume you already have Apache, MySQL, PHP (LAMP), and phpMyAdmin running on your Ubuntu machine. This tutorial will help you get your own WordPress website running on your home network. If you are setting this up on a hosted service you will need to make sure you have your DNS already setup and use the domain instead of the IP address when configuring WordPress.
If you need help on setting up an ubuntu server or installing the LAMP stack on your ubuntu machine (desktop or server), check out some of the following articles.
How to install ubuntu 10.04 LTS as a web server:
How to install Ubuntu 11.04 as a web server:
How to install the LAMP stack on Ubuntu:
How to install phpMyAdmin:
What is WordPress:
WordPress is a free and open source blogging tool and content management system (CMS) based on PHP and MySQL. WordPress is currently the most popular CMS in use on the Internet. WordPress has a large number of themes and plug-ins available both free and paid. The community is very large so a lot of people are around to help solve any problems that may come up.
Below you will see what the default front-end looks like after a fresh install. The look and feel can always be modified with a different theme.
Here is a look at the defualt admin dashboard:
Once you have your ubuntu system setup with Apache, MySQL and PHP, logged into your system we can download WordPress to the /tmp directory.
Change to the /tmp directory by using the cd command.
Note: Files in /tmp will be deleted when the system is rebooted. This should not matter as long as you don't reboot your machine before coping your downloaded files to the needed location.
Download the Wordpress zip package using wget.
Note: Wordpress always has the newest release called latest.zip so the command above should always pull the most current version.
By default ubuntu does not have unzip installed by default, we will need to install this so we can unzip the WordPress zip file (latest.zip).
sudo apt-get install unzip
Enter your password
Unzip the wordpress (latest.zip) file.
You should now have a folder called wordpress. Let's change into that directory.
This tutorial is assuming this is a fresh web server and no other websites are running on it. We will copy the files to Apache's root directory /var/www/. If you do have other websites running you can create a directory inside /var/www/ and put your wordpress files inside that directory. Make sure you adjust the steps below to fit your needs if you already have sites on your server.
If you are not sure if other sites are running on your machine you can use the ls commnd to list the files in the /var/www/ directory. The only file you should see is index.html, which is a default file used to test Apache.
Before we copy the contents from the unzip wordpress directory we will want to remove the test index.html file. (Note: Only run the next command if you don't have any other websites running on your server.)
sudo rm /var/www/index.html
Now let's copy our files to the Apache root directory /var/www/. (Issue the following command inside the wordpress dir)
sudo cp –r * /var/www/
Since we used the sudo commnad the owner of the files will be root. We will need change the owner to the wp-content directory to www-data (Apache User and group). This will allow us to have permission to upload files, download themes and plug-ins from the admin interface.
sudo chown -R www-data:www-data /var/www/wp-content/
Creating A MySQL database and user:
WordPress use a database to hold all the websites data and user information. We will set this database up using phpmyadmin.
To access phpMyAdmin you will need to know the IP address or domain name of your server. In my case it is 192.168.11.198
If you want to use a domain name on your home network you can add a static entry on the machine that will be accessing the site. Another option is to setup an internal DNS server so you don't have to manually set it on every device on your network. Check out http://mixeduperic.com/ubuntu/seven-easy-steps-to-setting-up-an-interal-... on how to setup internal domain server on your home network.
One other note. It is a good idea and best practice to have your server setup up with a static IP address. For steps on how to do this check out: http://mixeduperic.com/ubuntu/how-to-set-a-static-ip-address-on-a-ubuntu...
Open your browser and enter the the IP address or domain name of your server followed by /phpmyadmin
login to phpmyadmin
Click on the Privileges tab
Click on the Add a new User link (Located in the middle of the page)
Create a user name for your database
For Host enter localhost
I use the generate password option since you only need to use this password once during the setup of your site.
Note:If you use the generate password option make sure you copy or write down the password that was generated sinc we will need that in a few steps.
Scroll down to the section that says Database for user and select the Create database with the same name and grant all privileges.
Click the Go button at the bottom of the page
We now have the database created.
Tip: phpMyAdmin is a great tool but can also be a target for hackers and bots for brute force attacks. You can add an extra layer of security to phpMyAdmin by only allowing access from a specific IP address. Check out the following tutorial on how to do this: http://mixeduperic.com/ubuntu/how-to-restrict-phpmyadmin-ip-address.html
We are almost ready to start creating content to our new site. We just need to make a few configurations.
Open your brower and type the IP address or domain name followed by /wp-admin/install.php.
Click Create a Configuration File
Click Let's Go!
Enter your database name (If you followed the steps above it should be the same as the user you created)
Enter your database user name.
Enter the password you generated or created above in phpMyAdmin.
You will now see a message saying that it could not create the wp-config.php file. We will want to copy the code and then we will create the wp-config.php file to put this code in.
Let's jump back to the terminal of the ubuntu server and create that file using the nano text editor.
sudo nano /var/www/wp-config.php
Paste the code provided to you from the web installer into this file.
Hit CTRL + X to exit nano
Enter "Y" to save the file
Hit Enter to finish saving the file as /var/www/wp-config.php.
Jump back to your brower and click Run the install
We are now to the easy part. We just need to create a name for the site, an admin user and password and define if we want the site to be index from google. If this site is host on your home network and is not exposed to the internet with a port forward, google and other search engines will not see your site so they can't index it.
Below is an example of my configuration.
Click Install wordpress.
You should see something saying success!
You can now login with the username and password you just created.
To administrat your WordPress website you can access the admin login with /wp-admin.
You should now have a basic website ready to create content. To setup clean URLs using permalink settins in WordPress check out http://mixeduperic.com/ubuntu/5-simple-steps-to-configure-wordpress-to-use-permalinks-on-an-ubuntu-server.html
If you enjoyed this post, please share it on your favorite social network by clicking on the “Share / Save” bar below.
Other useful articles:
How to change the default SSH port on Ubuntu:
How to start and stop Apache web server and MySQL on Ubuntu:
Monitor Apache web logs in real time with apachetop