> For the complete documentation index, see [llms.txt](https://paul-gleason.gitbook.io/champlain-college-classes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://paul-gleason.gitbook.io/champlain-college-classes/sec-440-systems-security/labs/project-3-web-application-and-database-redundancy.md).

# Project 3 - Web Application and Database Redundancy

Setup u1, u2, u3

‘’’

sudo hostnamectl set-hostname db0X-paul

sudo passwd champuser

sudo adduser paul

sudo usermod -aG sudo paul

‘’’

Setup networking

‘’’

sudo nano /etc/netplan/00-installer-config.yaml

‘’’

![](https://lh4.googleusercontent.com/2NN8IC2oQXzgx5-oAEInvQIFO3CsHyT1Go2ppt3d1Qs8JSyaO0hnTY_3kC6M3DEDm1a13fx2KcLY_L7BmEjqARJjm_0OS9tatQDmXRaCtoU0qdsAPDV7CTdFp8-a7cDQP_SomN3Eov0hBHu9RL8Wy5E)

\ <br>

Setup MariaDB with Galera Cluster

<br>

‘’’

Sudo apt install mariadb-server

‘’’

<br>

Edit the Galera Config

‘’’

Sudo nano /etc/mysql/mariadb.conf.d/60-galera.cnf

‘’’

![](https://lh5.googleusercontent.com/xv59-Q0SnrdEPjN-1tHUpjLW1t8llyrXpDDQUi6Pk4bAUxKJ3cPkSrOkSDLcqHtEUeSDz1qfMjcwydhkxVCn1YqhxP0ws17yXk9BewOjh-CXD_Bf4B27_kLMIlXK1QabSBuhAN6504AoyhbXTfV4Hko)

Resources:

<https://www.server-world.info/en/note?os=Ubuntu_22.04&p=mariadb&f=1>&#x20;

<https://www.linuxbabe.com/mariadb/galera-cluster-ubuntu>&#x20;

\ <br>

Update ha proxy to support db:

‘’’

Sudo nano /etc/haproxy/haproxy.cfg

‘’’

![](https://lh6.googleusercontent.com/JXzfG6DUBTz4wYIBFbTXfuoXFiaJFoFCDmAtLMVeCEKCpmK_V2KBtYVM-3vLA5q2cBW8-DZTnLLeItpuN76gOSXaXBGhUULyIPpYH4KyyqJU8hsp96Tuw09cMDYri6oGMBYgmS2b8mu5LNNqlKSTDH8)

<br>

Now restart haproxy

<br>

Now check if lan can connect the database

![](https://lh3.googleusercontent.com/USlMM1jNaT1QgUyLOk17-XYfk561ZENnKlCHA0VC05X65zA1iMrp5O9b8vyTqaIYPtRiTuK2JwxqCR2GIx56BEFW_Lfe6raZ7X50ISj8JfAuOFQzsK9_prCp95YOJIQXjrR4zTSvW_31s4HyzOw4JPs)

<br>

GRANT ALL PRIVILEGES ON \*.\* TO 'root'@'%'&#x20;

&#x20; IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

\ <br>

Make Database:

<br>

CREATE DATABASE futurama;

USE futurama;

![](https://lh4.googleusercontent.com/qJ0ZtberwOpHM--HQsw_AMplv06bd1NjyTLRTw9q18sMuOVOMhsc8PuLu34C5OgJHUxeZt1h3mOVbtME-XQ_FAj22Cfo8rMUitgpTdBCD_y2GmmcZD1HGysZ_3ZyQ_OpB0toiS_N55UcxRRFaAD6YsQ)

\ <br>

WEB:

<br>

Yum install php php-mysql mysql

sudo setsebool -P httpd\_can\_network\_connect\_db on

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://paul-gleason.gitbook.io/champlain-college-classes/sec-440-systems-security/labs/project-3-web-application-and-database-redundancy.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
