Installing Apache on Ubuntu 20.04

How to install Apache on Ubuntu 20.04

Apache is one of the most popular and longstanding HTTP servers. It’s an open-source and cross-platform web server software developed and maintained by Apache Software Foundation. It’s easy to set up and learn to use, which has led to its widespread adoption for small and large scale websites.

In this guide, we’ll go over the step by step instructions to install Apache on Ubuntu 20.04 Focal Fossa.

In this tutorial you will learn:

  • How to install Apache web server on Ubuntu 20.04
  • How to control Apache web server with systemctl commands
  • How to open firewall for HTTP (port 80) and HTTPS (port 443)
  • How to host a website with Apache
  • How to install SSL certificate with Let’s Encrypt

Read more

Create redirect and rewrite rules into .htaccess on Apache webserver

Create redirect and rewrite rules into .htaccess on Apache webserver

When using the Apache web server, .htaccess files (also called “distributed configuration files”) are used to specify configuration on a per-directory basis, or more generally to modify the behavior of the Apache web server without having to access virtual hosts files directly (this is usually impossible for example, on shared hosts). In this tutorial we see how we can establish URL redirections and rewriting rules inside .htaccess files.

In this tutorial you will learn:

  • How .htaccess files work
  • How to setup URL rewriting rules in .htaccess files using the RewriteRule directive
  • How to setup URL redirection rules in .htaccess files using the Redirect and RedirectMatch directives

Read more

kimai time tracker installation docker

Kimai – Time Trakcer installation deployment using Docker

About

Kimai is a free open source timetracker. It tracks the time you spend with various pre-set projects and prints out a summary of your activities on demand. The automated docker Kimai time tracker image “linuxconfig/kimai” can be used to instantly deploy the Kimai time tracker on your docker hosts.

kimai time tracker installation docker

Configuration

The Kimai runs on Debian GNU/Linux system featuring Apache web server, MariaDB ( MySQL ), database and PHP5. After creating a docker container based on “linuxconfig/kimai” docker image, a port 80 will be exposed which can be access on the docker host for an immediate Kimai web configuration/installation as well as later access.

Configured MySQL users:passwords:

  • root:”empty password”
  • admin:”pass”

Configured MySQL databases:

  • kimai

Exposed ports:

  • 80

Deployment

The below command can be used to download and create a new docker container called kimai and link your docker host system’s port 80 with container’s exposed port 80.

# docker run -d --name=kimai -p 80:80 linuxconfig/kimai

Read more

Installing XAMPP on Ubuntu Linux

How to install XAMPP on Ubuntu Linux

Hosting a website on a Linux system usually involves multiple software packages that operate together to deliver a web browsing experience to potential viewers. For example, it’s common for PHP to dynamically render web content but retrieve data from a database. These are two separate components and they must both be installed to present a website as intended.

XAMPP is a software stack that can run on Ubuntu Linux and make your life a little easier when it comes to web hosting. XAMPP stands for cross-platform (X), Apache (A), MariaDB (M), PHP (P), and Perl (P). These are all common components used in web hosting, and combining them into a single installation makes the initial setup less complicated. XAMPP also comes with Bitnami, which allows you to install content managements systems, such as WordPress, as well as other apps on top of your XAMPP installation if you choose.

In this guide, we’ll cover the installation of XAMPP on Ubuntu Linux. Follow along with our step by step instructions to get it setup on your own system.

In this tutorial you will learn:

  • How to install XAMPP on Ubuntu Linux
  • How to manage your XAMPP installation
Installing XAMPP on Ubuntu Linux

Installing XAMPP on Ubuntu Linux

Read more

Redirect HTTP traffic to HTTPS in Apache

How to use Apache to redirect all traffic from http to https

If your website uses Apache and SSL, there’s not much reason to keep using HTTP with your website. Having both HTTP and HTTPS just creates duplicate content, as now any given page will be accessible through two technically different URLs.

In this guide, we’ll assume you’re already using Apache on a Linux system and want to redirect all HTTP traffic to HTTPS. This will make sure that all your visitors are only connecting through HTTPS by forcing their browser over to the secure protocol if they happen to open an HTTP link. If a user decides to preface a link with http://, your site will be smart enough to still send them to the correct page, rather than showing duplicate content or displaying a 404 error.

