Where to find pre-installed virtual machines for local WordPress testing under Virtualbox?

Hello friends,

If you remember our post about virtual machines running under Virtualbox then you are probably wondering if it is possible to find pre-installed solutions that you can import and start using for local WordPress tests.

The great news is that this is possible. In this post I will show you where you can find pre-installed virtual machines for local WordPress testing under Virtualbox.

If such solutions exist, should I use them instead of configuring an Ubuntu (or other) server under Virtualbox by myself?

In terms of local testing – yes. But if you are aiming to use them for other purposes, I’d advise to either start installing or configuring the server by yourself or at least to check the configuration of the pre-installed solution and improve it if necessary. For production servers, based on virtual machines, I’d advise to seek for assistance from an experienced system administrator. Let’s not forget to mention that there are far more advanced solutions than Virtualbox for this purpose (for example Open Stack).

The reason that I am giving you this advice is because the pre-installed solutions are meant to save you time and effort. This may be enough for local testing in most cases, however for other purposes these virtual machines might lack in security. Also even for local WordPress testing you may need to configure them additionally in order to make all of your plugins function correctly.

OK, where can I find these pre-installed virtual machines?

Some of the machines contain only a Linux distribution without any additional configuration. These machines are meant to remove the need to make a new installation and basic configuration. Once you download them and import them in Virtualbox you can install and configure LAMP so that you can run WordPress locally.

Such machines can be found from OSBoxes (click to visit). There you can find images for both Virtualbox and VMware. Select the distribution that you desire to use and then follow the instructions provided on the website. You will find out the username and the password that were created for the virtual machine.

Here is what you need to do in order to use the machine: Add a new virtual machine in Virtualbox. Select the appropriate distribution and then follow the wizard until you reach the section that asks you to either create a new virtual disk or to use an existing one. Simply point the VDI or VMDK file that you have downloaded from OSBoxes and complete the virtual machine configuration. Once you run it you will get a pre-installed Linux with graphical interface. For additional configurations you need to update the distribution and also install VirtualBox Guest Add-Ons. Then you need to install and configure LAMP.

Other solutions provide LAMP Stack in a pre-installed virtual machine. Once you import/add them in Virtualbox you need to follow additional steps and apply a few settings and then you will be able to configure your databases and run WordPress locally. Turnkey Linux provides such machine. You can download it from here.

Finally there are solutions that even contain WordPress within them and you can start adjusting the sample local site right away. Turnkey Linux has such a machine which can be downloaded from here.

Another option is to use a Bitnami virtual machine. You can grab one from here.

From this website you can download another pre-installed WordPress virtual machine.

So there you have it friends. Will you use pre-installed virtual machines or will you try to configure your own one? Share any thoughts on this topic in the comment section below. If you have any questions – we will be happy to assist you.

See you soon, friends!

7 ways to improve your WordPress On-Page SEO

Hello friends,

One very important aspect of SEO is the On-Page SEO. I even dare to say that it is the most important aspect. Some fellow digital marketeers would disagree by placing their faith on the Off-Page SEO which aims mainly on link-building. However as much as the latter is needed for better ranking, the lack of great and optimized content will reduce the value of your website in the visitors eyes. Let’s not forget that link-building is a double-edged sword. Why? Because in some cases it might ruin your SEO strategy due to a penalty by the search engines. And I believe that none of you wants this, right?

That is why in this post I will share with you 7 ways to improve your WordPress On-Page SEO. Let’s begin!

#1 – Choose a hosting provider that can guarantee you speed and high-quality backups

WordPress is great – we all know this. However some WordPress websites can grow into memory and CPU eating monsters. It happens quite a lot – especially if you are using low-quality plugins or plugins that are not working correctly with one-another (a.k.a. incompatible plugins). And while plugin management is your responsibility it is also important to rely on a high-quality hosting provider. This will ensure that your website will simply work. So the first thing to do is to check if your hosting provider gives you the quality you deserve and if not, it’s a good idea to migrate your website to another one. It’s also very important to have backups performed by your hosting provider. Additionally you might want to check some WordPress backup plugins like the ones that we have reviewed on TheCMSPlace. Check them out from here.

