Install Wget, Apache and PHP on CentOS

In this tutorial we will show you how to install and configuration wget command, Apache and PHP, and you can install them by using the default CentOS Package Manager, yum. The advantages of using yum (as opposed to installing by using source code) are that you get any security updates (when they are distributed) and dependencies are automatically handled.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS or Cloud. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation wget on a CentOS server.

Install Wget

Wget is a free network utility to download files from the Web using http and ftp, the two most widely used Internet protocols. Wget utility is available for free and licensed is under GNU GPL License. However, it’s also supports https protocol as well as retrieval through HTTP proxies.

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing wget.

To install the wget command on a CentOS machine just run the command:

Example wget command

To download a single file from a website using the following command:

If your web page requires a username and password use the following command:

Download a file from an ftp site using the following command:

If your ftp site requires a username and password use the following command:

Download and entire website using the following command:

Download and save it in a specific path using the following command:

Download a file and save it under a different name using the following command:

Resume an interrupted file download using the following command:

Limit download speed of a file using the following command:


Install Apache

  • Run the following command:

  • Because the server does not start automatically when you install Apache, you must start it manually.

The following message is displayed:

The IP address (shown in this example as is used as the server name by default. In the following steps, set the server name for the next time the server is started.

  • Open the main Apache configuration file.

  • Toward the end of the file, locate the section that starts with ServerName and gives an example.

  • Enter your cloud server host name or a fully qualified domain name. In the following example, the host name is demo.

  • Reload Apache.

Open the port to run Apache

Apache runs on port 80. In some versions of CentOS, a firewall, which is installed by default, blocks access to port 80. Perform the following steps to open the port.

  • Run the following command:

  • After adding that instruction, save your firewall rules so that your web server is accessible the next time you reboot.


Test the Apache installation

Navigate to your Cloud Server IP address (for example,

If the default CentOS Apache “welcome” screen is displayed, the installation was successful.


Configure Apache to run automatically

Now that Apache is installed and working, set to start automatically when the server is rebooted.

  • Run the following command:

  • Test to confirm that the setting works.


Install PHP

  • Run the following command:

The preceding command does not install all the modules available, just a few common ones.

  • Reload Apache.


Prakash S

Prakash S

I would like to introduce myself as a Software professional opting for the career in software industry. I'm Prakash S, a MCA graduate and trained as industry level practice for Software technology. Basically I am a PHP Developer but now days exploring more in HTML5, CSS, AngularJS and jQuery libraries.