How to Install Apache Webserver in Linux Ubuntu 19.10 in Command Line

Posted on


This is an article for installing Apache Webserver in a Linux Ubuntu 19.10 operating system. The installation process will be exist in a command line interface using a specific command. There are two parts for the installation of Apache Webserver. The first one is the preparation step. The other one is the actual installation sptep. So, continue on to the installation, just perform the preparation step first as follows :


Preparation for Apache Webserver Installation in Linux Ubuntu 19.10

The following is the preparation step :

1. First of all, don’t forget to switch to root or admin user account. In order to switch to it, just execute the following command in the command line :

user@hostname:~$ sudo su - 
[sudo] password for user: 

2. In order to make sure that everything is up-to-date, including the package file installation of Apache Webserver, just execute the following command :

apt update

Installation Process of Apache Webserver in Linux Ubuntu 19.10

1. After successfully switching to a root or an admin user account, execute the following command. It is a command which is utilizing the ‘apt’ tool. There is an additional parameter ‘install’ followed by the name of the package for the installation process. The following is the output of the command process execution :

root@hostname:~# apt install apache2 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 1.820 kB of archives.
After this operation, 7.917 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 libapr1 amd64 1.6.5-1 [91,6 kB]
Get:2 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 libaprutil1 amd64 1.6.1-4build1 [84,8 kB]
Get:3 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.1-4build1 [10,5 kB]
Get:4 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 libaprutil1-ldap amd64 1.6.1-4build1 [8.740 B]
Get:5 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 liblua5.2-0 amd64 5.2.4-1.1build2 [106 kB]
Get:6 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 apache2-bin amd64 2.4.41-1ubuntu1 [1.179 kB]                                                                                                     
Get:7 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 apache2-data all 2.4.41-1ubuntu1 [159 kB]                                                                                                        
Get:8 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 apache2-utils amd64 2.4.41-1ubuntu1 [85,2 kB]                                                                                                    
Get:9 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 apache2 amd64 2.4.41-1ubuntu1 [95,5 kB]                                                                                                          
Fetched 1.820 kB in 10s (185 kB/s)                                                                                                                                                                         
Selecting previously unselected package libapr1:amd64.
(Reading database ... 143468 files and directories currently installed.)
Preparing to unpack .../0-libapr1_1.6.5-1_amd64.deb ...
Unpacking libapr1:amd64 (1.6.5-1) ...
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack .../1-libaprutil1_1.6.1-4build1_amd64.deb ...
Unpacking libaprutil1:amd64 (1.6.1-4build1) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.
Preparing to unpack .../2-libaprutil1-dbd-sqlite3_1.6.1-4build1_amd64.deb ...
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.6.1-4build1) ...
Selecting previously unselected package libaprutil1-ldap:amd64.
Preparing to unpack .../3-libaprutil1-ldap_1.6.1-4build1_amd64.deb ...
Unpacking libaprutil1-ldap:amd64 (1.6.1-4build1) ...
Selecting previously unselected package liblua5.2-0:amd64.
Preparing to unpack .../4-liblua5.2-0_5.2.4-1.1build2_amd64.deb ...
Unpacking liblua5.2-0:amd64 (5.2.4-1.1build2) ...
Selecting previously unselected package apache2-bin.
Preparing to unpack .../5-apache2-bin_2.4.41-1ubuntu1_amd64.deb ...
Unpacking apache2-bin (2.4.41-1ubuntu1) ...
Selecting previously unselected package apache2-data.
Preparing to unpack .../6-apache2-data_2.4.41-1ubuntu1_all.deb ...
Unpacking apache2-data (2.4.41-1ubuntu1) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../7-apache2-utils_2.4.41-1ubuntu1_amd64.deb ...
Unpacking apache2-utils (2.4.41-1ubuntu1) ...
Selecting previously unselected package apache2.
Preparing to unpack .../8-apache2_2.4.41-1ubuntu1_amd64.deb ...
Unpacking apache2 (2.4.41-1ubuntu1) ...
Setting up libapr1:amd64 (1.6.5-1) ...
Setting up liblua5.2-0:amd64 (5.2.4-1.1build2) ...
Setting up apache2-data (2.4.41-1ubuntu1) ...
Setting up libaprutil1:amd64 (1.6.1-4build1) ...
Setting up libaprutil1-ldap:amd64 (1.6.1-4build1) ...
Setting up libaprutil1-dbd-sqlite3:amd64 (1.6.1-4build1) ...
Setting up apache2-utils (2.4.41-1ubuntu1) ...
Setting up apache2-bin (2.4.41-1ubuntu1) ...
Setting up apache2 (2.4.41-1ubuntu1) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling module reqtimeout.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Created symlink /etc/systemd/system/ → /lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/ → /lib/systemd/system/apache-htcacheclean.service.
Processing triggers for ufw (0.36-1ubuntu3) ...
Processing triggers for systemd (242-7ubuntu3.2) ...
Processing triggers for man-db (2.8.7-3) ...
Processing triggers for libc-bin (2.30-0ubuntu2) ...

In the above output command execution, the installation process of Apache Webserver is actually end without any warning or error messages. In other words, the installation process is actually a success. Just continue on to the following step.

2. Next step, don’t forget to start the Apache Webserver’s service. It is very simple and easy. As a root or an admin user account, execute the following command :

root@hostname:~# systemctl start apache2

As in the above output, after executing the command for starting the Apache Webserver’s service, there is no warning or error messages following it. So, in order to check whether the service is running well, just continue on into the following step.

3. Last but not least, make sure that the Apache Webserver’s service is running well. By executing the following command, it will present and print an output about the Apache Webserver’s service current condition :

root@hostname:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-12-16 11:10:57; 2min 49s ago
 Main PID: 7462 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 6.7M
   CGroup: /system.slice/apache2.service
           ├─7462 /usr/sbin/apache2 -k start
           ├─7463 /usr/sbin/apache2 -k start
           └─7464 /usr/sbin/apache2 -k start

Des 16 11:10:57 hostname systemd[1]: Starting The Apache HTTP Server...
Des 16 11:10:57 hostname apachectl[7438]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to su
Des 16 11:10:57 hostname systemd[1]: Started The Apache HTTP Server.
lines 1-15/15 (END)

According to the above output, the Apache Webserver’s service is running well. There is an information hinting that the service is running. The information exist in the line with there is a keyword of ‘Active: active (running). So, the installation of the Apache Webserver is a success.

Leave a Reply