#2 – Create useful content with suitable selection of keywords and phrases

Without a proper keyword research your content will have little chance reaching a wider audience . This means that your SEO campaign is vital for your business. That is why you need to research all suitable keywords and phrases and use them wisely in your content. This will ensure that your target visitors will find your website in the search results. You should consider using tools like Open Site Explorer or Ahrefs for keyword research.

But having a bunch of suitable words and phrases is not the only thing that will make your content great. Let’s not forget that over-optimization with keywords is very bad for On-Page SEO. You have to use these words moderately in your content. In order to make it great, it has to be also useful and specific. This means that you have to write about topics that are strictly related to the main idea behind your website.

Great content can provide additional value to your visitors. For example a “how-to article” in which you describe the usage of a product will be extremely valuable. Also you have to make it user-friendly by writing in a style that is best accepted by your target group of visitors. Therefore it is imperative to know your audience and their needs and desires.

Last but not least – watch your grammar and punctuation and never forget that content is (and always will be) king!

#3 – Use SEO plugins

These WordPress plugins will make it extremely easy for you to manage your On-Page SEO. They will help you add all the important meta elements to your posts and pages and also to place suitable keywords and phrases in all applicable places so that your website will be crawled and indexed better. Also such plugins will allow you to optimize your content for social media as well. One of the best solutions that is suitable even for beginners is YoastSEO.

#4 – Optimize your images and multimedia

There is nothing worse than a bunch of large, unoptimized images and other multimedia content that make your website slow as a turtle. And this is something that you simply don’t want! Lucky for you we have an awesome collection of extremely easy-to-use tips for optimizing your images. Check it out from this link.

#5 – Improve your website internal and navigation links

WordPress is the king of creating internal links out-of-the-box! This is achieved with the awesome tag and category systems. By using them wisely you will get many internal links between related content. And having more of them is essential for On-Page SEO as it improves the crawling process of your website. Consider using plugins for related posts. They will automatically create even more internal links between posts with similar content.

Here are some great suggestions:

Now let’s focus on navigation. WordPress is equipped with a powerful menu system that allows you to create flawless navigation that will allow the visitors to reach the needed content quite easily. What you might want to do is to create a strategy for improving your WordPress navigation by:

To do this you have to make an audit of your pages and posts. You can use tools like SiteLiner or Screaming Frog. Choose posts and pages that contain great content and allow your visitors to reach them by using the navigation system of your website. Also consider using plugins like WP-PageNavi in order to achieve even better results.

Lastly – always check for broken links and if needed apply 301 redirects.

#6 Use the nofollow and noindex meta elements wisely

These two meta elements are very important for SEO. The first one is used when you want to tell the search engine bots not to follow a link that you have created. The second one tells them not to index the current post or page. In most cases you’d like to add a nofollow attribute to each external link (except the ones that you are sure that you want to share link juice with) while trying to keep the all internal ones “dofollow”. However there are cases in which you’d want to add nofollow attribute to some internal links as well. Based on the results from the content audit from the previous step, you should apply this to all links that point to pages/posts with little or low-quality content. Also you can set some pages to “noindex”. By doing this you can ensure that the PageRank flow will be distributed only between the most important parts of your WordPress website.

#7 Use caching plugins

W3 Total Cache, WP SuperCache or some other high-quality solution like ZenCache will boost the speed of your website. This means that the visitors will get to view your pages faster and also your hosting server won’t get overburdened. Also make sure that you have taken care of your .htaccess file by optimizing it additionally. This will ensure even better On-Page SEO results.

These are my 7 ways to improve your WordPress On-Page SEO. What do you think about them? Share any questions or feedback in the comment section below and share this post is social media as well.

See you soon, friends!

*Image source – Pixabay

Migrate, backup or clone WordPress with Duplicator

Hello friends,

Sooner or later we might have to consider moving our website to a new location. There are various reasons for this decision but the most important one is that we are somehow not happy with our current hosting provider and we have found a more suitable one.

When this happens we have to make a complete clone of our WordPress website. This applies for both directories, files and database(s). This new clone has to be placed on the new host and then additional settings have to be made in order to use the domain on the new location (DNS settings, forwarding, etc). The latter are not WordPress related so let’s assume that you have already discussed these with the new hosting provider and you have applied them according to the instructions that you have received from them.