There are two ways to set up this redirection in Apache. The better method is to configure Virtual Host, but users with hosted websites may not have access to this configuration. The second method is by making some changes to the .htaccess file. We’ll cover the step by step instructions for both methods below. Let’s get started.

In this tutorial you will learn:

  • How to redirect HTTP to HTTPS with Virtual Host
  • How to redirect HTTP to HTTPS with .htaccess file

Read more

How to restrict access to a resource using Apache on Linux

How to restrict access to a resource using Apache on Linux

Restricting access to a resource is often required when using the web. On complex web applications, this is often implemented using a login system which can be more or less sophisticated. If our requirements our pretty basic, however, we can use the authentication system provided by the Apache web server. In this tutorial we will see how can we do it.

In this tutorial you will learn:

  • How to restrict access to a web page using the Apache web server
  • How to store the user passwords in plain text files
  • How to store the user passwords in a database
  • How to allow access to multiple users

Read more

Apache Hadoop on Ubuntu 20.04 Focal Fossa

Ubuntu 20.04 Hadoop

Apache Hadoop is comprised of multiple open source software packages that work together for distributed storage and distributed processing of big data. There are four main components to Hadoop:

  • Hadoop Common – the various software libraries that Hadoop depends on to run
  • Hadoop Distributed File System (HDFS) – a file system that allows for efficient distribution and storage of big data across a cluster of computers
  • Hadoop MapReduce – used for processing the data
  • Hadoop YARN – an API that manages the allocation of computing resources for the entire cluster

In this tutorial, we will go over the steps to install Hadoop version 3 on Ubuntu 20.04. This will involve installing HDFS (Namenode and Datanode), YARN, and MapReduce on a single node cluster configured in Pseudo Distributed Mode, which is distributed simulation on a single machine. Each component of Hadoop (HDFS, YARN, MapReduce) will run on our node as a separate Java process.

In this tutorial you will learn:

  • How to add users for Hadoop Environment
  • How to install Java prerequisite
  • How to configure passwordless SSH
  • How to install Hadoop and configure necessary related XML files
  • How to start the Hadoop Cluster
  • How to access NameNode and ResourceManager Web UI

Read more

LAMP server setup on Ubuntu 20.04 Focal Fossa

How to setup LAMP server on Ubuntu 20.04 Focal Fossa

LAMP is a conventional model of web service stacks. The components that LAMP is built from are all open-source and include: the Linux operating system, the Apache HTTP Server, the MySQL relational database management system, and the PHP programming language. In this short tutorial we will be configuring a basic LAMP server on Ubuntu 20.04 Focal Fossa.

You may also be interested in our article on creating a docker based LAMP stack on Ubuntu 20.04.

In this tutorial you will learn:

  • How to install LAMP server on Ubuntu 20.04.
  • How to open firewall port to allow HTTP and HTTPS incoming traffic.
  • How to connect to MySQL database using a PHP script.

Read more

Using cookies in PHP

How to enable sessions in PHP with cookies

Cookies are all around in our everyday life while we browse the Internet. Most people wouldn’t know much about them, if not for those “our website uses cookies to be operational” signs that are on mostly any page now since GDPR. Cookies have a long history if sometimes being good, sometimes bad. As it is usual with most aspects of the world, this technology can be used in a good or bad way.

In this tutorial we will explore cookies a bit from the server side programming perspective: we’ll create an example cookie in PHP, and store the visitor’s chosen username in it. The cookie will reside in the browser of the visitor, so on the next visit we can read it and use it to greet the visitor on the username submitted.

Our simple webpage will recognize the visitor as long as the cookie is present in the browser. We do not store any information on the server side: if the visitor first checks in from a PC, and next time from a smartphone, we will not know it is the same individual. This is one of the main point with cookies: we can only identify the given client, and only as long as the data is provided by that particular browser.

In this tutorial you will learn:

  • How to setup the test environment
  • How to write a simple example program that uses cookies
  • How to test the workings of the program
  • How to reset the environment

Read more