In this tutorial we will learn to install Apache on CentOS.
Apache is one of the most popular web server. It is a free and open source software and used mostly on Unix-based system (usually Linux).
Assuming that you have a new server and you have installed a version of Linux operating system and you have the root access. So, open the terminal and login to the server as the root user.
Lets start the installation process...
Note! we will be using sudo in our commands. This will give us root privileges.
Its a best practice to first clean up and update yum and then perform installation.
Clean up yum by typing the following in terminal.
# sudo yum clean all
Now perform the update
# sudo yum -y update
Once the update is done we are ready to install Apache.
To install Apache we need to run the following command.
# sudo yum -y install httpd
Once we have Apache installed we need to start the Apache web server. For this run the following command.
# sudo systemctl start httpd
To make sure that our Apache web server starts at bootup we have to running the following command.
# sudo systemctl enable httpd
To check the status of the Apache web server run the following command.
# sudo systemctl status httpd
In case you want to stop the Apache web server type in the following command.
# sudo systemctl stop httpd
And to restart Apache run the following command.
# sudo systemctl restart httpd