So the main question remains – how to clone WordPress in order to transfer it to the new hosting location?

In this post I will present to you one of the suitable solutions for this purpose. This is the plugin “Duplicator”.

Duplicator - WordPress Plugin for backup, cloning and website migration

What does Duplicator do?

Its main functionality is related to everything described above – cloning a WordPress website so that it may be transferred to a new hosting or even a new domain. However this plugin is much more powerful than this. It may be used as an excellent backup tool and thus you can be sure that your data is always protected in case of a website failure or some other problem (for example hacking).

How to work with Duplicator?

Before we begin with these instructions, I need to inform you that this plugin comes in two versions. One is 100% free and you can download it right now from WordPress.org. You can also install it directly on your WordPress website by using the plugin installer to search for Duplicator. Then you have to activate it and start using it. The review will cover the free version. However there is a PRO version of Duplicator which provides you with much more options and features. You can find information about it later on in this article.

So, now that you know how to get Duplicator working on your website, let’s see how to use it.

First of all you need to head to your WordPress dashboard and click on the Duplicator menu. From there you can see two tabs. One is called “Packages” and it lists all of the cloned copies that the plugin has created.

Duplicator Package Management

You will be able to manage these packages similar to the way you manage your WordPress posts and pages. Here you can see details about each clone copy, its creation date, file size and name.

The options are:

The first option allows you to download an installer file in PHP format that you need to upload to your new location. The second contains the actual data (database and files) of your current website. You need to upload this file once again on the new location.

There are bulk options here available as well. The details view for each package provides you with the possibility to view the version number, the user that has created it, the Hash number of the package and some notes (if any are available). You can also get links for the package, its SQL file and view the log.

The second tab (Create New) allows you to create a package. This process passes through 3 steps: Setup, Scan and Build.

Duplicator - Package creation

In the first step the creation wizard will ask you to provide a name for the package and some notes (if you want). Then you can choose the file format for the Archive and apply some filters for the files. You can adjust some options regarding to the Database as well.

Then you can adjust some options about the Installer file as well and when you are done you can proceed with Step 2. Bear in mind that you may actually leave the default options (for both Archive and Installer) if you don’t want to apply any settings.

When done you need to click on the “Next” button in order to start Step 2 – Scan. You are also able to skip this step if you want. You may also reset any settings that you have made on Step 1.

Clicking on the “Next” button will initiate the scan procedure. You will be able to monitor its progress and when it’s done you will be presented with a full overview of the package. This consists of information related to the server status, archive file, database file. For the server settings you may apply diagnostics in case some problems are shown in the overview. You are also able to rescan your website or even go back to Step 1.

In case you are happy with what you see on the overview you need to click on the “Build” button. This will start Step 3 and will actually build the package and the installer file. Once again you can monitor the progress and when Duplicator is done you will see that the process is completed as well as the name of the package and the time it took to build it.

You can also download the installer  and the archive files directly from this screen.

In order to move your website to a new location, you have to upload both files and then access the installer.php file from the URL. For example let’s assume that your new domain is newdomain.com. The URL for the installer file should be:

newdomain.com/installer.php

Then you have to follow the instructions. Again you will pass through 3 steps – Deploy, Update and Test. When done your website will be transferred successfully on the new domain and/or hosting.

Duplicator - Installer for migrating the clone package to a new location

Duplicator also has some settings that you might want to check out.

For detailed explanation of how Duplicator works you may watch this video:

What is the difference between the free and PRO version of Duplicator?

Huge! The free version is quite limited to smaller file sizes and basic cloning operations. The PRO version provides you with much more power. These differences are described in details here: Versions comparison page.

So what do you think of this plugin, friends? Would you use it? Share your thoughts in the comment section below and spread the word about this post in social media as well.

See you soon!

*The images are embedded from the WordPress.org page of the plugin

WP Smush – review

Hello friends,

In this post I will make a review of one the finest solutions for reducing the file size of all images on your WordPress website.

This solution is called WP Smush.

Why should I use such a solution?

Mainly for On-Page SEO and User Experience purposes. If all your images on your WordPress website are hosted on the same server as the site itself then each time a page is loaded they are loading as well. So let’s imagine the following situation for a moment, shall we – you have a blog post with several images, each more than 1 mb in file size. When a user opens this page all its content, including these images are being downloaded and displayed. If the user’s internet connection is poor or is lacking speed the images will either be displayed incorrectly of will be loaded extremely slowly. This might cause the user to leave the page without even reading what’s on it. Now imagine that there is something extremely valuable for all users on this page. You have just lost one potential follower and you failed to help one user.

And if the user is on a mobile internet plan, you will be wasting their own traffic. This might cause the user to pay a larger bill and never to return on your website ever again! You don’t want this, right?

Also the next reason why you want smaller images in terms of file size is because you don’t want to spend all your traffic bandwidth for nothing. The hosts are monitoring this and they are providing limited traffic for most of their hosting plans. So unless you want to spend more money on a plan that you simply do not need, just reduce the bandwidth by reducing the file size of all your content, especially the images.

And last but not least – storage space on the host. Again if you can manage to store your website on a smaller storage space, you simply do not need to spend more money for bigger one. All you have to do (once again) is to reduce the file size. Simple, right?

OK, but why WP Smush?

Because it is fast, easy and it is integrated in your WordPress website. Also this plugin works flawlessly and helps you for the reasons stated above. By using WP Smush your images will be kept at minimum file size, the loading speed will be drastically increased as will the overall performance and you will be improving the score on your On-Page SEO.

Also WP Smush is free and it is powered by the also free WPMU DEV WordPress Smush API.

How can I use it?

Install the plugin by either uploading it to WordPress or by searching for it within the “Add new” plugin installer. Then activate WP Smush and finally head to Media -> WP Smush in order to make some adjustments.

You can Auto-Smush images on their upload or Super-Smush them if you purchase WP Smush Pro (continue reading for more information about this version). You will also be able to optimize all your WordPress images by using advanced lossless compression. WP Smush works with different file formats. You can optimize without any problem: JPEG, GIF and let’s not forget about the PNG image files.

You can also manually reduce the file size for each image in the WordPress Media Library which is quite useful for older images that were uploaded before you have started using WP Smush. In case their number is great you can bulk optimize them by running WP Smush on 50 images at once. All images that are under 1 mb and smaller will be optimized by this wonderful plugin.

OK and why I might want to purchase WP Smush Pro?

Because you will increase the optimization power of the plugin and thus receive more benefits: better performance, better loading speed, even greater file size reduction and more.

WP Smush Pro is equipped with a powerful arsenal such as Super Smush which will reduce the file size of your images by applying an intelligent multi-pass lossy compression. Thus the images will be compressed twice as better than the average lossless compression and all this without any quality loss. This is achieved by improving the lossless compression itself.

Also if you have images larger than 1 mb (it sometimes happens, unfortunately) WP Smush Pro will be able to handle them without any hassle because this version of the plugin can work with file sizes up to 32 mb! And if you don’t want to wait for the processing of 50 images at a time you can do this with the professional version of WP Smush. You will bulk optimize your entire WordPress media library at once with just one click! Simple as that!

Also backup! You know that this is important, right? Well WP Smush Pro keeps a backup for each processed image in case something goes wrong or you might need the unoptimized version for some reasons. You can restore all images to their original state at any time.

And last but not least – support! You can rely on WPMU DEV at any time for any reason.

See this video for more information:

https://www.youtube.com/watch?v=GCzH7z05s5U

So would you use WP Smush, friends? And what about giving WP Smush Pro a try? Share your thoughts in the comments below. Do you know any other ways of optimizing images on WordPress? Feel free to discuss them with us as well.

See you soon, friends!

WordPress Backup with BackUpWordPress

Hello friends,

We are back on the backup topic for WordPress. You already know two awesome ways of saving your precious database and files with BackWPup and All-in-One WP Migration which can also be used as a tool for moving WordPress from one host to another.

Now it’s time for another great solution. It is called BackUpWordPress and it will save you not only time, but also effort when it comes to creating backups.

