Installing Apache on CentOS 7.5
*The Base Image for this tutorial is a Digital Ocean CentOs 7.5 Image with 1GB Memory and 25GB Diskspace.
1. Connecting to your Server
You will need a SSH-Client like Putty if you are coming from Windows. On Unix-OS like OSX and Linux you can use terminal.
After connecting to the server you will be greeted by the following screen:
2. If you are logged in as root, it is highly recommended that you create another account and add this account to the wheel group. To achieve this, you have to type the following on the terminal.
where <username> can be any name you would like to have for the account. For this tutorial, we are going to create the user “corefinity”.
After hitting Enter, you need to assign a password to this user, as it won’t be enabled like in Ubuntu without doing so. To achieve this, you need to type
and repeat the password twice. You now have created your first user.
Unfortunately, this user doesn’t have any root-permissions yet, but we are going to change this now
As we are still logged in as root, we are now going to add our corefinity-user to the group of wheel.
usermod -aG wheel corefinity
will achieve this. We now have a non-root account, which can install software and updates.
To switch to this user, we need to type
and to exit this user and return to root, we just need to type
and hit enter.
3. The first step you will need to do is updating your base image. Under our newly created corefinity-user, we need to type the following:
sudo yum update -y
and run the command by hitting enter. This will update yum’s packages and look similar to the following screenshot.
4. Now it’s time to install apache. This can be done by typing
sudo yum install httpd -y
Yum will download the apache-package and install it.
We now need to enable apache by typing
sudo systemctl enable httpd
sudo systemctl start httpd
and after running these commands, we can see if we were successful by typing
service httpd status
If everything went well, you will see several rows of text, which might look equal to the following screenshot.
Or you can open a browser and type in your server-ip and should be greeted by a website like this: