Commands to install Apache Web server on Ubuntu 22.04 or 20.04 LTS

If you need to learn the way to run and entry a web site from a distant location, we want a Web server and what it’s extra sensible than beginning with Apache if you’re new to the internet hosting world. Here on this tutorial, we’ll be taught the command to install and begin Apache net server on Ubuntu 22.04 LTS Jammy JellyFish or Ubuntu 20.04 LTS focal fossa.

Apache is essentially the most extensively used net server on the Internet. And will be simply configured due to its versatile nature and skill to increase options with the assistance of numerous modules. It has been developed and maintained beneath the Apache basis.

Usually, the Apache net server is put in with PHP and MySQL/MariaDB. Although, Apache itself delivers solely static HTML pages. However, when mixed with PHP (PHP Hypertext Preprocessor) like scripting language it may serve the Dynamic HTML pages generated from database contents.

Most of the favored content material administration programs (CMS) corresponding to WordPress or Joomla subsequently additionally want PHP and the MySQL database. And when it comes to the set up of Apache, all common Linux distributions corresponding to RedHat, CentOS, Ubuntu Debian, and others have Apache packages of their respective base repository, in order that the person can install it with only one command. We can use Apache on Windows however being an open-source venture and native to Linux programs and their dominance within the server world, internet hosting providers presents it on Linux solely to get the total potential of this net server software program.

Whereas, these builders are on Windows and dealing on some net venture that requires Apache, normally go for XAMPP or WampServer just like the initiatives to get the entire LAMP stack simply up and operating.

Steps to install Apache net server on Ubuntu 22.04| 20.04 LTS

What do you want to observe steps on this tutorial?

• Ubuntu 22.04|20.4|18.04 Server
• A non-root person with sudo rights
• Internet Connection

1. Apt Update

If you’ve gotten simply put in a contemporary Ubuntu server on your native machine, Cloud, or some VPS then first run the system replace command. This will refresh the repository cache in addition to install if there are any updates accessible in your system.

sudo apt replace

 

2. Command to install Apache on Ubuntu 22.04 | 20.04 LTS

Next, as talked about originally of the tutorial that we don’t require to add any third-party repository as a result of the package deal to install Apache webserver is already within the base repository of ubuntu Linux.

sudo apt install apache2

 

3. Start and Enable Apache service

Once the set up is accomplished, first examine whether or not the service of Apache is already operating within the background or not utilizing the given command:

systemctl standing apache2

If it isn’t operating, then begin and allow the identical with this command:

sudo systemctl allow --now apache2

 

4. Allow port 80/443 on Ubuntu 22.04 | 20.04

Depending upon the place you’ve gotten put in your Ubuntu 20.04/22.04 Server, we’ve got to open the firewall for 2 ports 80 for HTTP and 443 for HTTPS. If you might be on Cloud then use your service supplier’s community firewall to open these ports. Whereas, in case the system additionally has the firewall enabled then run:

Check whether or not the system firewall is energetic or not.

sudo ufw standing

If the output comes as ‘energetic‘ then run

sudo ufw enable 80/tcp
sudo ufw enable 443/tcp

 

5. Access Demo Web web page

Now, the Apache webserver is up and operating, it’s time to entry its demo net web page to affirm every thing is working as completely as we wish.

Open your browser on a system that may entry the IP deal with or area the place you’ve gotten put in the Apache. And level it to URL because the given syntax:

http://server-ip-address

Replace the server-IP-address with the true Ip-address of your Ubuntu 22.04 or 20.04 Server. If you don’t know the deal with then in your server’s command terminal run:

ip a

 

Reload Restart or Stop Apache instructions

There are many eventualities the place after putting in some net utility we both want to restart or cease the Apache webserver service. And if you’re in any of such eventualities, then listed here are the instructions to observe:

•  To reload: It means, let the webserver stay operating however simply refresh or reload the configuration file.

sudo systemctl reload apche2

  To gracefully restart: In this, the Apache will exit course of threads when they’re completed and idle, after which reload the configuration.

sudo /and so forth/init.d/apache2 swish

  To restart: This will kill all of the threads, cease the webserver and begin it once more.

sudo systemctl restart apache2

  To cease: Shut down webserver service utterly.

sudo systemctl cease apache2

  To begin:

sudo systemctl begin apache2

  To disable the Apache from beginning robotically with system boot, use:

sudo systemctl disable apache2

Whereas to allow it once more:

sudo systemctl allow apache2

 

Completely Uninstall Apache from Ubuntu 22.04 or 20.04

To utterly take away the webserver, should you don’t require it, run:

sudo apt take away apache2*

For extra information examine the official Apache Documentation whereas to be taught additional, see- how to install WordPress on Apache Server running on CentOS/AlmaLinux/Rocky/RHEL/Oracle

 

 

 

https://www.how2shout.com/linux/commands-to-install-apache-web-server-on-ubuntu-22-04-or-20-04-lts/

Related Posts