Let’s start with the usual steps and that is installation and activation. What you will find interesting is that when you are done with these steps you won’t need to make any settings in order to receive your first backup. Why? Because the plugin comes with pre-configured scheduled daily and weekly backup tasks.

Let’s see what you get completely out-of-the-box when you go to Tools -> Backups:

The default daily backup is for the database only and it is located under the Database Daily tab. You may change it if you desire by clicking on the “Settings” link. Then you can either transform it to another backup type (for example files and database or only files) and change whether this should be a daily schedule or maybe weekly or monthly.

The default weekly backup schedule is a complete one and it will make a copy of your database and your WordPress files. It is located under the Complete Weekly tab. Again you may change its settings and re-transform it for your specific needs.

Each of these backup types can also be deleted by clicking on the red “Delete” link. Also you may run all of them now if you are in a hurry. Just click on the “Run now” link and you will get your backup now.

For the complete backups you can make a list of excluded files and folders. Click on the “Excludes” link and make your settings.

BackUpWordPress will inform you in which directory you will find your backups. You will also be presented with an option to download them from the plugin menu in your dashboard under the completed backups section for each backup type. There you can also manage your completed backups by deleting the ones that are no longer necessary.

You can also create as many scheduled backups as needed. You can do this by going to the “Add Schedule” tab.

You can also set an e-mail address on which you can receive a notification about the completed backups.

As for the different backup types you can set different options. For example in the monthly backup you can determine the start day of the month and the start time for the scheduled monthly backups.

Great, right?

OK this was the free version of the plugin. BackUpWordPress however allows premium purchase of additional options such as backup to Dropbox, Google Drive, Amazon S3, Rackspace, Azure, DreamObjects and FTP/SFTP.

Now to the most important question – how to restore the backup if needed?

Well, I will be completely honest with you on this one. BackUpWordPress lacks the functionality to allow you to restore your WordPress site to an earlier state. So basically you need to download the backup zip file, unzip it and them overwrite the files and folders on your server by using an FTP software (be careful of the permissions for each file and folder). As for the database, you need to enter your host’s phpMyAdmin or other suitable database management tool and restore it there. More on this topic you can find in the official WordPress Codex: Restoring Your Database From Backup.

But despite of this downside, BackUpWordPress is still a great backup tool that can help you protect your website in case of a major failure.

So what are your thoughts, friends? Will you be willing to give this plugin a try? Share your opinion in the comments below.

See you soon!

Shared Hosting or VPS?

The answer of this question is rather easy. First, we have to know what shared Hosting and VPS is and what are their positive and negative sides.

Shared Hosting

Shared hosting is the most popular service offered by the hosting companies. Your website is being hosted on a dedicated server with hundreds other websites. You have access to your website through Control Panel – usually CPanel or Plesk and you have some sort of limitations regarding the services you use (disc space, bandwidth, inodes etc.)

The Shared hosting is suitable for people who are just starting their websites or don’t have the knowledge to run a VPS or afford a managed one. Shared hosting is suitable for entry level websites with low traffic .The reason behind this is that your website is hosted with many others and they are all fighting for the same resources. Also, if you require custom server environment shared hosting is not for you. One of the pros for using it is that Hosting companies provide support for their clients through tickets and telephone calls. As for the VPS this is only available for the managed versions.

VPS (Virtual private server)

A VPS is a standalone instance with its own dedicated resources which you don’t have to share with no one. The two most popular and used pieces of Software for virtualization are OpenVZ and Xen.

The Hosting providers are offering two kinds of VPS – unmanaged and managed ones. In the unmanaged version you get only the VPS with the installed Operating System. Some of the providers are also offering prebuild solutions like LAMP and LEMP. It’s your own duty to support and manage your VPS instance. In order for you to be able to manage the unmanaged version you’re going to need extensive knowledge in Linux LAMP (Linux, Apache, MySQL and PHP) or LEMP (Linux, Nginx, MySQL and PHP).

When you order a managed VPS you get a working instance of your virtual server and the support that comes along with it. You receive a Control Panel so as to be able to administrate your VPS and to manage your websites. This makes the managed VPS a better option for users who need the added power and convenience of a VPS and who don’t have the knowledge to administrate a VPS on their own. The managed version of VPS costs double and triple the price of a unmanaged version but it saves your time and allows you to devote it on your website.

To sum up, when you choose between Shared Hosting and VPS you have to evaluate several factors:

1.       Whether you are experienced enough in the field of hosting.

2.       What kind of resources you need.

3.       What budget you have.

4.       Whether you are willing to invest your time in managing your own VPS.

Installing WordPress on Ubuntu LAMP

In this tutorial we are going to install a wordpress website on a LAMP stack. WordPress is the most used CMS worldwide so it’s a great pick for testing our LAMP configuration. If you don’t have a LAMP stack installed you should check this article-Installing LAMP on Ubuntu

Create a database and a username in MySQL

First we need to create a database and a user corresponding to it in MySQL. In order to do that we need to log in to the root administrative account in MySQL. Type the following command:

mysql -u root -p

You’ll be asked for the password for the MySQL root user. Enter it.

Now you have access to MySQL. We are going to make the wordpress database. Use this command

CREATE DATABASE yourdatabasename;

We have to make a MySQL user for the database that we have just created and assign it a password.

CREATE USER yourusername@localhost IDENTIFIED BY 'yourpassword';

Now we have to assign the newly created user to our wordpress database. In order to do that just type:

GRANT ALL PRIVILEGES ON yourdatabasename.* TO yourusername@localhost;

We have to flush the privileges in order for MySQl to know that we have made changes

FLUSH PRIVILEGES;

We can exit mysql

exit
Download WordPress

In order to download the most recent and stable version of WordPress type the following:

wget http://wordpress.org/latest.tar.gz

This will download a compressed file containing the wordpress installation files and folders. We have to extract those files into our home directory.

tar xzvf latest.tar.gz

We have to install some additional modules in order to be able to install plugins in WordPress using our SSH login credentials.

sudo apt-get update sudo apt-get install php5-gd libssh2-php

Move WordPress files to Document root

In order for your website to be accessible you have to move your wordpress files to Apaches document root. The location of document root is /var/www/html/

It’s a good idea to create a separate directory for your wordpress installation. This way you can install multiple websites in your document root.

sudo mkdir /var/www/html/wordpress
sudo rsync -avP ~/wordpress/ /var/www/html/wordpress

Now your wordpress files are moved to your document root thus making them accessible for your visitors.

After that remove the wordpress folder and latest.tar.gz  in your home directory

rm latest.tar.gz
rm -rf wordpress

Our next task in to make changes to the wordpress config file

Configure WordPress

Navigate to /var/www/html/wordpress

We have to copy  the wp-config-sample.php to wp-config.php and to remove the wp-config-sample.php

cp wp-config-sample.php wp-config.php rm wp-config-sample.php

Let’s open the wp-config.php and change some fields.

vim wp-config.php

There are some fields which you need to change. We are changing them with the database and user in MySQL that we have made a while back.

define('DB_NAME', 'yourdatabasename'); 
define('DB_USER', 'yourusername'); 
define('DB_PASSWORD', 'yourpassword');

Save the file and exit.

Now we have to give our server access rights to our wordpress directory. If we don’t do that we won’t be able to update plugins upload images etc.In order to accomplish that we have to login as root.

su

Enter your root password

sudo chown -R www-data:www-data /var/www/html/wordpress

Return to your normal user account

su - yourusername

We have to grant read access to our general directory. In order to do that type:

sudo chmod -R 755 /var/www

Modifying Apache

In order to associate the domain we chose for our website with it’s proper location we have to make some changes

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/wordpress.conf

Now we have to edit wordpress.conf

vim wordpress.conf

We need to add the following lines

ServerName yourdomain.com ServerAlias www.yourdomain.com
Also we have to change this to your E-mail in order for you to receive E-mails

ServerAdmin [email protected]

Save and exit

We need to enable our website

sudo a2ensite wordpress.conf

In order for changes to take effect type

sudo service apache2 restart

To access your wordpress installation type the name of your domain in your browser and follow the installation instructions.

If you want to use wordpress pretty permalinks feature you have to make some changes in the host file.

vim /etc/apache2/sites-available/wordpress.conf

You have to add those lines bellow DocumentRoot  /var/www/html/wordpress.

AllowOverride All

Save and close. Next we need to enable the rewrite module. This enables you to rewrite URL’s

sudo a2enmod rewrite

restart the apache web server

sudo service apache2 restart

We need to create a .htaccess file in order for wordpress to write changes to it.

sudo touch /var/www/html/wordpress/.htaccess

To make the web server the group owner type

sudo chown :www-data /var/www/html/wordpress/.htaccess

Our last step is to give the .htaccess file the right permissions

sudo chmod 664 /var/www/html/wordpress/.htaccess

You can enjoy your newly installed WordPress website. Cheers!

Installing LAMP on Ubuntu

LAMP is an acronym which consists of: Linux (in our case Ubuntu), Apache web server, MySQL database for storing our website data and PHP for handling the dynamic content.

Creating a non-root user with super user privileges

Before we begin with the installation of the LAMP instance we have to make sure we have a non-root user with super user privileges. This step is important because in Linux managing your system while logged in as root user is considered bad practice. The reason behind this is that the root user has very broad privileges which allow him to gain access and to execute critical commands-commands that can possibly lead to system failure.

In order for us to make a non-root user with super user privileges we need to be logged in as a root user.

Type su in your shell for logging in as root user.

su

If you don’t have a root account you have to create one.

In order to do so you need to run the following commands

sudo passwd root

You will be prompted for a password for your root account. Then you need to execute the following command in order to unlock your root account.

sudo passwd -u root

Now let’s create the user. Execute the following command:

adduser yourusername

You’ll be asked some questions. Other than the password the other fields aren’t mandatory.

In order to give your user root privileges execute the following:

gpasswd -a yourusername sudo

This will add your user to the sudo group. As a consequence every time when you run a command starting with sudo you’ll be executing it with root privileges.

In order to log in with your newly created user type this:

su – yourusername

Now let us get back to installing the LAMP instance.

Installing Apache Web Server

First we need to install the Apache web server. We’ll be using the Ubuntu repository for the task.

First we have to make sure that our repository is updated. We should run the following.

sudo apt-get update

After our repository has been updated we are ready to install the apache web server. Type this command:

sudo apt-get install apache2

Now our Apache Web Server is installed. To check if your Apache web server installation was successful type your server ip address in your browser. You have to see the Apache2 Ubuntu Default Page.

If you don’t know your server public ip address type the following:

Ip addr show

Next to inet you”ll find your ip address

Inet youripaddress/

When a directory is requested by default Apache first looks for index.html. We want to change that so as a result apache will look first for index.php. To do so type this:

sudo vim /etc/apache2/mods-enabled/dir.conf

We want to move the index.php in the first place next to the DirectoryIndex

DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm

Now we need to restart the Apache web server in order for our changes to take effect.

sudo service apache2 restart

Installing MySQL

MySQl is a database management system. With it you can easily store, access and organize your website information.

We need to run the following command in order to install MySQL:

sudo apt-get install mysql-server php5-mysql

During the installation you’ll be prompted for the MySQL root user password. Just generate one and enter it. After the installation we have to generate MySQL database directory structure.

sudo mysql_install_db

After that we have to run a security script in order to secure our MySQL installation.

sudo mysql_secure_installation

Remove the anonymous user, disallow the remote root login and remove the test database. After that reload the privileged tables. That’s it.

Installing PHP

PHP is going to be used in order to display our dynamically generated content. Again we are going to use the apt-get.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Now our php package has been installed. Php comes with optional modules you can install. In order to search them up type:

apt-cache search php5-

From the additional modules we will install php5-cli- command-line interpreter for the php5 scripting language.

sudo apt-get install php5-cli

Our last task is to test how php handles things. We have to create a test file in a specific directory (web root). on our server.

sudo vim /var/www/html/test.php

Now we want to put the following and to save the file:

<?php 
phpinfo(); 
?>

In order to test our php we need to navigate to the newly created test.php file in our browser.

http://your_server_IP_address/test.php

You have to see something like this:

php
In order to keep your server secured you should remove the test.php file

sudo rm /var/www/html/test.php

Now you have a working LAMP instance ready to host your websites.